Dockerfile.mingw 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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:19.04
  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 g++-mingw-w64 \
  24. autopoint libcppunit-dev libxml2-dev libgcrypt11-dev lzip
  25. RUN curl -L -O https://gmplib.org/download/gmp/gmp-6.1.2.tar.lz && \
  26. curl -L -O https://github.com/libexpat/libexpat/releases/download/R_2_2_7/expat-2.2.7.tar.bz2 && \
  27. curl -L -O https://www.sqlite.org/2019/sqlite-autoconf-3290000.tar.gz && \
  28. curl -L -O http://zlib.net/zlib-1.2.11.tar.gz && \
  29. curl -L -O https://c-ares.haxx.se/download/c-ares-1.15.0.tar.gz && \
  30. curl -L -O https://www.libssh2.org/download/libssh2-1.9.0.tar.gz
  31. RUN tar xf gmp-6.1.2.tar.lz && \
  32. cd gmp-6.1.2 && \
  33. ./configure \
  34. --disable-shared \
  35. --enable-static \
  36. --prefix=/usr/local/$HOST \
  37. --host=$HOST \
  38. --disable-cxx \
  39. --enable-fat \
  40. CFLAGS="-mtune=generic -O2 -g0" && \
  41. make install
  42. RUN tar xf expat-2.2.7.tar.bz2 && \
  43. cd expat-2.2.7 && \
  44. ./configure \
  45. --disable-shared \
  46. --enable-static \
  47. --prefix=/usr/local/$HOST \
  48. --host=$HOST \
  49. --build=`dpkg-architecture -qDEB_BUILD_GNU_TYPE` && \
  50. make install
  51. RUN tar xf sqlite-autoconf-3290000.tar.gz && \
  52. cd sqlite-autoconf-3290000 && \
  53. ./configure \
  54. --disable-shared \
  55. --enable-static \
  56. --prefix=/usr/local/$HOST \
  57. --host=$HOST \
  58. --build=`dpkg-architecture -qDEB_BUILD_GNU_TYPE` && \
  59. make install
  60. RUN tar xf zlib-1.2.11.tar.gz && \
  61. cd zlib-1.2.11 && \
  62. CC=$HOST-gcc \
  63. AR=$HOST-ar \
  64. LD=$HOST-ld \
  65. RANLIB=$HOST-ranlib \
  66. STRIP=$HOST-strip \
  67. ./configure \
  68. --prefix=/usr/local/$HOST \
  69. --libdir=/usr/local/$HOST/lib \
  70. --includedir=/usr/local/$HOST/include \
  71. --static && \
  72. make install
  73. RUN tar xf c-ares-1.15.0.tar.gz && \
  74. cd c-ares-1.15.0 && \
  75. ./configure \
  76. --disable-shared \
  77. --enable-static \
  78. --without-random \
  79. --prefix=/usr/local/$HOST \
  80. --host=$HOST \
  81. --build=`dpkg-architecture -qDEB_BUILD_GNU_TYPE` \
  82. LIBS="-lws2_32" && \
  83. make install
  84. RUN tar xf libssh2-1.9.0.tar.gz && \
  85. cd libssh2-1.9.0 && \
  86. ./configure \
  87. --disable-shared \
  88. --enable-static \
  89. --prefix=/usr/local/$HOST \
  90. --host=$HOST \
  91. --build=`dpkg-architecture -qDEB_BUILD_GNU_TYPE` \
  92. --without-openssl \
  93. --with-wincng \
  94. LIBS="-lws2_32" && \
  95. make install
  96. ADD https://api.github.com/repos/aria2/aria2/git/refs/heads/master version.json
  97. RUN git clone https://github.com/aria2/aria2 && \
  98. cd aria2 && autoreconf -i && ./mingw-config && make && \
  99. $HOST-strip src/aria2c.exe