From da73155991b589797ae6392f9f843e0517ef9a8a Mon Sep 17 00:00:00 2001 From: Elypha Rin Date: Tue, 26 Dec 2023 16:30:46 +0900 Subject: [PATCH] update 1.37 & refactor --- .../aria2-mingw.dockerfile | 0 {archived => .archived}/aria2.dockerfile | 0 .../aria2c-linux-amd64.dockerfile | 0 .../build-aria2c-linux-actions.yml | 0 .../workflows/aria2c-linux-amd64-openssl.yml | 31 +++ .../workflows/aria2c-windows-i686-openssl.yml | 33 +++ .../workflows/aria2c-windows-i686-wintls.yml | 31 +++ .../aria2c-windows-x86_64-openssl.yml | 33 +++ .../aria2c-windows-x86_64-wintls.yml | 31 +++ .../workflows/build-aria2c-linux-amd64.yml | 29 --- .../workflows/build-aria2c-windows-amd64.yml | 35 --- .../workflows/build-ariang-windows-amd64.yml | 12 +- .gitignore | 1 + ...e => aria2c-linux-amd64-openssl.dockerfile | 173 ++++++++----- ... => aria2c-windows-i686-openssl.dockerfile | 217 ++++++++++------ aria2c-windows-i686-wintls.dockerfile | 233 ++++++++++++++++++ aria2c-windows-x86_64-openssl.dockerfile | 233 ++++++++++++++++++ aria2c-windows-x86_64-wintls.dockerfile | 233 ++++++++++++++++++ ariang-windows-amd64.dockerfile | 44 ---- 19 files changed, 1110 insertions(+), 259 deletions(-) rename {archived => .archived}/aria2-mingw.dockerfile (100%) rename {archived => .archived}/aria2.dockerfile (100%) rename {archived => .archived}/aria2c-linux-amd64.dockerfile (100%) rename {archived => .archived}/build-aria2c-linux-actions.yml (100%) create mode 100644 .github/workflows/aria2c-linux-amd64-openssl.yml create mode 100644 .github/workflows/aria2c-windows-i686-openssl.yml create mode 100644 .github/workflows/aria2c-windows-i686-wintls.yml create mode 100644 .github/workflows/aria2c-windows-x86_64-openssl.yml create mode 100644 .github/workflows/aria2c-windows-x86_64-wintls.yml delete mode 100644 .github/workflows/build-aria2c-linux-amd64.yml delete mode 100644 .github/workflows/build-aria2c-windows-amd64.yml create mode 100644 .gitignore rename aria2c-linux-amd64.dockerfile => aria2c-linux-amd64-openssl.dockerfile (56%) rename aria2c-windows-amd64.dockerfile => aria2c-windows-i686-openssl.dockerfile (51%) create mode 100644 aria2c-windows-i686-wintls.dockerfile create mode 100644 aria2c-windows-x86_64-openssl.dockerfile create mode 100644 aria2c-windows-x86_64-wintls.dockerfile delete mode 100644 ariang-windows-amd64.dockerfile diff --git a/archived/aria2-mingw.dockerfile b/.archived/aria2-mingw.dockerfile similarity index 100% rename from archived/aria2-mingw.dockerfile rename to .archived/aria2-mingw.dockerfile diff --git a/archived/aria2.dockerfile b/.archived/aria2.dockerfile similarity index 100% rename from archived/aria2.dockerfile rename to .archived/aria2.dockerfile diff --git a/archived/aria2c-linux-amd64.dockerfile b/.archived/aria2c-linux-amd64.dockerfile similarity index 100% rename from archived/aria2c-linux-amd64.dockerfile rename to .archived/aria2c-linux-amd64.dockerfile diff --git a/archived/build-aria2c-linux-actions.yml b/.archived/build-aria2c-linux-actions.yml similarity index 100% rename from archived/build-aria2c-linux-actions.yml rename to .archived/build-aria2c-linux-actions.yml diff --git a/.github/workflows/aria2c-linux-amd64-openssl.yml b/.github/workflows/aria2c-linux-amd64-openssl.yml new file mode 100644 index 0000000..4585981 --- /dev/null +++ b/.github/workflows/aria2c-linux-amd64-openssl.yml @@ -0,0 +1,31 @@ +name: aria2c-linux-amd64-openssl + +on: + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-22.04 + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + sparse-checkout: | + aria2c-linux-amd64-openssl.dockerfile + sparse-checkout-cone-mode: false + + - name: Docker build + run: docker build -t build_i - < aria2c-linux-amd64-openssl.dockerfile + + - name: Fetch + run: | + docker run --name build_c build_i \ + docker cp build_c:/build/aria2c . + + - name: Upload + uses: actions/upload-artifact@v4 + with: + name: aria2c-linux-amd64-openssl + path: | + ./aria2c diff --git a/.github/workflows/aria2c-windows-i686-openssl.yml b/.github/workflows/aria2c-windows-i686-openssl.yml new file mode 100644 index 0000000..cabc350 --- /dev/null +++ b/.github/workflows/aria2c-windows-i686-openssl.yml @@ -0,0 +1,33 @@ +name: aria2c-windows-i686-openssl + +on: + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-22.04 + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + sparse-checkout: | + aria2c-windows-i686-openssl.dockerfile + sparse-checkout-cone-mode: false + + - name: Docker build + run: docker build -t build_i - < aria2c-windows-i686-openssl.dockerfile + + - name: Fetch + run: | + docker run --name build_c build_i \ + docker cp build_c:/build/aria2c.exe . \ + docker cp build_c:/etc/ssl/certs/ca-certificates.crt . + + - name: Upload + uses: actions/upload-artifact@v4 + with: + name: aria2c-windows-i686-openssl + path: | + ./aria2c.exe + ./ca-certificates.crt diff --git a/.github/workflows/aria2c-windows-i686-wintls.yml b/.github/workflows/aria2c-windows-i686-wintls.yml new file mode 100644 index 0000000..34cda52 --- /dev/null +++ b/.github/workflows/aria2c-windows-i686-wintls.yml @@ -0,0 +1,31 @@ +name: aria2c-windows-i686-wintls + +on: + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-22.04 + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + sparse-checkout: | + aria2c-windows-i686-wintls.dockerfile + sparse-checkout-cone-mode: false + + - name: Docker build + run: docker build -t build_i - < aria2c-windows-i686-wintls.dockerfile + + - name: Fetch + run: | + docker run --name build_c build_i \ + docker cp build_c:/build/aria2c.exe . + + - name: Upload + uses: actions/upload-artifact@v4 + with: + name: aria2c-windows-i686-wintls + path: | + ./aria2c.exe diff --git a/.github/workflows/aria2c-windows-x86_64-openssl.yml b/.github/workflows/aria2c-windows-x86_64-openssl.yml new file mode 100644 index 0000000..3dce846 --- /dev/null +++ b/.github/workflows/aria2c-windows-x86_64-openssl.yml @@ -0,0 +1,33 @@ +name: aria2c-windows-x86_64-openssl + +on: + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-22.04 + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + sparse-checkout: | + aria2c-windows-x86_64-openssl.dockerfile + sparse-checkout-cone-mode: false + + - name: Docker build + run: docker build -t build_i - < aria2c-windows-x86_64-openssl.dockerfile + + - name: Fetch + run: | + docker run --name build_c build_i \ + docker cp build_c:/build/aria2c.exe . \ + docker cp build_c:/etc/ssl/certs/ca-certificates.crt . + + - name: Upload + uses: actions/upload-artifact@v4 + with: + name: aria2c-windows-x86_64-openssl + path: | + ./aria2c.exe + ./ca-certificates.crt diff --git a/.github/workflows/aria2c-windows-x86_64-wintls.yml b/.github/workflows/aria2c-windows-x86_64-wintls.yml new file mode 100644 index 0000000..26af2c4 --- /dev/null +++ b/.github/workflows/aria2c-windows-x86_64-wintls.yml @@ -0,0 +1,31 @@ +name: aria2c-windows-x86_64-wintls + +on: + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-22.04 + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + sparse-checkout: | + aria2c-windows-x86_64-wintls.dockerfile + sparse-checkout-cone-mode: false + + - name: Docker build + run: docker build -t build_i - < aria2c-windows-x86_64-wintls.dockerfile + + - name: Fetch + run: | + docker run --name build_c build_i \ + docker cp build_c:/build/aria2c.exe . + + - name: Upload + uses: actions/upload-artifact@v4 + with: + name: aria2c-windows-x86_64-wintls + path: | + ./aria2c.exe diff --git a/.github/workflows/build-aria2c-linux-amd64.yml b/.github/workflows/build-aria2c-linux-amd64.yml deleted file mode 100644 index b5b1e5a..0000000 --- a/.github/workflows/build-aria2c-linux-amd64.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: aria2c-linux-amd64 - -on: - workflow_dispatch: - -jobs: - build: - runs-on: ubuntu-22.04 - - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - sparse-checkout: | - aria2c-linux-amd64.dockerfile - sparse-checkout-cone-mode: false - - - name: Docker build - run: docker build -t aria2c-linux-amd64 - < aria2c-linux-amd64.dockerfile - - - name: Fetch - run: | - docker cp $(docker create aria2c-linux-amd64):/build/aria2c . - - - name: Upload - uses: actions/upload-artifact@v3 - with: - name: aria2c-linux-amd64 - path: ./aria2c diff --git a/.github/workflows/build-aria2c-windows-amd64.yml b/.github/workflows/build-aria2c-windows-amd64.yml deleted file mode 100644 index 3ee1551..0000000 --- a/.github/workflows/build-aria2c-windows-amd64.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: aria2c-windows-amd64 - -on: - workflow_dispatch: - -jobs: - build: - runs-on: ubuntu-22.04 - - # RIP x86 - # strategy: - # fail-fast: false - # matrix: - # platform: [x86_64-w64-mingw32, i686-w64-mingw32] - - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - sparse-checkout: | - aria2c-windows-amd64.dockerfile - sparse-checkout-cone-mode: false - - - name: Docker build - run: docker build -t aria2c-windows-amd64 - < aria2c-windows-amd64.dockerfile - - - name: Fetch - run: | - docker cp $(docker create aria2c-windows-amd64):/build/aria2c.exe . - - - name: Upload - uses: actions/upload-artifact@v3 - with: - name: aria2c-windows-amd64 - path: ./aria2c.exe diff --git a/.github/workflows/build-ariang-windows-amd64.yml b/.github/workflows/build-ariang-windows-amd64.yml index 749ee60..b2e014f 100644 --- a/.github/workflows/build-ariang-windows-amd64.yml +++ b/.github/workflows/build-ariang-windows-amd64.yml @@ -9,12 +9,12 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install Node.js shell: pwsh run: | - Invoke-WebRequest -Uri "https://nodejs.org/dist/v20.3.0/node-v20.3.0-x64.msi" -OutFile "nodejs.msi"; ` + Invoke-WebRequest -Uri "https://nodejs.org/dist/v21.5.0/node-v21.5.0-x64.msi" -OutFile "nodejs.msi"; ` msiexec /i nodejs.msi - name: Get source code @@ -42,25 +42,25 @@ jobs: npm run publish:win; - name: Upload artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: AriaNg_Native-windows-x64.7z path: ariang/dist/AriaNg_Native-?.?.?-Windows-x64.7z - name: Upload artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: AriaNg_Native-windows-x86.7z path: ariang/dist/AriaNg_Native-?.?.?-Windows-x86.7z - name: Upload artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: AriaNg_Native-windows-x64.exe path: ariang/dist/AriaNg_Native-?.?.?-Windows-x64.exe - name: Upload artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: AriaNg_Native-windows-x86.exe path: ariang/dist/AriaNg_Native-?.?.?-Windows-x86.exe diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..147454d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +notes.md diff --git a/aria2c-linux-amd64.dockerfile b/aria2c-linux-amd64-openssl.dockerfile similarity index 56% rename from aria2c-linux-amd64.dockerfile rename to aria2c-linux-amd64-openssl.dockerfile index 15faeff..0c772b6 100644 --- a/aria2c-linux-amd64.dockerfile +++ b/aria2c-linux-amd64-openssl.dockerfile @@ -1,9 +1,12 @@ -# Dockerfile to build aria2c binary on debian -# docker build -t aria2c-linux-amd64 - < aria2c-linux-amd64.dockerfile -# docker run --name my_build aria2c-linux-amd64 -# docker cp my_build:/build/aria2c . -# docker rm my_build -# docker rmi aria2c-linux-amd64 +# build +# $ docker build -t build_i - < aria2c-linux-amd64.dockerfile +# extract +# $ docker run --name build_c build_i +# $ docker cp build_c:/build/aria2c . +# $ docker rm build_c +# $ docker rmi build_i +# clean +# $ docker builder prune --force FROM debian:12 @@ -11,13 +14,53 @@ LABEL MAINTAINER "Elypha" ENV DEBIAN_FRONTEND noninteractive -RUN apt-get update && \ - apt-get install -y --no-install-recommends \ + + +# basic dependencies +# -------------------------------- + +RUN apt-get update +RUN apt-get install -y --no-install-recommends \ build-essential \ git \ curl \ wget \ ca-certificates \ + p7zip-full + +ENV URL_libssh2 "https://www.libssh2.org/download/libssh2-1.11.0.tar.gz" +ENV URL_c_ares "https://c-ares.org/download/c-ares-1.19.1.tar.gz" +ENV URL_zlib "https://www.zlib.net/zlib-1.3.tar.gz" +ENV URL_sqlite3 "https://www.sqlite.org/2023/sqlite-autoconf-3430100.tar.gz" +ENV URL_openssl "https://www.openssl.org/source/openssl-1.1.1w.tar.gz" +ENV URL_expat "https://github.com/libexpat/libexpat/releases/download/R_2_5_0/expat-2.5.0.tar.bz2" + +ENV DIR_libssh2 "/build/libssh2" +ENV DIR_c_ares "/build/c_ares" +ENV DIR_zlib "/build/zlib" +ENV DIR_sqlite3 "/build/sqlite3" +ENV DIR_openssl "/build/openssl" +ENV DIR_expat "/build/expat" + +RUN mkdir -p $DIR_libssh2 && wget -O - "$URL_libssh2" | tar -xz -C $DIR_libssh2 --strip-components=1 +RUN mkdir -p $DIR_c_ares && wget -O - "$URL_c_ares" | tar -xz -C $DIR_c_ares --strip-components=1 +RUN mkdir -p $DIR_zlib && wget -O - "$URL_zlib" | tar -xz -C $DIR_zlib --strip-components=1 +RUN mkdir -p $DIR_sqlite3 && wget -O - "$URL_sqlite3" | tar -xz -C $DIR_sqlite3 --strip-components=1 +RUN mkdir -p $DIR_openssl && wget -O - "$URL_openssl" | tar -xz -C $DIR_openssl --strip-components=1 +RUN mkdir -p $DIR_expat && wget -O - "$URL_expat" | tar -xj -C $DIR_expat --strip-components=1 + +ENV DIR_aria2 "/build/aria2" +ENV DIR_aria2_mod "/build/aria2-mod" +RUN mkdir -p $DIR_aria2 && git clone --depth 1 https://github.com/aria2/aria2.git $DIR_aria2 +RUN mkdir -p $DIR_aria2_mod && git clone --depth 1 https://github.com/Elypha/aria2-mod.git $DIR_aria2_mod + + + +# aria2 dependencies +# -------------------------------- + +RUN apt-get install -y --no-install-recommends \ + # deps: autoconf libxml2-dev \ libcppunit-dev \ autoconf \ @@ -25,101 +68,88 @@ RUN apt-get update && \ autotools-dev \ autopoint \ libtool \ - pkg-config - -ENV URL_zlib "https://www.zlib.net/zlib-1.2.13.tar.gz" -ENV URL_expat "https://github.com/libexpat/libexpat/releases/download/R_2_5_0/expat-2.5.0.tar.bz2" -ENV URL_c_ares "https://c-ares.org/download/c-ares-1.19.1.tar.gz" -ENV URL_openssl "https://www.openssl.org/source/openssl-1.1.1u.tar.gz" -ENV URL_sqlite3 "https://www.sqlite.org/2023/sqlite-autoconf-3420000.tar.gz" -ENV URL_libssh2 "https://www.libssh2.org/download/libssh2-1.11.0.tar.gz" - -ENV DIR_zlib "/build/zlib" -ENV DIR_expat "/build/expat" -ENV DIR_c_ares "/build/c_ares" -ENV DIR_openssl "/build/openssl" -ENV DIR_sqlite3 "/build/sqlite3" -ENV DIR_libssh2 "/build/libssh2" -ENV DIR_aria2 "/build/aria2" -ENV DIR_aria2_mod "/build/aria2-mod" + # deps: aria2 + pkg-config \ + # libxml2-dev \ + liblzma-dev -RUN mkdir -p $DIR_zlib && wget -O - "$URL_zlib" | tar -xz -C $DIR_zlib --strip-components=1 -RUN mkdir -p $DIR_expat && wget -O - "$URL_expat" | tar -xj -C $DIR_expat --strip-components=1 -RUN mkdir -p $DIR_c_ares && wget -O - "$URL_c_ares" | tar -xz -C $DIR_c_ares --strip-components=1 -RUN mkdir -p $DIR_openssl && wget -O - "$URL_openssl" | tar -xz -C $DIR_openssl --strip-components=1 -RUN mkdir -p $DIR_sqlite3 && wget -O - "$URL_sqlite3" | tar -xz -C $DIR_sqlite3 --strip-components=1 -RUN mkdir -p $DIR_libssh2 && wget -O - "$URL_libssh2" | tar -xz -C $DIR_libssh2 --strip-components=1 +ENV PREFIX "/usr/local" -RUN mkdir -p $DIR_aria2 && git clone --depth 1 https://github.com/aria2/aria2.git $DIR_aria2 -RUN mkdir -p $DIR_aria2_mod && git clone --depth 1 https://github.com/Elypha/aria2-mod.git $DIR_aria2_mod +ENV CC "gcc" +ENV CXX "g++" +ENV AR "ar" +ENV LD "ld" +ENV RANLIB "ranlib" -ENV PREFIX "/usr/local" +ENV STRIP "strip" +ENV LD_LIBRARY_PATH "$PREFIX/lib" +ENV PKG_CONFIG_PATH "$PREFIX/lib/pkgconfig" +ENV CURL_CA_BUNDLE "/etc/ssl/certs/ca-certificates.crt" -ENV CC "gcc" -ENV CXX "g++" -ENV AR "ar" -ENV LD "ld" -ENV RANLIB "ranlib" -ENV STRIP "strip" -ENV LD_LIBRARY_PATH "$PREFIX/lib" -ENV PKG_CONFIG_PATH "$PREFIX/lib/pkgconfig" -ENV CURL_CA_BUNDLE "/etc/ssl/certs/ca-certificates.crt" +# build dependencies +# -------------------------------- -RUN cd $DIR_zlib && \ +# build c_ares first since recv, recvfrom can take ages +RUN cd $DIR_c_ares && \ ./configure \ --prefix=$PREFIX \ - --static && \ + --disable-shared \ + --enable-static \ + --disable-tests && \ make -j$(nproc) && \ make install RUN cd $DIR_expat && \ ./configure \ --prefix=$PREFIX \ - --enable-static \ --disable-shared \ + --enable-static \ --without-examples \ --without-tests \ --without-docbook && \ make -j$(nproc) && \ make install -RUN cd $DIR_c_ares && \ +RUN cd $DIR_zlib && \ ./configure \ --prefix=$PREFIX \ - --enable-static \ - --disable-shared \ - --disable-tests && \ + --static && \ make -j$(nproc) && \ make install RUN cd $DIR_openssl && \ ./Configure \ - --prefix=$PREFIX \ - "linux-x86_64" \ - no-tests && \ + "linux-x86_64" "no-tests" \ + --prefix=$PREFIX && \ make -j$(nproc) && \ make install_sw -RUN cd $DIR_sqlite3 && \ +RUN cd $DIR_libssh2 && \ + autoreconf -fi && \ ./configure \ --prefix=$PREFIX \ - --enable-static \ --disable-shared \ - --disable-dynamic-extensions && \ + --enable-static \ + --disable-examples-build && \ make -j$(nproc) && \ make install -RUN cd $DIR_libssh2 && \ +RUN cd $DIR_sqlite3 && \ ./configure \ --prefix=$PREFIX \ - --enable-static \ --disable-shared \ - --disable-examples-build && \ + --enable-static \ + --disable-dynamic-extensions && \ make -j$(nproc) && \ make install + + +# build aria2 +# -------------------------------- + RUN cd $DIR_aria2 && \ git apply $DIR_aria2_mod/aria2-patch/*.patch @@ -128,22 +158,29 @@ RUN cd $DIR_aria2 && \ RUN cd $DIR_aria2 && \ ./configure \ + # configure options --prefix=$PREFIX \ - --with-libz \ - --with-libcares \ + # disable i18n + --without-included-gettext \ + --disable-nls \ + # use expat instead of libxml2 to avoid `iconv.h` related error --with-libexpat \ --without-libxml2 \ - --without-libgcrypt \ - --with-openssl \ - --without-libnettle \ + # use openssl instead of gnutls --without-gnutls \ + --without-libnettle \ --without-libgmp \ + --without-libgcrypt \ + --with-openssl \ + --with-ca-bundle=$CURL_CA_BUNDLE \ + # other dependencies + --with-libz \ + --with-libcares \ --with-libssh2 \ --with-sqlite3 \ - --without-jemalloc \ - --with-ca-bundle=$CURL_CA_BUNDLE \ - ARIA2_STATIC=yes \ - --disable-shared + # --without-jemalloc \ + --disable-shared \ + ARIA2_STATIC=yes RUN cd $DIR_aria2 && \ make -j$(nproc) && \ diff --git a/aria2c-windows-amd64.dockerfile b/aria2c-windows-i686-openssl.dockerfile similarity index 51% rename from aria2c-windows-amd64.dockerfile rename to aria2c-windows-i686-openssl.dockerfile index d077073..381b43f 100644 --- a/aria2c-windows-amd64.dockerfile +++ b/aria2c-windows-i686-openssl.dockerfile @@ -1,9 +1,12 @@ -# Dockerfile to build aria2c binary on debian -# docker build -t aria2-windows-amd64 - < aria2c-windows-amd64.dockerfile -# docker run --name my_build aria2-windows-amd64 -# docker cp my_build:/build/aria2c.exe . -# docker rm my_build -# docker rmi aria2-windows-amd64 +# build +# $ docker build -t build_i - < aria2c-windows-x86_64-openssl.dockerfile +# extract +# $ docker run --name build_c build_i +# $ docker cp build_c:/build/aria2c.exe . +# $ docker rm build_c +# $ docker rmi build_i +# clean +# $ docker builder prune --force FROM debian:12 @@ -11,73 +14,96 @@ LABEL MAINTAINER "Elypha" ENV DEBIAN_FRONTEND noninteractive -RUN apt-get update && \ - apt-get install -y --no-install-recommends \ + + +# basic dependencies +# -------------------------------- + +RUN apt-get update +RUN apt-get install -y --no-install-recommends \ build-essential \ - make \ - binutils \ + git \ + curl \ + wget \ + ca-certificates \ + p7zip-full + +ENV URL_libssh2 "https://www.libssh2.org/download/libssh2-1.11.0.tar.gz" +ENV URL_c_ares "https://c-ares.org/download/c-ares-1.19.1.tar.gz" +ENV URL_zlib "https://www.zlib.net/zlib-1.3.tar.gz" +ENV URL_sqlite3 "https://www.sqlite.org/2023/sqlite-autoconf-3430100.tar.gz" +ENV URL_openssl "https://www.openssl.org/source/openssl-1.1.1w.tar.gz" +ENV URL_expat "https://github.com/libexpat/libexpat/releases/download/R_2_5_0/expat-2.5.0.tar.bz2" +ENV URL_gmp "https://gmplib.org/download/gmp/gmp-6.3.0.tar.xz" + +ENV DIR_libssh2 "/build/libssh2" +ENV DIR_c_ares "/build/c_ares" +ENV DIR_zlib "/build/zlib" +ENV DIR_sqlite3 "/build/sqlite3" +ENV DIR_openssl "/build/openssl" +ENV DIR_expat "/build/expat" +ENV DIR_gmp "/build/gmp" + +RUN mkdir -p $DIR_libssh2 && wget -O - "$URL_libssh2" | tar -xz -C $DIR_libssh2 --strip-components=1 +RUN mkdir -p $DIR_c_ares && wget -O - "$URL_c_ares" | tar -xz -C $DIR_c_ares --strip-components=1 +RUN mkdir -p $DIR_zlib && wget -O - "$URL_zlib" | tar -xz -C $DIR_zlib --strip-components=1 +RUN mkdir -p $DIR_sqlite3 && wget -O - "$URL_sqlite3" | tar -xz -C $DIR_sqlite3 --strip-components=1 +RUN mkdir -p $DIR_openssl && wget -O - "$URL_openssl" | tar -xz -C $DIR_openssl --strip-components=1 +RUN mkdir -p $DIR_expat && wget -O - "$URL_expat" | tar -xj -C $DIR_expat --strip-components=1 +RUN mkdir -p $DIR_gmp && wget -O - "$URL_gmp" | tar -xJ -C $DIR_gmp --strip-components=1 + +ENV DIR_aria2 "/build/aria2" +ENV DIR_aria2_mod "/build/aria2-mod" +RUN mkdir -p $DIR_aria2 && git clone --depth 1 https://github.com/aria2/aria2.git $DIR_aria2 +RUN mkdir -p $DIR_aria2_mod && git clone --depth 1 https://github.com/Elypha/aria2-mod.git $DIR_aria2_mod + + + +# aria2 dependencies +# -------------------------------- + +RUN apt-get install -y --no-install-recommends \ + # deps: autoconf + libxml2-dev \ + libcppunit-dev \ autoconf \ automake \ autotools-dev \ + autopoint \ libtool \ - patch \ - ca-certificates \ + # deps: aria2 pkg-config \ - git \ - curl \ - wget \ - dpkg-dev \ + # libxml2-dev \ + liblzma-dev \ + # deps: cross compile gcc-mingw-w64 \ gcc-mingw-w64-x86-64 \ g++-mingw-w64 \ - g++-mingw-w64-x86-64 \ - autopoint \ - libcppunit-dev \ - libxml2-dev \ - libgcrypt20-dev \ - lzip - -ENV URL_zlib "https://www.zlib.net/zlib-1.2.13.tar.gz" -ENV URL_expat "https://github.com/libexpat/libexpat/releases/download/R_2_5_0/expat-2.5.0.tar.bz2" -ENV URL_c_ares "https://c-ares.org/download/c-ares-1.19.1.tar.gz" -ENV URL_openssl "https://www.openssl.org/source/openssl-1.1.1u.tar.gz" -ENV URL_sqlite3 "https://www.sqlite.org/2023/sqlite-autoconf-3420000.tar.gz" -# libssh2-1.11.0 seems uncompatible with aria2 1.36.0 -ENV URL_libssh2 "https://www.libssh2.org/download/libssh2-1.10.0.tar.gz" - -ENV DIR_zlib "/build/zlib" -ENV DIR_expat "/build/expat" -ENV DIR_c_ares "/build/c_ares" -ENV DIR_openssl "/build/openssl" -ENV DIR_sqlite3 "/build/sqlite3" -ENV DIR_libssh2 "/build/libssh2" -ENV DIR_aria2 "/build/aria2" -ENV DIR_aria2_mod "/build/aria2-mod" + g++-mingw-w64-x86-64 -RUN mkdir -p $DIR_zlib && wget -O - "$URL_zlib" | tar -xz -C $DIR_zlib --strip-components=1 -RUN mkdir -p $DIR_expat && wget -O - "$URL_expat" | tar -xj -C $DIR_expat --strip-components=1 -RUN mkdir -p $DIR_c_ares && wget -O - "$URL_c_ares" | tar -xz -C $DIR_c_ares --strip-components=1 -RUN mkdir -p $DIR_openssl && wget -O - "$URL_openssl" | tar -xz -C $DIR_openssl --strip-components=1 -RUN mkdir -p $DIR_sqlite3 && wget -O - "$URL_sqlite3" | tar -xz -C $DIR_sqlite3 --strip-components=1 -RUN mkdir -p $DIR_libssh2 && wget -O - "$URL_libssh2" | tar -xz -C $DIR_libssh2 --strip-components=1 +ENV HOST "i686-w64-mingw32" +ENV OPENSSL_HOST "mingw" +ENV PREFIX "/usr/local/$HOST" -RUN mkdir -p $DIR_aria2 && git clone --depth 1 https://github.com/aria2/aria2.git $DIR_aria2 -RUN mkdir -p $DIR_aria2_mod && git clone --depth 1 https://github.com/Elypha/aria2-mod.git $DIR_aria2_mod +ENV STRIP "$HOST-strip" +ENV LD_LIBRARY_PATH "$PREFIX/lib" +ENV PKG_CONFIG_PATH "$PREFIX/lib/pkgconfig" +ENV CURL_CA_BUNDLE "/etc/ssl/certs/ca-certificates.crt" -ENV HOST "x86_64-w64-mingw32" -ENV PREFIX "/usr/local/$HOST" -ENV STRIP "$HOST-strip" -ENV LD_LIBRARY_PATH "$PREFIX/lib" -ENV PKG_CONFIG_PATH "$PREFIX/lib/pkgconfig" -ENV CURL_CA_BUNDLE "/etc/ssl/certs/ca-certificates.crt" +# build dependencies +# -------------------------------- -RUN cd $DIR_zlib && \ +# build c_ares first since recv, recvfrom can take ages +RUN cd $DIR_c_ares && \ CC="$HOST-gcc" CXX="$HOST-g++" AR="$HOST-ar" LD="$HOST-ld" RANLIB="$HOST-ranlib" \ ./configure \ --prefix=$PREFIX \ - --static && \ + --host=$HOST \ + --disable-shared \ + --enable-static \ + --disable-tests && \ make -j$(nproc) && \ make install @@ -86,55 +112,69 @@ RUN cd $DIR_expat && \ ./configure \ --prefix=$PREFIX \ --host=$HOST \ - --enable-static \ --disable-shared \ + --enable-static \ --without-examples \ --without-tests \ --without-docbook && \ make -j$(nproc) && \ make install -RUN cd $DIR_c_ares && \ +RUN cd $DIR_zlib && \ CC="$HOST-gcc" CXX="$HOST-g++" AR="$HOST-ar" LD="$HOST-ld" RANLIB="$HOST-ranlib" \ ./configure \ --prefix=$PREFIX \ - --host=$HOST \ - --enable-static \ - --disable-shared \ - --disable-tests && \ + --static && \ make -j$(nproc) && \ make install RUN cd $DIR_openssl && \ ./Configure \ - "mingw64" "no-shared" "no-asm" "no-tests" \ - --cross-compile-prefix=$HOST- \ - --prefix=$PREFIX && \ + $OPENSSL_HOST "no-shared" "no-asm" "no-tests" \ + --prefix=$PREFIX \ + --cross-compile-prefix=$HOST- && \ make -j$(nproc) && \ make install_sw -RUN cd $DIR_sqlite3 && \ +RUN cd $DIR_libssh2 && \ CC="$HOST-gcc" CXX="$HOST-g++" AR="$HOST-ar" LD="$HOST-ld" RANLIB="$HOST-ranlib" \ ./configure \ --prefix=$PREFIX \ --host=$HOST \ - --enable-static \ --disable-shared \ - --disable-dynamic-extensions && \ + --enable-static \ + --disable-examples-build && \ make -j$(nproc) && \ make install -RUN cd $DIR_libssh2 && \ +RUN cd $DIR_sqlite3 && \ CC="$HOST-gcc" CXX="$HOST-g++" AR="$HOST-ar" LD="$HOST-ld" RANLIB="$HOST-ranlib" \ ./configure \ --prefix=$PREFIX \ --host=$HOST \ + --disable-shared \ --enable-static \ + --disable-dynamic-extensions && \ + make -j$(nproc) && \ + make install + +RUN cd $DIR_gmp && \ + ./configure \ + --prefix=$PREFIX \ + --host=$HOST \ --disable-shared \ - --disable-examples-build && \ + --enable-static \ + --disable-cxx \ + --enable-fat \ + CFLAGS="-mtune=generic -O2 -g0" && \ make -j$(nproc) && \ make install + + +# build aria2 +# -------------------------------- + RUN cd $DIR_aria2 && \ git apply $DIR_aria2_mod/aria2-patch/*.patch @@ -143,26 +183,49 @@ RUN cd $DIR_aria2 && \ RUN cd $DIR_aria2 && \ ./configure \ + # cross compile CPPFLAGS="-I$PREFIX/include" \ LDFLAGS="-L$PREFIX/lib" \ --host=$HOST \ --with-cppunit-prefix=$PREFIX \ + # configure options + --prefix=$PREFIX \ + # disable i18n --without-included-gettext \ --disable-nls \ - --prefix=$PREFIX \ - --with-libz \ - --with-libcares \ + # use expat instead of libxml2 to avoid `iconv.h` related error --with-libexpat \ --without-libxml2 \ - --without-libgcrypt \ - --with-openssl \ - --without-libnettle \ + # use openssl instead of gnutls + # for windows: + # 1) use `openssl` + # - you need to provide the ca file manually in the config, e.g., `ca-certificate=/path/to/ca-bundle.crt` + --without-wintls \ --without-gnutls \ + --without-libnettle \ --without-libgmp \ + --without-libgcrypt \ + --with-openssl \ + --with-ca-bundle=$CURL_CA_BUNDLE \ + # + # 2) use `wintls` + # - `openssl` is no longer needed and the windows certificate store will be used + # - `libgmp` is required for BitTorrent (will use `libgmp + libnettle`, but `libnettle` is not required since wintls is used) + # --with-wintls \ + # --without-gnutls \ + # --without-libnettle \ + # --with-libgmp \ + # --without-libgcrypt \ + # --without-openssl \ + # + # other dependencies + --with-libz \ + --with-libcares \ --with-libssh2 \ --with-sqlite3 \ - ARIA2_STATIC=yes \ - --disable-shared + # static build + --disable-shared \ + ARIA2_STATIC=yes RUN cd $DIR_aria2 && \ make -j$(nproc) && \ diff --git a/aria2c-windows-i686-wintls.dockerfile b/aria2c-windows-i686-wintls.dockerfile new file mode 100644 index 0000000..f5840b2 --- /dev/null +++ b/aria2c-windows-i686-wintls.dockerfile @@ -0,0 +1,233 @@ +# build +# $ docker build -t build_i - < aria2c-windows-i686-wintls.dockerfile +# extract +# $ docker run --name build_c build_i +# $ docker cp build_c:/build/aria2c.exe . +# $ docker rm build_c +# $ docker rmi build_i +# clean +# $ docker builder prune --force + +FROM debian:12 + +LABEL MAINTAINER "Elypha" + +ENV DEBIAN_FRONTEND noninteractive + + + +# basic dependencies +# -------------------------------- + +RUN apt-get update +RUN apt-get install -y --no-install-recommends \ + build-essential \ + git \ + curl \ + wget \ + ca-certificates \ + p7zip-full + +ENV URL_libssh2 "https://www.libssh2.org/download/libssh2-1.11.0.tar.gz" +ENV URL_c_ares "https://c-ares.org/download/c-ares-1.19.1.tar.gz" +ENV URL_zlib "https://www.zlib.net/zlib-1.3.tar.gz" +ENV URL_sqlite3 "https://www.sqlite.org/2023/sqlite-autoconf-3430100.tar.gz" +ENV URL_openssl "https://www.openssl.org/source/openssl-1.1.1w.tar.gz" +ENV URL_expat "https://github.com/libexpat/libexpat/releases/download/R_2_5_0/expat-2.5.0.tar.bz2" +ENV URL_gmp "https://gmplib.org/download/gmp/gmp-6.3.0.tar.xz" + +ENV DIR_libssh2 "/build/libssh2" +ENV DIR_c_ares "/build/c_ares" +ENV DIR_zlib "/build/zlib" +ENV DIR_sqlite3 "/build/sqlite3" +ENV DIR_openssl "/build/openssl" +ENV DIR_expat "/build/expat" +ENV DIR_gmp "/build/gmp" + +RUN mkdir -p $DIR_libssh2 && wget -O - "$URL_libssh2" | tar -xz -C $DIR_libssh2 --strip-components=1 +RUN mkdir -p $DIR_c_ares && wget -O - "$URL_c_ares" | tar -xz -C $DIR_c_ares --strip-components=1 +RUN mkdir -p $DIR_zlib && wget -O - "$URL_zlib" | tar -xz -C $DIR_zlib --strip-components=1 +RUN mkdir -p $DIR_sqlite3 && wget -O - "$URL_sqlite3" | tar -xz -C $DIR_sqlite3 --strip-components=1 +RUN mkdir -p $DIR_openssl && wget -O - "$URL_openssl" | tar -xz -C $DIR_openssl --strip-components=1 +RUN mkdir -p $DIR_expat && wget -O - "$URL_expat" | tar -xj -C $DIR_expat --strip-components=1 +RUN mkdir -p $DIR_gmp && wget -O - "$URL_gmp" | tar -xJ -C $DIR_gmp --strip-components=1 + +ENV DIR_aria2 "/build/aria2" +ENV DIR_aria2_mod "/build/aria2-mod" +RUN mkdir -p $DIR_aria2 && git clone --depth 1 https://github.com/aria2/aria2.git $DIR_aria2 +RUN mkdir -p $DIR_aria2_mod && git clone --depth 1 https://github.com/Elypha/aria2-mod.git $DIR_aria2_mod + + + +# aria2 dependencies +# -------------------------------- + +RUN apt-get install -y --no-install-recommends \ + # deps: autoconf + libxml2-dev \ + libcppunit-dev \ + autoconf \ + automake \ + autotools-dev \ + autopoint \ + libtool \ + # deps: aria2 + pkg-config \ + # libxml2-dev \ + liblzma-dev \ + # deps: cross compile + gcc-mingw-w64 \ + gcc-mingw-w64-x86-64 \ + g++-mingw-w64 \ + g++-mingw-w64-x86-64 + +ENV HOST "i686-w64-mingw32" +ENV OPENSSL_HOST "mingw" +ENV PREFIX "/usr/local/$HOST" + +ENV STRIP "$HOST-strip" +ENV LD_LIBRARY_PATH "$PREFIX/lib" +ENV PKG_CONFIG_PATH "$PREFIX/lib/pkgconfig" +ENV CURL_CA_BUNDLE "/etc/ssl/certs/ca-certificates.crt" + + + +# build dependencies +# -------------------------------- + +# build c_ares first since recv, recvfrom can take ages +RUN cd $DIR_c_ares && \ + CC="$HOST-gcc" CXX="$HOST-g++" AR="$HOST-ar" LD="$HOST-ld" RANLIB="$HOST-ranlib" \ + ./configure \ + --prefix=$PREFIX \ + --host=$HOST \ + --disable-shared \ + --enable-static \ + --disable-tests && \ + make -j$(nproc) && \ + make install + +RUN cd $DIR_expat && \ + CC="$HOST-gcc" CXX="$HOST-g++" AR="$HOST-ar" LD="$HOST-ld" RANLIB="$HOST-ranlib" \ + ./configure \ + --prefix=$PREFIX \ + --host=$HOST \ + --disable-shared \ + --enable-static \ + --without-examples \ + --without-tests \ + --without-docbook && \ + make -j$(nproc) && \ + make install + +RUN cd $DIR_zlib && \ + CC="$HOST-gcc" CXX="$HOST-g++" AR="$HOST-ar" LD="$HOST-ld" RANLIB="$HOST-ranlib" \ + ./configure \ + --prefix=$PREFIX \ + --static && \ + make -j$(nproc) && \ + make install + +RUN cd $DIR_openssl && \ + ./Configure \ + $OPENSSL_HOST "no-shared" "no-asm" "no-tests" \ + --prefix=$PREFIX \ + --cross-compile-prefix=$HOST- && \ + make -j$(nproc) && \ + make install_sw + +RUN cd $DIR_libssh2 && \ + CC="$HOST-gcc" CXX="$HOST-g++" AR="$HOST-ar" LD="$HOST-ld" RANLIB="$HOST-ranlib" \ + ./configure \ + --prefix=$PREFIX \ + --host=$HOST \ + --disable-shared \ + --enable-static \ + --disable-examples-build && \ + make -j$(nproc) && \ + make install + +RUN cd $DIR_sqlite3 && \ + CC="$HOST-gcc" CXX="$HOST-g++" AR="$HOST-ar" LD="$HOST-ld" RANLIB="$HOST-ranlib" \ + ./configure \ + --prefix=$PREFIX \ + --host=$HOST \ + --disable-shared \ + --enable-static \ + --disable-dynamic-extensions && \ + make -j$(nproc) && \ + make install + +RUN cd $DIR_gmp && \ + ./configure \ + --prefix=$PREFIX \ + --host=$HOST \ + --disable-shared \ + --enable-static \ + --disable-cxx \ + --enable-fat \ + CFLAGS="-mtune=generic -O2 -g0" && \ + make -j$(nproc) && \ + make install + + + +# build aria2 +# -------------------------------- + +RUN cd $DIR_aria2 && \ + git apply $DIR_aria2_mod/aria2-patch/*.patch + +RUN cd $DIR_aria2 && \ + autoreconf -i + +RUN cd $DIR_aria2 && \ + ./configure \ + # cross compile + CPPFLAGS="-I$PREFIX/include" \ + LDFLAGS="-L$PREFIX/lib" \ + --host=$HOST \ + --with-cppunit-prefix=$PREFIX \ + # configure options + --prefix=$PREFIX \ + # disable i18n + --without-included-gettext \ + --disable-nls \ + # use expat instead of libxml2 to avoid `iconv.h` related error + --with-libexpat \ + --without-libxml2 \ + # use openssl instead of gnutls + # for windows: + # 1) use `openssl` + # - you need to provide the ca file manually in the config, e.g., `ca-certificate=/path/to/ca-bundle.crt` + # --without-wintls \ + # --without-gnutls \ + # --without-libnettle \ + # --without-libgmp \ + # --without-libgcrypt \ + # --with-openssl \ + # --with-ca-bundle=$CURL_CA_BUNDLE \ + # + # 2) use `wintls` + # - `openssl` is no longer needed and the windows certificate store will be used + # - `libgmp` is required for BitTorrent (will use `libgmp + libnettle`, but `libnettle` is not required since wintls is used) + --with-wintls \ + --without-gnutls \ + --without-libnettle \ + --with-libgmp \ + --without-libgcrypt \ + --without-openssl \ + # + # other dependencies + --with-libz \ + --with-libcares \ + --with-libssh2 \ + --with-sqlite3 \ + # static build + --disable-shared \ + ARIA2_STATIC=yes + +RUN cd $DIR_aria2 && \ + make -j$(nproc) && \ + $STRIP "src/aria2c.exe" && \ + mv "src/aria2c.exe" "/build/aria2c.exe" diff --git a/aria2c-windows-x86_64-openssl.dockerfile b/aria2c-windows-x86_64-openssl.dockerfile new file mode 100644 index 0000000..d88e8a2 --- /dev/null +++ b/aria2c-windows-x86_64-openssl.dockerfile @@ -0,0 +1,233 @@ +# build +# $ docker build -t build_i - < aria2c-windows-i686-openssl.dockerfile +# extract +# $ docker run --name build_c build_i +# $ docker cp build_c:/build/aria2c.exe . +# $ docker rm build_c +# $ docker rmi build_i +# clean +# $ docker builder prune --force + +FROM debian:12 + +LABEL MAINTAINER "Elypha" + +ENV DEBIAN_FRONTEND noninteractive + + + +# basic dependencies +# -------------------------------- + +RUN apt-get update +RUN apt-get install -y --no-install-recommends \ + build-essential \ + git \ + curl \ + wget \ + ca-certificates \ + p7zip-full + +ENV URL_libssh2 "https://www.libssh2.org/download/libssh2-1.11.0.tar.gz" +ENV URL_c_ares "https://c-ares.org/download/c-ares-1.19.1.tar.gz" +ENV URL_zlib "https://www.zlib.net/zlib-1.3.tar.gz" +ENV URL_sqlite3 "https://www.sqlite.org/2023/sqlite-autoconf-3430100.tar.gz" +ENV URL_openssl "https://www.openssl.org/source/openssl-1.1.1w.tar.gz" +ENV URL_expat "https://github.com/libexpat/libexpat/releases/download/R_2_5_0/expat-2.5.0.tar.bz2" +ENV URL_gmp "https://gmplib.org/download/gmp/gmp-6.3.0.tar.xz" + +ENV DIR_libssh2 "/build/libssh2" +ENV DIR_c_ares "/build/c_ares" +ENV DIR_zlib "/build/zlib" +ENV DIR_sqlite3 "/build/sqlite3" +ENV DIR_openssl "/build/openssl" +ENV DIR_expat "/build/expat" +ENV DIR_gmp "/build/gmp" + +RUN mkdir -p $DIR_libssh2 && wget -O - "$URL_libssh2" | tar -xz -C $DIR_libssh2 --strip-components=1 +RUN mkdir -p $DIR_c_ares && wget -O - "$URL_c_ares" | tar -xz -C $DIR_c_ares --strip-components=1 +RUN mkdir -p $DIR_zlib && wget -O - "$URL_zlib" | tar -xz -C $DIR_zlib --strip-components=1 +RUN mkdir -p $DIR_sqlite3 && wget -O - "$URL_sqlite3" | tar -xz -C $DIR_sqlite3 --strip-components=1 +RUN mkdir -p $DIR_openssl && wget -O - "$URL_openssl" | tar -xz -C $DIR_openssl --strip-components=1 +RUN mkdir -p $DIR_expat && wget -O - "$URL_expat" | tar -xj -C $DIR_expat --strip-components=1 +RUN mkdir -p $DIR_gmp && wget -O - "$URL_gmp" | tar -xJ -C $DIR_gmp --strip-components=1 + +ENV DIR_aria2 "/build/aria2" +ENV DIR_aria2_mod "/build/aria2-mod" +RUN mkdir -p $DIR_aria2 && git clone --depth 1 https://github.com/aria2/aria2.git $DIR_aria2 +RUN mkdir -p $DIR_aria2_mod && git clone --depth 1 https://github.com/Elypha/aria2-mod.git $DIR_aria2_mod + + + +# aria2 dependencies +# -------------------------------- + +RUN apt-get install -y --no-install-recommends \ + # deps: autoconf + libxml2-dev \ + libcppunit-dev \ + autoconf \ + automake \ + autotools-dev \ + autopoint \ + libtool \ + # deps: aria2 + pkg-config \ + # libxml2-dev \ + liblzma-dev \ + # deps: cross compile + gcc-mingw-w64 \ + gcc-mingw-w64-x86-64 \ + g++-mingw-w64 \ + g++-mingw-w64-x86-64 + +ENV HOST "x86_64-w64-mingw32" +ENV OPENSSL_HOST "mingw64" +ENV PREFIX "/usr/local/$HOST" + +ENV STRIP "$HOST-strip" +ENV LD_LIBRARY_PATH "$PREFIX/lib" +ENV PKG_CONFIG_PATH "$PREFIX/lib/pkgconfig" +ENV CURL_CA_BUNDLE "/etc/ssl/certs/ca-certificates.crt" + + + +# build dependencies +# -------------------------------- + +# build c_ares first since recv, recvfrom can take ages +RUN cd $DIR_c_ares && \ + CC="$HOST-gcc" CXX="$HOST-g++" AR="$HOST-ar" LD="$HOST-ld" RANLIB="$HOST-ranlib" \ + ./configure \ + --prefix=$PREFIX \ + --host=$HOST \ + --disable-shared \ + --enable-static \ + --disable-tests && \ + make -j$(nproc) && \ + make install + +RUN cd $DIR_expat && \ + CC="$HOST-gcc" CXX="$HOST-g++" AR="$HOST-ar" LD="$HOST-ld" RANLIB="$HOST-ranlib" \ + ./configure \ + --prefix=$PREFIX \ + --host=$HOST \ + --disable-shared \ + --enable-static \ + --without-examples \ + --without-tests \ + --without-docbook && \ + make -j$(nproc) && \ + make install + +RUN cd $DIR_zlib && \ + CC="$HOST-gcc" CXX="$HOST-g++" AR="$HOST-ar" LD="$HOST-ld" RANLIB="$HOST-ranlib" \ + ./configure \ + --prefix=$PREFIX \ + --static && \ + make -j$(nproc) && \ + make install + +RUN cd $DIR_openssl && \ + ./Configure \ + $OPENSSL_HOST "no-shared" "no-asm" "no-tests" \ + --prefix=$PREFIX \ + --cross-compile-prefix=$HOST- && \ + make -j$(nproc) && \ + make install_sw + +RUN cd $DIR_libssh2 && \ + CC="$HOST-gcc" CXX="$HOST-g++" AR="$HOST-ar" LD="$HOST-ld" RANLIB="$HOST-ranlib" \ + ./configure \ + --prefix=$PREFIX \ + --host=$HOST \ + --disable-shared \ + --enable-static \ + --disable-examples-build && \ + make -j$(nproc) && \ + make install + +RUN cd $DIR_sqlite3 && \ + CC="$HOST-gcc" CXX="$HOST-g++" AR="$HOST-ar" LD="$HOST-ld" RANLIB="$HOST-ranlib" \ + ./configure \ + --prefix=$PREFIX \ + --host=$HOST \ + --disable-shared \ + --enable-static \ + --disable-dynamic-extensions && \ + make -j$(nproc) && \ + make install + +RUN cd $DIR_gmp && \ + ./configure \ + --prefix=$PREFIX \ + --host=$HOST \ + --disable-shared \ + --enable-static \ + --disable-cxx \ + --enable-fat \ + CFLAGS="-mtune=generic -O2 -g0" && \ + make -j$(nproc) && \ + make install + + + +# build aria2 +# -------------------------------- + +RUN cd $DIR_aria2 && \ + git apply $DIR_aria2_mod/aria2-patch/*.patch + +RUN cd $DIR_aria2 && \ + autoreconf -i + +RUN cd $DIR_aria2 && \ + ./configure \ + # cross compile + CPPFLAGS="-I$PREFIX/include" \ + LDFLAGS="-L$PREFIX/lib" \ + --host=$HOST \ + --with-cppunit-prefix=$PREFIX \ + # configure options + --prefix=$PREFIX \ + # disable i18n + --without-included-gettext \ + --disable-nls \ + # use expat instead of libxml2 to avoid `iconv.h` related error + --with-libexpat \ + --without-libxml2 \ + # use openssl instead of gnutls + # for windows: + # 1) use `openssl` + # - you need to provide the ca file manually in the config, e.g., `ca-certificate=/path/to/ca-bundle.crt` + --without-wintls \ + --without-gnutls \ + --without-libnettle \ + --without-libgmp \ + --without-libgcrypt \ + --with-openssl \ + --with-ca-bundle=$CURL_CA_BUNDLE \ + # + # 2) use `wintls` + # - `openssl` is no longer needed and the windows certificate store will be used + # - `libgmp` is required for BitTorrent (will use `libgmp + libnettle`, but `libnettle` is not required since wintls is used) + # --with-wintls \ + # --without-gnutls \ + # --without-libnettle \ + # --with-libgmp \ + # --without-libgcrypt \ + # --without-openssl \ + # + # other dependencies + --with-libz \ + --with-libcares \ + --with-libssh2 \ + --with-sqlite3 \ + # static build + --disable-shared \ + ARIA2_STATIC=yes + +RUN cd $DIR_aria2 && \ + make -j$(nproc) && \ + $STRIP "src/aria2c.exe" && \ + mv "src/aria2c.exe" "/build/aria2c.exe" diff --git a/aria2c-windows-x86_64-wintls.dockerfile b/aria2c-windows-x86_64-wintls.dockerfile new file mode 100644 index 0000000..330be59 --- /dev/null +++ b/aria2c-windows-x86_64-wintls.dockerfile @@ -0,0 +1,233 @@ +# build +# $ docker build -t build_i - < aria2c-windows-x86_64-wintls.dockerfile +# extract +# $ docker run --name build_c build_i +# $ docker cp build_c:/build/aria2c.exe . +# $ docker rm build_c +# $ docker rmi build_i +# clean +# $ docker builder prune --force + +FROM debian:12 + +LABEL MAINTAINER "Elypha" + +ENV DEBIAN_FRONTEND noninteractive + + + +# basic dependencies +# -------------------------------- + +RUN apt-get update +RUN apt-get install -y --no-install-recommends \ + build-essential \ + git \ + curl \ + wget \ + ca-certificates \ + p7zip-full + +ENV URL_libssh2 "https://www.libssh2.org/download/libssh2-1.11.0.tar.gz" +ENV URL_c_ares "https://c-ares.org/download/c-ares-1.19.1.tar.gz" +ENV URL_zlib "https://www.zlib.net/zlib-1.3.tar.gz" +ENV URL_sqlite3 "https://www.sqlite.org/2023/sqlite-autoconf-3430100.tar.gz" +ENV URL_openssl "https://www.openssl.org/source/openssl-1.1.1w.tar.gz" +ENV URL_expat "https://github.com/libexpat/libexpat/releases/download/R_2_5_0/expat-2.5.0.tar.bz2" +ENV URL_gmp "https://gmplib.org/download/gmp/gmp-6.3.0.tar.xz" + +ENV DIR_libssh2 "/build/libssh2" +ENV DIR_c_ares "/build/c_ares" +ENV DIR_zlib "/build/zlib" +ENV DIR_sqlite3 "/build/sqlite3" +ENV DIR_openssl "/build/openssl" +ENV DIR_expat "/build/expat" +ENV DIR_gmp "/build/gmp" + +RUN mkdir -p $DIR_libssh2 && wget -O - "$URL_libssh2" | tar -xz -C $DIR_libssh2 --strip-components=1 +RUN mkdir -p $DIR_c_ares && wget -O - "$URL_c_ares" | tar -xz -C $DIR_c_ares --strip-components=1 +RUN mkdir -p $DIR_zlib && wget -O - "$URL_zlib" | tar -xz -C $DIR_zlib --strip-components=1 +RUN mkdir -p $DIR_sqlite3 && wget -O - "$URL_sqlite3" | tar -xz -C $DIR_sqlite3 --strip-components=1 +RUN mkdir -p $DIR_openssl && wget -O - "$URL_openssl" | tar -xz -C $DIR_openssl --strip-components=1 +RUN mkdir -p $DIR_expat && wget -O - "$URL_expat" | tar -xj -C $DIR_expat --strip-components=1 +RUN mkdir -p $DIR_gmp && wget -O - "$URL_gmp" | tar -xJ -C $DIR_gmp --strip-components=1 + +ENV DIR_aria2 "/build/aria2" +ENV DIR_aria2_mod "/build/aria2-mod" +RUN mkdir -p $DIR_aria2 && git clone --depth 1 https://github.com/aria2/aria2.git $DIR_aria2 +RUN mkdir -p $DIR_aria2_mod && git clone --depth 1 https://github.com/Elypha/aria2-mod.git $DIR_aria2_mod + + + +# aria2 dependencies +# -------------------------------- + +RUN apt-get install -y --no-install-recommends \ + # deps: autoconf + libxml2-dev \ + libcppunit-dev \ + autoconf \ + automake \ + autotools-dev \ + autopoint \ + libtool \ + # deps: aria2 + pkg-config \ + # libxml2-dev \ + liblzma-dev \ + # deps: cross compile + gcc-mingw-w64 \ + gcc-mingw-w64-x86-64 \ + g++-mingw-w64 \ + g++-mingw-w64-x86-64 + +ENV HOST "x86_64-w64-mingw32" +ENV OPENSSL_HOST "mingw64" +ENV PREFIX "/usr/local/$HOST" + +ENV STRIP "$HOST-strip" +ENV LD_LIBRARY_PATH "$PREFIX/lib" +ENV PKG_CONFIG_PATH "$PREFIX/lib/pkgconfig" +ENV CURL_CA_BUNDLE "/etc/ssl/certs/ca-certificates.crt" + + + +# build dependencies +# -------------------------------- + +# build c_ares first since recv, recvfrom can take ages +RUN cd $DIR_c_ares && \ + CC="$HOST-gcc" CXX="$HOST-g++" AR="$HOST-ar" LD="$HOST-ld" RANLIB="$HOST-ranlib" \ + ./configure \ + --prefix=$PREFIX \ + --host=$HOST \ + --disable-shared \ + --enable-static \ + --disable-tests && \ + make -j$(nproc) && \ + make install + +RUN cd $DIR_expat && \ + CC="$HOST-gcc" CXX="$HOST-g++" AR="$HOST-ar" LD="$HOST-ld" RANLIB="$HOST-ranlib" \ + ./configure \ + --prefix=$PREFIX \ + --host=$HOST \ + --disable-shared \ + --enable-static \ + --without-examples \ + --without-tests \ + --without-docbook && \ + make -j$(nproc) && \ + make install + +RUN cd $DIR_zlib && \ + CC="$HOST-gcc" CXX="$HOST-g++" AR="$HOST-ar" LD="$HOST-ld" RANLIB="$HOST-ranlib" \ + ./configure \ + --prefix=$PREFIX \ + --static && \ + make -j$(nproc) && \ + make install + +RUN cd $DIR_openssl && \ + ./Configure \ + $OPENSSL_HOST "no-shared" "no-asm" "no-tests" \ + --prefix=$PREFIX \ + --cross-compile-prefix=$HOST- && \ + make -j$(nproc) && \ + make install_sw + +RUN cd $DIR_libssh2 && \ + CC="$HOST-gcc" CXX="$HOST-g++" AR="$HOST-ar" LD="$HOST-ld" RANLIB="$HOST-ranlib" \ + ./configure \ + --prefix=$PREFIX \ + --host=$HOST \ + --disable-shared \ + --enable-static \ + --disable-examples-build && \ + make -j$(nproc) && \ + make install + +RUN cd $DIR_sqlite3 && \ + CC="$HOST-gcc" CXX="$HOST-g++" AR="$HOST-ar" LD="$HOST-ld" RANLIB="$HOST-ranlib" \ + ./configure \ + --prefix=$PREFIX \ + --host=$HOST \ + --disable-shared \ + --enable-static \ + --disable-dynamic-extensions && \ + make -j$(nproc) && \ + make install + +RUN cd $DIR_gmp && \ + ./configure \ + --prefix=$PREFIX \ + --host=$HOST \ + --disable-shared \ + --enable-static \ + --disable-cxx \ + --enable-fat \ + CFLAGS="-mtune=generic -O2 -g0" && \ + make -j$(nproc) && \ + make install + + + +# build aria2 +# -------------------------------- + +RUN cd $DIR_aria2 && \ + git apply $DIR_aria2_mod/aria2-patch/*.patch + +RUN cd $DIR_aria2 && \ + autoreconf -i + +RUN cd $DIR_aria2 && \ + ./configure \ + # cross compile + CPPFLAGS="-I$PREFIX/include" \ + LDFLAGS="-L$PREFIX/lib" \ + --host=$HOST \ + --with-cppunit-prefix=$PREFIX \ + # configure options + --prefix=$PREFIX \ + # disable i18n + --without-included-gettext \ + --disable-nls \ + # use expat instead of libxml2 to avoid `iconv.h` related error + --with-libexpat \ + --without-libxml2 \ + # use openssl instead of gnutls + # for windows: + # 1) use `openssl` + # - you need to provide the ca file manually in the config, e.g., `ca-certificate=/path/to/ca-bundle.crt` + # --without-wintls \ + # --without-gnutls \ + # --without-libnettle \ + # --without-libgmp \ + # --without-libgcrypt \ + # --with-openssl \ + # --with-ca-bundle=$CURL_CA_BUNDLE \ + # + # 2) use `wintls` + # - `openssl` is no longer needed and the windows certificate store will be used + # - `libgmp` is required for BitTorrent (will use `libgmp + libnettle`, but `libnettle` is not required since wintls is used) + --with-wintls \ + --without-gnutls \ + --without-libnettle \ + --with-libgmp \ + --without-libgcrypt \ + --without-openssl \ + # + # other dependencies + --with-libz \ + --with-libcares \ + --with-libssh2 \ + --with-sqlite3 \ + # static build + --disable-shared \ + ARIA2_STATIC=yes + +RUN cd $DIR_aria2 && \ + make -j$(nproc) && \ + $STRIP "src/aria2c.exe" && \ + mv "src/aria2c.exe" "/build/aria2c.exe" diff --git a/ariang-windows-amd64.dockerfile b/ariang-windows-amd64.dockerfile deleted file mode 100644 index c37cacd..0000000 --- a/ariang-windows-amd64.dockerfile +++ /dev/null @@ -1,44 +0,0 @@ -# Dockerfile to build aria2c binary on debian -# docker build -t ariang - < ariang.dockerfile -# docker run --name my_build ariang -# docker cp my_build:/build/aria2c.exe . -# docker rm my_build -# docker rmi aria2-windows-amd64 - -FROM debian:12 - -LABEL MAINTAINER "Elypha" - -ENV DEBIAN_FRONTEND "noninteractive" - -RUN apt-get update && \ - apt-get install -y --no-install-recommends \ - git \ - curl \ - wget \ - ca-certificates - -ENV URL_nodejs="https://nodejs.org/dist/v20.3.0/node-v20.3.0-linux-x64.tar.gz" - -ENV DIR_nodejs "/usr/local" -ENV DIR_ariang "/build/ariang" -ENV DIR_aria2_mod "/build/aria2-mod" - -RUN mkdir -p $DIR_nodejs && wget -O - "$URL_nodejs" | tar -xz -C $DIR_nodejs --strip-components=1 - -RUN mkdir -p $DIR_ariang && git clone --depth 1 https://github.com/mayswind/AriaNg-Native.git $DIR_ariang -RUN mkdir -p $DIR_aria2_mod && git clone --depth 1 https://github.com/Elypha/aria2-mod.git $DIR_aria2_mod - - -RUN cd $DIR_ariang && \ - git apply $DIR_aria2_mod/ariang-native-patch/*.patch - -RUN cd $DIR_ariang && \ - npm install - -RUN cd $DIR_ariang && \ - npm run publish:win - -# broken. RIP OSX -# RUN cd $DIR_ariang && \ -# npm run publish:osx