Add Dockerfile.mingw

Dockerfile.mingw builds aria2 Windows binary.  It is probably the
easiest way to build the Windows binary.
pull/311/head
Tatsuhiro Tsujikawa 2014-10-19 16:45:18 +09:00
parent 1185972042
commit d47a37eeda
3 changed files with 98 additions and 1 deletions

93
Dockerfile.mingw Normal file
View File

@ -0,0 +1,93 @@
# Dockerfile to build aria2 Windows binary using ubuntu mingw-w64
# cross compiler chain.
#
# $ sudo docker build -t aria2-mingw - < Dockerfile.mingw
#
# After successful build, windows binary is located at
# /aria2/src/aria2c.exe. You can copy the binary using
#
# $ sudo docker cp <containerId>:/aria2/src/aria2c.exe <dest>
FROM ubuntu
MAINTAINER Tatsuhiro Tsujikawa
# Change HOST to x86_64-w64-mingw32 to build 64-bit binary
ENV HOST i686-w64-mingw32
# It would be better to use nearest ubuntu archive mirror for faster
# downloads.
# RUN sed -ie 's/archive\.ubuntu/jp.archive.ubuntu/g' /etc/apt/sources.list
RUN apt-get update
RUN apt-get install -y make binutils autoconf automake autotools-dev libtool \
pkg-config git curl dpkg-dev gcc-mingw-w64 \
autopoint libcppunit-dev libxml2-dev libgcrypt11-dev lzip
RUN curl -L -O https://gmplib.org/download/gmp/gmp-6.0.0a.tar.lz
RUN curl -L -O http://downloads.sourceforge.net/project/expat/expat/2.1.0/expat-2.1.0.tar.gz
RUN curl -L -O http://www.sqlite.org/2014/sqlite-autoconf-3080700.tar.gz
RUN curl -L -O http://zlib.net/zlib-1.2.8.tar.xz
RUN curl -L -O http://c-ares.haxx.se/download/c-ares-1.10.0.tar.gz
RUN tar xf gmp-6.0.0a.tar.lz
RUN cd gmp-6.0.0 && \
./configure \
--disable-shared \
--enable-static \
--prefix=/usr/local/$HOST \
--host=$HOST \
--disable-cxx \
--enable-fat \
CFLAGS="-mtune=generic -O2 -g0" && \
make install
RUN tar xf expat-2.1.0.tar.gz
RUN cd expat-2.1.0 && \
./configure \
--disable-shared \
--enable-static \
--prefix=/usr/local/$HOST \
--host=$HOST \
--build=`dpkg-architecture -qDEB_BUILD_GNU_TYPE` && \
make install
RUN tar xf sqlite-autoconf-3080700.tar.gz
RUN cd sqlite-autoconf-3080700 && \
./configure \
--disable-shared \
--enable-static \
--prefix=/usr/local/$HOST \
--host=$HOST \
--build=`dpkg-architecture -qDEB_BUILD_GNU_TYPE` && \
make install
RUN tar xf zlib-1.2.8.tar.xz
RUN cd zlib-1.2.8 && \
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 \
--static && \
make install
RUN tar xf c-ares-1.10.0.tar.gz
RUN cd c-ares-1.10.0 && \
./configure \
--disable-shared \
--enable-static \
--without-random \
--prefix=/usr/local/$HOST \
--host=$HOST \
--build=`dpkg-architecture -qDEB_BUILD_GNU_TYPE` \
LIBS="-lws2_32" && \
make install
RUN git clone https://github.com/tatsuhiro-t/aria2
RUN cd aria2 && autoreconf -i && ./mingw-config && make && \
$HOST-strip src/aria2c.exe

View File

@ -9,6 +9,7 @@ EXTRA_DIST = config.rpath \
mingw-config mingw-release mingw-build-memo \
android-config android-make \
makerelease-osx.mk osx-package/DS_Store osx-package/etc/paths.d/aria2c osx-package/etc/manpaths.d/aria2 \
Dockerfile.mingw \
examples/libaria2ex.cc examples/libaria2wx.cc
dist_doc_DATA = README README.rst README.html

View File

@ -282,6 +282,10 @@ mingw-w64 (http://mingw-w64.sourceforge.net/) cross-compiler on Debian
Linux. The MinGW (http://www.mingw.org/) may not be able to build
aria2.
The easiest way to build Windows binary is use Dockerfile.mingw. See
Dockerfile.mingw how to build binary. If you cannot use Dockerfile,
then continue to read following paragraphs.
Basically, after compiling and installing depended libraries, you can
do cross-compile just passing appropriate ``--host`` option and
specifying ``CPPFLAGS``, ``LDFLAGS`` and ``PKG_CONFIG_LIBDIR``
@ -294,7 +298,6 @@ We use it to create official Windows build. This script assumes
following libraries have been built for cross-compile:
* c-ares
* openssl
* expat
* sqlite3
* zlib