mirror of https://github.com/aria2/aria2
Handle HOST var too, allowing 32/64bit
parent
930f04bcff
commit
e8751e326b
|
@ -19,20 +19,31 @@
|
||||||
# GIT_TAG - if SOURCE=git (default), set which branch or tag to download.
|
# GIT_TAG - if SOURCE=git (default), set which branch or tag to download.
|
||||||
# LIBARIA2 - disable (default) / enable -- should the libaria2 library be built
|
# LIBARIA2 - disable (default) / enable -- should the libaria2 library be built
|
||||||
# ARIA2_STATIC - yes (default) / no -- compile as a dynamic or static code
|
# 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.
|
# Note that LIBARIA2 and ARIA2_STATIC params might not work for older versions.
|
||||||
#
|
#
|
||||||
|
|
||||||
ARG SOURCE=git
|
ARG SOURCE=git
|
||||||
ARG GIT_TAG=master
|
ARG GIT_TAG=master
|
||||||
ARG LIBARIA2=disable
|
ARG LIBARIA2=disable
|
||||||
ARG ARIA2_STATIC=yes
|
ARG ARIA2_STATIC=yes
|
||||||
|
ARG HOST=i686-w64-mingw32
|
||||||
|
|
||||||
FROM ubuntu:20.04 as build_base
|
FROM ubuntu:20.04 as build_base
|
||||||
|
ARG SOURCE GIT_TAG LIBARIA2 ARIA2_STATIC HOST
|
||||||
|
|
||||||
MAINTAINER Tatsuhiro Tsujikawa
|
MAINTAINER Tatsuhiro Tsujikawa
|
||||||
|
|
||||||
# Change HOST to x86_64-w64-mingw32 to build 64-bit binary
|
# Preserve HOST as an ENV var just in case Docker user will want to use it again
|
||||||
ENV HOST i686-w64-mingw32
|
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
|
# It would be better to use nearest ubuntu archive mirror for faster
|
||||||
# downloads.
|
# downloads.
|
||||||
|
@ -59,8 +70,8 @@ RUN tar xf gmp-6.2.1.tar.lz && \
|
||||||
./configure \
|
./configure \
|
||||||
--disable-shared \
|
--disable-shared \
|
||||||
--enable-static \
|
--enable-static \
|
||||||
--prefix=/usr/local/$HOST \
|
--prefix=/usr/local/${HOST} \
|
||||||
--host=$HOST \
|
--host=${HOST} \
|
||||||
--disable-cxx \
|
--disable-cxx \
|
||||||
--enable-fat \
|
--enable-fat \
|
||||||
CFLAGS="-mtune=generic -O2 -g0" && \
|
CFLAGS="-mtune=generic -O2 -g0" && \
|
||||||
|
@ -71,8 +82,8 @@ RUN tar xf expat-2.4.1.tar.bz2 && \
|
||||||
./configure \
|
./configure \
|
||||||
--disable-shared \
|
--disable-shared \
|
||||||
--enable-static \
|
--enable-static \
|
||||||
--prefix=/usr/local/$HOST \
|
--prefix=/usr/local/${HOST} \
|
||||||
--host=$HOST \
|
--host=${HOST} \
|
||||||
--build=`dpkg-architecture -qDEB_BUILD_GNU_TYPE` && \
|
--build=`dpkg-architecture -qDEB_BUILD_GNU_TYPE` && \
|
||||||
make install
|
make install
|
||||||
|
|
||||||
|
@ -81,22 +92,22 @@ RUN tar xf sqlite-autoconf-3360000.tar.gz && \
|
||||||
./configure \
|
./configure \
|
||||||
--disable-shared \
|
--disable-shared \
|
||||||
--enable-static \
|
--enable-static \
|
||||||
--prefix=/usr/local/$HOST \
|
--prefix=/usr/local/${HOST} \
|
||||||
--host=$HOST \
|
--host=${HOST} \
|
||||||
--build=`dpkg-architecture -qDEB_BUILD_GNU_TYPE` && \
|
--build=`dpkg-architecture -qDEB_BUILD_GNU_TYPE` && \
|
||||||
make install
|
make install
|
||||||
|
|
||||||
RUN tar xf zlib-1.2.11.tar.gz && \
|
RUN tar xf zlib-1.2.11.tar.gz && \
|
||||||
cd zlib-1.2.11 && \
|
cd zlib-1.2.11 && \
|
||||||
CC=$HOST-gcc \
|
CC=${HOST}-gcc \
|
||||||
AR=$HOST-ar \
|
AR=${HOST}-ar \
|
||||||
LD=$HOST-ld \
|
LD=${HOST}-ld \
|
||||||
RANLIB=$HOST-ranlib \
|
RANLIB=${HOST}-ranlib \
|
||||||
STRIP=$HOST-strip \
|
STRIP=${HOST}-strip \
|
||||||
./configure \
|
./configure \
|
||||||
--prefix=/usr/local/$HOST \
|
--prefix=/usr/local/${HOST} \
|
||||||
--libdir=/usr/local/$HOST/lib \
|
--libdir=/usr/local/${HOST}/lib \
|
||||||
--includedir=/usr/local/$HOST/include \
|
--includedir=/usr/local/${HOST}/include \
|
||||||
--static && \
|
--static && \
|
||||||
make install
|
make install
|
||||||
|
|
||||||
|
@ -106,8 +117,8 @@ RUN tar xf c-ares-1.17.2.tar.gz && \
|
||||||
--disable-shared \
|
--disable-shared \
|
||||||
--enable-static \
|
--enable-static \
|
||||||
--without-random \
|
--without-random \
|
||||||
--prefix=/usr/local/$HOST \
|
--prefix=/usr/local/${HOST} \
|
||||||
--host=$HOST \
|
--host=${HOST} \
|
||||||
--build=`dpkg-architecture -qDEB_BUILD_GNU_TYPE` \
|
--build=`dpkg-architecture -qDEB_BUILD_GNU_TYPE` \
|
||||||
LIBS="-lws2_32" && \
|
LIBS="-lws2_32" && \
|
||||||
make install
|
make install
|
||||||
|
@ -118,8 +129,8 @@ RUN tar xf libssh2-1.9.0.tar.gz && \
|
||||||
./configure \
|
./configure \
|
||||||
--disable-shared \
|
--disable-shared \
|
||||||
--enable-static \
|
--enable-static \
|
||||||
--prefix=/usr/local/$HOST \
|
--prefix=/usr/local/${HOST} \
|
||||||
--host=$HOST \
|
--host=${HOST} \
|
||||||
--build=`dpkg-architecture -qDEB_BUILD_GNU_TYPE` \
|
--build=`dpkg-architecture -qDEB_BUILD_GNU_TYPE` \
|
||||||
--without-openssl \
|
--without-openssl \
|
||||||
--with-wincng \
|
--with-wincng \
|
||||||
|
@ -134,28 +145,37 @@ RUN tar xf libssh2-1.9.0.tar.gz && \
|
||||||
# or will download a specific tag/branch from github.
|
# or will download a specific tag/branch from github.
|
||||||
# The last stage will use the needed stage, running the delayed steps.
|
# 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
|
FROM build_base as build_local
|
||||||
|
ARG SOURCE GIT_TAG LIBARIA2 ARIA2_STATIC HOST
|
||||||
ONBUILD COPY . /aria2
|
ONBUILD COPY . /aria2
|
||||||
|
|
||||||
|
|
||||||
ARG SOURCE GIT_TAG LIBARIA2 ARIA2_STATIC
|
|
||||||
FROM build_base as build_git
|
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 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" && \
|
ONBUILD RUN echo "Downloading '${GIT_TAG}' from https://github.com/aria2/aria2" && \
|
||||||
git clone https://github.com/aria2/aria2 --depth 1 --branch "${GIT_TAG}"
|
git clone https://github.com/aria2/aria2 --depth 1 --branch "${GIT_TAG}"
|
||||||
|
|
||||||
|
|
||||||
ARG SOURCE GIT_TAG LIBARIA2 ARIA2_STATIC
|
|
||||||
FROM build_${SOURCE}
|
FROM build_${SOURCE}
|
||||||
|
ARG SOURCE GIT_TAG LIBARIA2 ARIA2_STATIC HOST
|
||||||
|
|
||||||
RUN cd /aria2 && \
|
RUN cd /aria2 && \
|
||||||
autoreconf -i && \
|
autoreconf -i && \
|
||||||
export LIBARIA2=${LIBARIA2} && \
|
export LIBARIA2=${LIBARIA2} && \
|
||||||
export ARIA2_STATIC=${ARIA2_STATIC} && \
|
export ARIA2_STATIC=${ARIA2_STATIC} && \
|
||||||
|
export HOST=${HOST} && \
|
||||||
|
export PREFIX=/usr/local/${HOST} && \
|
||||||
./mingw-config && \
|
./mingw-config && \
|
||||||
make && \
|
make && \
|
||||||
(test -f /aria2/src/aria2c.exe && $HOST-strip /aria2/src/aria2c.exe) && \
|
(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/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 && \
|
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.' || \
|
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.' || \
|
||||||
|
|
Loading…
Reference in New Issue