Dockerfile.mingw 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. # Dockerfile to build aria2 Windows binary using ubuntu mingw-w64
  2. # cross compiler chain.
  3. #
  4. # $ sudo docker build -t aria2-mingw - < Dockerfile.mingw
  5. #
  6. # After successful build, windows binary is located at
  7. # /aria2/src/aria2c.exe. You can copy the binary using following
  8. # commands:
  9. #
  10. # $ id=$(sudo docker create aria2-mingw)
  11. # $ sudo docker cp $id:/aria2/src/aria2c.exe <dest>
  12. # $ sudo docker rm -v $id
  13. FROM ubuntu:wily
  14. MAINTAINER Tatsuhiro Tsujikawa
  15. # Change HOST to x86_64-w64-mingw32 to build 64-bit binary
  16. ENV HOST i686-w64-mingw32
  17. # It would be better to use nearest ubuntu archive mirror for faster
  18. # downloads.
  19. # RUN sed -ie 's/archive\.ubuntu/jp.archive.ubuntu/g' /etc/apt/sources.list
  20. RUN apt-get update && \
  21. apt-get install -y \
  22. make binutils autoconf automake autotools-dev libtool \
  23. pkg-config git curl dpkg-dev gcc-mingw-w64 \
  24. autopoint libcppunit-dev libxml2-dev libgcrypt11-dev lzip
  25. RUN curl -L -O https://gmplib.org/download/gmp/gmp-6.1.0.tar.lz && \
  26. curl -L -o gmp-6.1.0.patch https://gmplib.org/repo/gmp-6.1/raw-rev/67d4ee9dead1 && \
  27. curl -L -O http://downloads.sourceforge.net/project/expat/expat/2.1.1/expat-2.1.1.tar.gz && \
  28. curl -L -O https://www.sqlite.org/2016/sqlite-autoconf-3120100.tar.gz && \
  29. curl -L -O http://zlib.net/zlib-1.2.8.tar.xz && \
  30. curl -L -O http://c-ares.haxx.se/download/c-ares-1.11.0.tar.gz && \
  31. curl -L -O http://libssh2.org/download/libssh2-1.7.0.tar.gz
  32. RUN tar xf gmp-6.1.0.tar.lz && \
  33. cd gmp-6.1.0 && \
  34. patch -p1 < ../gmp-6.1.0.patch && \
  35. ./configure \
  36. --disable-shared \
  37. --enable-static \
  38. --prefix=/usr/local/$HOST \
  39. --host=$HOST \
  40. --disable-cxx \
  41. --enable-fat \
  42. CFLAGS="-mtune=generic -O2 -g0" && \
  43. make install
  44. RUN tar xf expat-2.1.1.tar.gz && \
  45. cd expat-2.1.1 && \
  46. ./configure \
  47. --disable-shared \
  48. --enable-static \
  49. --prefix=/usr/local/$HOST \
  50. --host=$HOST \
  51. --build=`dpkg-architecture -qDEB_BUILD_GNU_TYPE` && \
  52. make install
  53. RUN tar xf sqlite-autoconf-3120100.tar.gz && \
  54. cd sqlite-autoconf-3120100 && \
  55. ./configure \
  56. --disable-shared \
  57. --enable-static \
  58. --prefix=/usr/local/$HOST \
  59. --host=$HOST \
  60. --build=`dpkg-architecture -qDEB_BUILD_GNU_TYPE` && \
  61. make install
  62. RUN tar xf zlib-1.2.8.tar.xz && \
  63. cd zlib-1.2.8 && \
  64. CC=$HOST-gcc \
  65. AR=$HOST-ar \
  66. LD=$HOST-ld \
  67. RANLIB=$HOST-ranlib \
  68. STRIP=$HOST-strip \
  69. ./configure \
  70. --prefix=/usr/local/$HOST \
  71. --libdir=/usr/local/$HOST/lib \
  72. --includedir=/usr/local/$HOST/include \
  73. --static && \
  74. make install
  75. RUN tar xf c-ares-1.11.0.tar.gz && \
  76. cd c-ares-1.11.0 && \
  77. ./configure \
  78. --disable-shared \
  79. --enable-static \
  80. --without-random \
  81. --prefix=/usr/local/$HOST \
  82. --host=$HOST \
  83. --build=`dpkg-architecture -qDEB_BUILD_GNU_TYPE` \
  84. LIBS="-lws2_32" && \
  85. make install
  86. RUN tar xf libssh2-1.7.0.tar.gz && \
  87. cd libssh2-1.7.0 && \
  88. ./configure \
  89. --disable-shared \
  90. --enable-static \
  91. --prefix=/usr/local/$HOST \
  92. --host=$HOST \
  93. --build=`dpkg-architecture -qDEB_BUILD_GNU_TYPE` \
  94. --without-openssl \
  95. --with-wincng \
  96. LIBS="-lws2_32" && \
  97. make install
  98. RUN git clone https://github.com/aria2/aria2 && \
  99. cd aria2 && autoreconf -i && ./mingw-config && make && \
  100. $HOST-strip src/aria2c.exe