Dockerfile.mingw 3.6 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. # $ sudo docker run --rm -it -v /path/to/dest:/out aria2-mingw cp /aria2/src/aria2c.exe /out
  11. FROM ubuntu:22.04
  12. MAINTAINER Tatsuhiro Tsujikawa
  13. # Change HOST to x86_64-w64-mingw32 to build 64-bit binary
  14. ARG HOST=i686-w64-mingw32
  15. # It would be better to use nearest ubuntu archive mirror for faster
  16. # downloads.
  17. # RUN sed -ie 's/archive\.ubuntu/jp.archive.ubuntu/g' /etc/apt/sources.list
  18. RUN apt-get update && \
  19. DEBIAN_FRONTEND="noninteractive" \
  20. apt-get install -y --no-install-recommends \
  21. make binutils autoconf automake autotools-dev libtool \
  22. patch ca-certificates \
  23. pkg-config git curl dpkg-dev gcc-mingw-w64 g++-mingw-w64 \
  24. autopoint libcppunit-dev libxml2-dev libgcrypt20-dev lzip
  25. RUN curl -L -O https://gmplib.org/download/gmp/gmp-6.3.0.tar.xz && \
  26. curl -L -O https://github.com/libexpat/libexpat/releases/download/R_2_5_0/expat-2.5.0.tar.bz2 && \
  27. curl -L -O https://www.sqlite.org/2023/sqlite-autoconf-3430100.tar.gz && \
  28. curl -L -O https://www.zlib.net/zlib-1.3.tar.gz && \
  29. curl -L -O https://c-ares.org/download/c-ares-1.19.1.tar.gz && \
  30. curl -L -O https://libssh2.org/download/libssh2-1.11.0.tar.bz2
  31. RUN tar xf gmp-6.3.0.tar.xz && \
  32. cd gmp-6.3.0 && \
  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 -j$(nproc) install
  42. RUN tar xf expat-2.5.0.tar.bz2 && \
  43. cd expat-2.5.0 && \
  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 -j$(nproc) install
  51. RUN tar xf sqlite-autoconf-3430100.tar.gz && \
  52. cd sqlite-autoconf-3430100 && \
  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 -j$(nproc) install
  60. RUN tar xf zlib-1.3.tar.gz && \
  61. cd zlib-1.3 && \
  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 -j$(nproc) install
  73. RUN tar xf c-ares-1.19.1.tar.gz && \
  74. cd c-ares-1.19.1 && \
  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 -j$(nproc) install
  84. RUN tar xf libssh2-1.11.0.tar.bz2 && \
  85. cd libssh2-1.11.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. LIBS="-lws2_32" && \
  93. make -j$(nproc) install
  94. ARG ARIA2_VERSION=master
  95. ARG ARIA2_REF=refs/heads/master
  96. ADD https://api.github.com/repos/aria2/aria2/git/$ARIA2_REF version.json
  97. RUN git clone -b $ARIA2_VERSION --depth 1 https://github.com/aria2/aria2 && \
  98. cd aria2 && autoreconf -i && ./mingw-config && make -j$(nproc) && \
  99. $HOST-strip src/aria2c.exe