From df4f6b325a0092cfae7436b0163ba6289208776a Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Sun, 26 Dec 2021 23:37:03 -0500 Subject: [PATCH 1/8] Improve mingw+docker for libaria2 compilation This PR introduces a few improvements to the docker-based Windows builds * compile any published branch/tag, not just the latest master branch. Use `docker build --build-arg GIT_TAG= ...` * compile local code instead of downloading the github version. Use `docker build --build-arg SOURCE=local ...` * Control libaria2 build Use `docker build --build-arg LIBARIA2=enable ...` * Control static build. Use `docker build --build-arg ARIA2_STATIC=no ...` * Automatically copy the resulting binaries to the shared volume if set. This is significantly simpler than copying from a running container. Use `docker run -v $PWD:/output ...` --- .dockerignore | 51 +++++++++++++++++++++++++++++++++++ Dockerfile.mingw | 69 ++++++++++++++++++++++++++++++++++++++++-------- mingw-config | 11 +++++++- 3 files changed, 119 insertions(+), 12 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..bad601da --- /dev/null +++ b/.dockerignore @@ -0,0 +1,51 @@ +Dockerfile* +.gitignore +.dockerignore + +#### The rest of the file is a verbatim copy of the .gitignore +*~ +*.o +*.lo +*.la +*.ce +*.cce +*.he +depcomp +*.m4 +Makefile +Makefile.in +missing +autom4te.cache/ +config.guess +config.h +config.h.in +config.log +config.status +config.sub +configure +install-sh +.deps/ +stamp-h1 +INSTALL +*.gmo +ABOUT-NLS +README.html +config.rpath +aria2c.1 +aria2c.1.html +intl/ +libtool +ltmain.sh +po/aria2.pot +po/remove-potcdate.sed +src/libaria2.pc +test-driver +libaria2api +libaria2ex +libaria2wx +.dirstamp +.libs +compile +main.log +main.trs +test-suite.log diff --git a/Dockerfile.mingw b/Dockerfile.mingw index 2c737e3b..adf05ec6 100644 --- a/Dockerfile.mingw +++ b/Dockerfile.mingw @@ -1,17 +1,33 @@ # Dockerfile to build aria2 Windows binary using ubuntu mingw-w64 # cross compiler chain. # -# $ sudo docker build -t aria2-mingw - < Dockerfile.mingw +# $ sudo docker build -t aria2-mingw -f Dockerfile.mingw . # # After successful build, windows binary is located at -# /aria2/src/aria2c.exe. You can copy the binary using following -# commands: +# /aria2/src/aria2c.exe. You can copy the binary to the current dir +# using following command (replace $PWD with any other full path if desired): # -# $ id=$(sudo docker create aria2-mingw) -# $ sudo docker cp $id:/aria2/src/aria2c.exe -# $ sudo docker rm -v $id +# $ sudo docker run --rm -v $PWD:/output aria2-mingw -FROM ubuntu:20.04 +# Additional arguments can be set with --build-arg. For example, to build local source code instead of +# the latest master on github, set SOURCE=local: +# +# $ sudo docker build -t aria2-mingw -f Dockerfile.mingw --build-arg SOURCE=local . +# +# Available build parameters: +# SOURCE - "git" (default) to use Aria2 code from github. "local" to copy current directory. +# GIT_TAG - if SOURCE=git (default), set which branch or tag to download. +# LIBARIA2 - disable (default) / enable -- should the libaria2 library be built +# ARIA2_STATIC - yes (default) / no -- compile as a dynamic or static code +# +# Note that LIBARIA2 and ARIA2_STATIC params might not work for older versions. +# +ARG SOURCE=git +ARG GIT_TAG=master +ARG LIBARIA2=disable +ARG ARIA2_STATIC=yes + +FROM ubuntu:20.04 as build_base MAINTAINER Tatsuhiro Tsujikawa @@ -109,7 +125,38 @@ RUN tar xf libssh2-1.9.0.tar.gz && \ --with-wincng \ LIBS="-lws2_32" && \ make install -ADD https://api.github.com/repos/aria2/aria2/git/refs/heads/master version.json -RUN git clone https://github.com/aria2/aria2 && \ - cd aria2 && autoreconf -i && ./mingw-config && make && \ - $HOST-strip src/aria2c.exe + + +# +# The above "build_base" stage builds common steps, +# before copying/downloading aria2 source code. The following +# two steps will either copy sources from the local dir, +# or will download a specific tag/branch from github. +# The last stage will use the needed stage, running the delayed steps. +# +ARG SOURCE GIT_TAG LIBARIA2 ARIA2_STATIC +FROM build_base as build_local +ONBUILD COPY . /aria2 + + +ARG SOURCE GIT_TAG LIBARIA2 ARIA2_STATIC +FROM build_base as build_git +ONBUILD ADD https://api.github.com/repos/aria2/aria2/git/refs/heads/${GIT_TAG} version.json +ONBUILD RUN echo "Downloading '${GIT_TAG}' from https://github.com/aria2/aria2" && \ + git clone https://github.com/aria2/aria2 --depth 1 --branch "${GIT_TAG}" + + +ARG SOURCE GIT_TAG LIBARIA2 ARIA2_STATIC +FROM build_${SOURCE} +RUN cd /aria2 && \ + autoreconf -i \ + export LIBARIA2=${LIBARIA2} && \ + export ARIA2_STATIC=${ARIA2_STATIC} && \ + ./mingw-config && \ + make \ + (test -f /aria2/src/aria2c.exe && $HOST-strip /aria2/src/aria2c.exe) && \ + (test -f /aria2/src/main.o && $HOST-strip /aria2/src/main.o) + +CMD test ! -d /output && \ + echo 'The /output dir is not set. Use "docker run -v $PWD:/output ..." to copy build results into the current dir. To explore this container, append "bash" at the end of docker run command.' || \ + cp -v /aria2/src/aria2c.exe* /aria2/src/main.o /output diff --git a/mingw-config b/mingw-config index c903c0b6..f8f4bd8e 100755 --- a/mingw-config +++ b/mingw-config @@ -35,6 +35,12 @@ # build on Debian Linux using mingw-w64. Some environment variables # can be adjusted to change build settings: # +# LIBARIA2: must be "enable" or "disable" (default). If enabled, +# enabled, builds libaria2 lib, either static or dynamic depending +# on the ARIA2_STATIC setting. +# +# ARIA2_STATIC: must be "yes" (default) or "no". +# # HOST: cross-compile to build programs to run on HOST. It defaults to # i686-w64-mingw32. To build 64 bit binary, specify # x86_64-w64-mingw32. @@ -55,6 +61,8 @@ # * libssh2 # * cppunit +test -z "$LIBARIA2" && LIBARIA2=disable +test -z "$ARIA2_STATIC" && ARIA2_STATIC=yes test -z "$HOST" && HOST=i686-w64-mingw32 test -z "$PREFIX" && PREFIX=/usr/local/$HOST @@ -75,7 +83,8 @@ test -z "$PREFIX" && PREFIX=/usr/local/$HOST --without-libgcrypt \ --without-libnettle \ --with-cppunit-prefix=$PREFIX \ - ARIA2_STATIC=yes \ + --${LIBARIA2}-libaria2 \ + ARIA2_STATIC=${ARIA2_STATIC} \ CPPFLAGS="-I$PREFIX/include" \ LDFLAGS="-L$PREFIX/lib" \ PKG_CONFIG="/usr/bin/pkg-config" \ From 930f04bcffb75d99f49318a337cee329807ee811 Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Sun, 26 Dec 2021 23:50:52 -0500 Subject: [PATCH 2/8] fixed last second command merge --- Dockerfile.mingw | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile.mingw b/Dockerfile.mingw index adf05ec6..e6c7fd31 100644 --- a/Dockerfile.mingw +++ b/Dockerfile.mingw @@ -149,11 +149,11 @@ ONBUILD RUN echo "Downloading '${GIT_TAG}' from https://github.com/aria2/aria2" ARG SOURCE GIT_TAG LIBARIA2 ARIA2_STATIC FROM build_${SOURCE} RUN cd /aria2 && \ - autoreconf -i \ + autoreconf -i && \ export LIBARIA2=${LIBARIA2} && \ export ARIA2_STATIC=${ARIA2_STATIC} && \ ./mingw-config && \ - make \ + make && \ (test -f /aria2/src/aria2c.exe && $HOST-strip /aria2/src/aria2c.exe) && \ (test -f /aria2/src/main.o && $HOST-strip /aria2/src/main.o) From e8751e326b1dde6a95ca457ee898b9e0c8852ea0 Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Tue, 28 Dec 2021 14:48:10 -0500 Subject: [PATCH 3/8] Handle HOST var too, allowing 32/64bit --- Dockerfile.mingw | 72 +++++++++++++++++++++++++++++++----------------- 1 file changed, 46 insertions(+), 26 deletions(-) diff --git a/Dockerfile.mingw b/Dockerfile.mingw index e6c7fd31..6d5dc908 100644 --- a/Dockerfile.mingw +++ b/Dockerfile.mingw @@ -19,20 +19,31 @@ # GIT_TAG - if SOURCE=git (default), set which branch or tag to download. # LIBARIA2 - disable (default) / enable -- should the libaria2 library be built # ARIA2_STATIC - yes (default) / no -- compile as a dynamic or static code +# HOST - By default uses i686-w64-mingw32. Set to x86_64-w64-mingw32 to build 64-bit binary # # Note that LIBARIA2 and ARIA2_STATIC params might not work for older versions. # + ARG SOURCE=git ARG GIT_TAG=master ARG LIBARIA2=disable ARG ARIA2_STATIC=yes +ARG HOST=i686-w64-mingw32 FROM ubuntu:20.04 as build_base +ARG SOURCE GIT_TAG LIBARIA2 ARIA2_STATIC HOST MAINTAINER Tatsuhiro Tsujikawa -# Change HOST to x86_64-w64-mingw32 to build 64-bit binary -ENV HOST i686-w64-mingw32 +# Preserve HOST as an ENV var just in case Docker user will want to use it again +ENV HOST=${HOST} + +RUN echo "Build configuration:" && \ + echo " - SOURCE='${SOURCE}'" && \ + echo " - GIT_TAG='${GIT_TAG}'" && \ + echo " - LIBARIA2='${LIBARIA2}'" && \ + echo " - ARIA2_STATIC='${ARIA2_STATIC}'" && \ + echo " - HOST='${HOST}'" # It would be better to use nearest ubuntu archive mirror for faster # downloads. @@ -59,8 +70,8 @@ RUN tar xf gmp-6.2.1.tar.lz && \ ./configure \ --disable-shared \ --enable-static \ - --prefix=/usr/local/$HOST \ - --host=$HOST \ + --prefix=/usr/local/${HOST} \ + --host=${HOST} \ --disable-cxx \ --enable-fat \ CFLAGS="-mtune=generic -O2 -g0" && \ @@ -71,8 +82,8 @@ RUN tar xf expat-2.4.1.tar.bz2 && \ ./configure \ --disable-shared \ --enable-static \ - --prefix=/usr/local/$HOST \ - --host=$HOST \ + --prefix=/usr/local/${HOST} \ + --host=${HOST} \ --build=`dpkg-architecture -qDEB_BUILD_GNU_TYPE` && \ make install @@ -81,22 +92,22 @@ RUN tar xf sqlite-autoconf-3360000.tar.gz && \ ./configure \ --disable-shared \ --enable-static \ - --prefix=/usr/local/$HOST \ - --host=$HOST \ + --prefix=/usr/local/${HOST} \ + --host=${HOST} \ --build=`dpkg-architecture -qDEB_BUILD_GNU_TYPE` && \ make install RUN tar xf zlib-1.2.11.tar.gz && \ cd zlib-1.2.11 && \ - CC=$HOST-gcc \ - AR=$HOST-ar \ - LD=$HOST-ld \ - RANLIB=$HOST-ranlib \ - STRIP=$HOST-strip \ + CC=${HOST}-gcc \ + AR=${HOST}-ar \ + LD=${HOST}-ld \ + RANLIB=${HOST}-ranlib \ + STRIP=${HOST}-strip \ ./configure \ - --prefix=/usr/local/$HOST \ - --libdir=/usr/local/$HOST/lib \ - --includedir=/usr/local/$HOST/include \ + --prefix=/usr/local/${HOST} \ + --libdir=/usr/local/${HOST}/lib \ + --includedir=/usr/local/${HOST}/include \ --static && \ make install @@ -106,8 +117,8 @@ RUN tar xf c-ares-1.17.2.tar.gz && \ --disable-shared \ --enable-static \ --without-random \ - --prefix=/usr/local/$HOST \ - --host=$HOST \ + --prefix=/usr/local/${HOST} \ + --host=${HOST} \ --build=`dpkg-architecture -qDEB_BUILD_GNU_TYPE` \ LIBS="-lws2_32" && \ make install @@ -118,8 +129,8 @@ RUN tar xf libssh2-1.9.0.tar.gz && \ ./configure \ --disable-shared \ --enable-static \ - --prefix=/usr/local/$HOST \ - --host=$HOST \ + --prefix=/usr/local/${HOST} \ + --host=${HOST} \ --build=`dpkg-architecture -qDEB_BUILD_GNU_TYPE` \ --without-openssl \ --with-wincng \ @@ -134,28 +145,37 @@ RUN tar xf libssh2-1.9.0.tar.gz && \ # or will download a specific tag/branch from github. # The last stage will use the needed stage, running the delayed steps. # -ARG SOURCE GIT_TAG LIBARIA2 ARIA2_STATIC FROM build_base as build_local +ARG SOURCE GIT_TAG LIBARIA2 ARIA2_STATIC HOST ONBUILD COPY . /aria2 -ARG SOURCE GIT_TAG LIBARIA2 ARIA2_STATIC FROM build_base as build_git +ARG SOURCE GIT_TAG LIBARIA2 ARIA2_STATIC HOST ONBUILD ADD https://api.github.com/repos/aria2/aria2/git/refs/heads/${GIT_TAG} version.json ONBUILD RUN echo "Downloading '${GIT_TAG}' from https://github.com/aria2/aria2" && \ git clone https://github.com/aria2/aria2 --depth 1 --branch "${GIT_TAG}" - -ARG SOURCE GIT_TAG LIBARIA2 ARIA2_STATIC FROM build_${SOURCE} +ARG SOURCE GIT_TAG LIBARIA2 ARIA2_STATIC HOST + RUN cd /aria2 && \ autoreconf -i && \ export LIBARIA2=${LIBARIA2} && \ export ARIA2_STATIC=${ARIA2_STATIC} && \ + export HOST=${HOST} && \ + export PREFIX=/usr/local/${HOST} && \ ./mingw-config && \ make && \ - (test -f /aria2/src/aria2c.exe && $HOST-strip /aria2/src/aria2c.exe) && \ - (test -f /aria2/src/main.o && $HOST-strip /aria2/src/main.o) + (test -f /aria2/src/aria2c.exe && ${HOST}-strip /aria2/src/aria2c.exe) && \ + (test -f /aria2/src/main.o && ${HOST}-strip /aria2/src/main.o) + +RUN echo "Finished build configuration:" && \ + echo " - SOURCE='${SOURCE}'" && \ + echo " - GIT_TAG='${GIT_TAG}'" && \ + echo " - LIBARIA2='${LIBARIA2}'" && \ + echo " - ARIA2_STATIC='${ARIA2_STATIC}'" && \ + echo " - HOST='${HOST}'" CMD test ! -d /output && \ echo 'The /output dir is not set. Use "docker run -v $PWD:/output ..." to copy build results into the current dir. To explore this container, append "bash" at the end of docker run command.' || \ From 29558afee831063b838b7fb43d854b769743327c Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Tue, 28 Dec 2021 16:12:13 -0500 Subject: [PATCH 4/8] Make dynamic compilation not fail Per instructions in https://sourceforge.net/p/mingw-w64/wiki2/Cross%20Win32%20and%20Win64%20compiler/ cross-compilation of the dynamic libs require a symlink /usr/local/mingw --- Dockerfile.mingw | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile.mingw b/Dockerfile.mingw index 6d5dc908..6ea64a26 100644 --- a/Dockerfile.mingw +++ b/Dockerfile.mingw @@ -159,7 +159,9 @@ ONBUILD RUN echo "Downloading '${GIT_TAG}' from https://github.com/aria2/aria2" FROM build_${SOURCE} ARG SOURCE GIT_TAG LIBARIA2 ARIA2_STATIC HOST -RUN cd /aria2 && \ +RUN ln -s /usr/local/${HOST} /usr/local/mingw && \ + mkdir -p /usr/local/mingw/lib && \ + cd /aria2 && \ autoreconf -i && \ export LIBARIA2=${LIBARIA2} && \ export ARIA2_STATIC=${ARIA2_STATIC} && \ From f2010dd876d17e74ed1d25446efc04cd9d29e439 Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Wed, 29 Dec 2021 22:20:22 -0500 Subject: [PATCH 5/8] better build artifact copying --- Dockerfile.mingw | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/Dockerfile.mingw b/Dockerfile.mingw index 6ea64a26..75371165 100644 --- a/Dockerfile.mingw +++ b/Dockerfile.mingw @@ -35,8 +35,13 @@ ARG SOURCE GIT_TAG LIBARIA2 ARIA2_STATIC HOST MAINTAINER Tatsuhiro Tsujikawa -# Preserve HOST as an ENV var just in case Docker user will want to use it again -ENV HOST=${HOST} +# Preserve all build params as ENV vars. This way CMD below will work properly, +# plus they will be available if the container is executed with "docker run ... bash" +ENV SOURCE=${SOURCE} \ + GIT_TAG=${GIT_TAG} \ + LIBARIA2=${LIBARIA2} \ + ARIA2_STATIC=${ARIA2_STATIC} \ + HOST=${HOST} RUN echo "Build configuration:" && \ echo " - SOURCE='${SOURCE}'" && \ @@ -160,7 +165,6 @@ FROM build_${SOURCE} ARG SOURCE GIT_TAG LIBARIA2 ARIA2_STATIC HOST RUN ln -s /usr/local/${HOST} /usr/local/mingw && \ - mkdir -p /usr/local/mingw/lib && \ cd /aria2 && \ autoreconf -i && \ export LIBARIA2=${LIBARIA2} && \ @@ -169,8 +173,8 @@ RUN ln -s /usr/local/${HOST} /usr/local/mingw && \ export PREFIX=/usr/local/${HOST} && \ ./mingw-config && \ make && \ - (test -f /aria2/src/aria2c.exe && ${HOST}-strip /aria2/src/aria2c.exe) && \ - (test -f /aria2/src/main.o && ${HOST}-strip /aria2/src/main.o) + make install && \ + ${HOST}-strip /usr/local/${HOST}/bin/aria2c.exe RUN echo "Finished build configuration:" && \ echo " - SOURCE='${SOURCE}'" && \ @@ -179,6 +183,21 @@ RUN echo "Finished build configuration:" && \ echo " - ARIA2_STATIC='${ARIA2_STATIC}'" && \ echo " - HOST='${HOST}'" -CMD test ! -d /output && \ - echo 'The /output dir is not set. Use "docker run -v $PWD:/output ..." to copy build results into the current dir. To explore this container, append "bash" at the end of docker run command.' || \ - cp -v /aria2/src/aria2c.exe* /aria2/src/main.o /output +# Define default command to simplify copying the build artifacts out of the container. +# Requires the user to provide the /output volume with the docker run -v :/output ... +# By default, aria2c.exe will be copied to the /bin. +# If the container is built with LIBARIA2 enabled, it will also copy the aria2.h file +# to /include/aria2/aria2.h, and all *.la and *.a files to /lib/ dir. +CMD set -e ; \ + if [ ! -d /output ] ; then \ + echo 'The /output dir is not set. Use "docker run -v :/output ..." to copy build results into the dir. To explore this container, append "bash" at the end of docker run command.' ; \ + else \ + mkdir -p /output/bin + cp -v /usr/local/${HOST}/bin/aria2c.exe /output/bin ; \ + if [ "${LIBARIA2}" = "enable" ] ; then \ + mkdir -p /output/lib + cp -v /usr/local/${HOST}/lib/*.a /usr/local/${HOST}/lib/*.la /output/lib ; \ + mkdir -p /output/include/aria2 + cp -v /usr/local/${HOST}/include/aria2/*.h /output/include/aria2 ; \ + fi \ + fi From 3eadc8650c44ff66309a9cec9084579a9925d5ab Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Wed, 29 Dec 2021 22:21:19 -0500 Subject: [PATCH 6/8] typo fix --- Dockerfile.mingw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.mingw b/Dockerfile.mingw index 75371165..1687be5a 100644 --- a/Dockerfile.mingw +++ b/Dockerfile.mingw @@ -192,7 +192,7 @@ CMD set -e ; \ if [ ! -d /output ] ; then \ echo 'The /output dir is not set. Use "docker run -v :/output ..." to copy build results into the dir. To explore this container, append "bash" at the end of docker run command.' ; \ else \ - mkdir -p /output/bin + mkdir -p /output/bin ; \ cp -v /usr/local/${HOST}/bin/aria2c.exe /output/bin ; \ if [ "${LIBARIA2}" = "enable" ] ; then \ mkdir -p /output/lib From 8fd035ea7bf9d1716126d18563c3aa1d698ed1a1 Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Wed, 29 Dec 2021 22:22:29 -0500 Subject: [PATCH 7/8] typo fix 2 --- Dockerfile.mingw | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile.mingw b/Dockerfile.mingw index 1687be5a..f05e92f8 100644 --- a/Dockerfile.mingw +++ b/Dockerfile.mingw @@ -195,9 +195,9 @@ CMD set -e ; \ mkdir -p /output/bin ; \ cp -v /usr/local/${HOST}/bin/aria2c.exe /output/bin ; \ if [ "${LIBARIA2}" = "enable" ] ; then \ - mkdir -p /output/lib + mkdir -p /output/lib ; \ cp -v /usr/local/${HOST}/lib/*.a /usr/local/${HOST}/lib/*.la /output/lib ; \ - mkdir -p /output/include/aria2 + mkdir -p /output/include/aria2 ; \ cp -v /usr/local/${HOST}/include/aria2/*.h /output/include/aria2 ; \ fi \ fi From 2f69932e6e79c66e09bfb81a79d70776f87a398f Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Wed, 29 Dec 2021 22:50:11 -0500 Subject: [PATCH 8/8] Parametrize github repository --- Dockerfile.mingw | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/Dockerfile.mingw b/Dockerfile.mingw index f05e92f8..33c78745 100644 --- a/Dockerfile.mingw +++ b/Dockerfile.mingw @@ -17,6 +17,7 @@ # Available build parameters: # SOURCE - "git" (default) to use Aria2 code from github. "local" to copy current directory. # GIT_TAG - if SOURCE=git (default), set which branch or tag to download. +# GITHUB_REPO - Specify github repo to download from. Uses aria2/aria2 by default. # LIBARIA2 - disable (default) / enable -- should the libaria2 library be built # ARIA2_STATIC - yes (default) / no -- compile as a dynamic or static code # HOST - By default uses i686-w64-mingw32. Set to x86_64-w64-mingw32 to build 64-bit binary @@ -26,12 +27,13 @@ ARG SOURCE=git ARG GIT_TAG=master +ARG GITHUB_REPO=aria2/aria2 ARG LIBARIA2=disable ARG ARIA2_STATIC=yes ARG HOST=i686-w64-mingw32 FROM ubuntu:20.04 as build_base -ARG SOURCE GIT_TAG LIBARIA2 ARIA2_STATIC HOST +ARG SOURCE GIT_TAG GITHUB_REPO LIBARIA2 ARIA2_STATIC HOST MAINTAINER Tatsuhiro Tsujikawa @@ -39,6 +41,7 @@ MAINTAINER Tatsuhiro Tsujikawa # plus they will be available if the container is executed with "docker run ... bash" ENV SOURCE=${SOURCE} \ GIT_TAG=${GIT_TAG} \ + GITHUB_REPO=${GITHUB_REPO} \ LIBARIA2=${LIBARIA2} \ ARIA2_STATIC=${ARIA2_STATIC} \ HOST=${HOST} @@ -46,6 +49,7 @@ ENV SOURCE=${SOURCE} \ RUN echo "Build configuration:" && \ echo " - SOURCE='${SOURCE}'" && \ echo " - GIT_TAG='${GIT_TAG}'" && \ + echo " - GITHUB_REPO='${GITHUB_REPO}'" && \ echo " - LIBARIA2='${LIBARIA2}'" && \ echo " - ARIA2_STATIC='${ARIA2_STATIC}'" && \ echo " - HOST='${HOST}'" @@ -151,18 +155,18 @@ RUN tar xf libssh2-1.9.0.tar.gz && \ # The last stage will use the needed stage, running the delayed steps. # FROM build_base as build_local -ARG SOURCE GIT_TAG LIBARIA2 ARIA2_STATIC HOST +ARG SOURCE GIT_TAG GITHUB_REPO LIBARIA2 ARIA2_STATIC HOST ONBUILD COPY . /aria2 FROM build_base as build_git -ARG SOURCE GIT_TAG LIBARIA2 ARIA2_STATIC HOST -ONBUILD ADD https://api.github.com/repos/aria2/aria2/git/refs/heads/${GIT_TAG} version.json -ONBUILD RUN echo "Downloading '${GIT_TAG}' from https://github.com/aria2/aria2" && \ - git clone https://github.com/aria2/aria2 --depth 1 --branch "${GIT_TAG}" +ARG SOURCE GIT_TAG GITHUB_REPO LIBARIA2 ARIA2_STATIC HOST +ONBUILD ADD https://api.github.com/repos/${GITHUB_REPO}/git/refs/heads/${GIT_TAG} version.json +ONBUILD RUN echo "Downloading '${GIT_TAG}' from https://github.com/${GITHUB_REPO}" && \ + git clone https://github.com/${GITHUB_REPO} --depth 1 --branch "${GIT_TAG}" FROM build_${SOURCE} -ARG SOURCE GIT_TAG LIBARIA2 ARIA2_STATIC HOST +ARG SOURCE GIT_TAG GITHUB_REPO LIBARIA2 ARIA2_STATIC HOST RUN ln -s /usr/local/${HOST} /usr/local/mingw && \ cd /aria2 && \ @@ -179,6 +183,7 @@ RUN ln -s /usr/local/${HOST} /usr/local/mingw && \ RUN echo "Finished build configuration:" && \ echo " - SOURCE='${SOURCE}'" && \ echo " - GIT_TAG='${GIT_TAG}'" && \ + echo " - GITHUB_REPO='${GITHUB_REPO}'" && \ echo " - LIBARIA2='${LIBARIA2}'" && \ echo " - ARIA2_STATIC='${ARIA2_STATIC}'" && \ echo " - HOST='${HOST}'"