forked from aria2/aria2
/
Dockerfile.mingw
122 lines (108 loc) · 3.88 KB
/
Dockerfile.mingw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# 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-2048-threads/src/aria2c.exe. You can copy the binary using following
# commands:
#
# $ id=$(sudo docker create aria2-mingw)
# $ sudo docker cp $id:/aria2-2048-threads/src/aria2c.exe <dest>
# $ sudo docker rm -v $id
FROM ubuntu:22.04
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\.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list
RUN sed -ie 's/security\.ubuntu\.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list
RUN apt-get update && \
DEBIAN_FRONTEND="noninteractive" \
apt-get install -y --no-install-recommends \
make binutils autoconf automake autotools-dev libtool \
patch ca-certificates \
pkg-config git curl dpkg-dev gcc-mingw-w64 g++-mingw-w64 \
autopoint libcppunit-dev libxml2-dev libgcrypt20-dev lzip
# Local Proxy
ENV HTTP_PROXY http://192.168.0.101:1081/
ENV HTTPS_PROXY http://192.168.0.101:1081/
ENV http_proxy http://192.168.0.101:1081/
ENV https_proxy http://192.168.0.101:1081/
RUN curl -L -O https://gmplib.org/download/gmp/gmp-6.2.1.tar.lz && \
curl -L -O https://github.com/libexpat/libexpat/releases/download/R_2_4_8/expat-2.4.8.tar.bz2 && \
curl -L -O https://www.sqlite.org/2022/sqlite-autoconf-3380500.tar.gz && \
curl -L -O http://zlib.net/zlib-1.2.12.tar.gz && \
curl -L -O https://c-ares.haxx.se/download/c-ares-1.18.1.tar.gz && \
curl -L -O https://www.libssh2.org/download/libssh2-1.10.0.tar.gz
ENV MAKEFLAGS -j4
RUN tar xf gmp-6.2.1.tar.lz && \
cd gmp-6.2.1 && \
./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.4.8.tar.bz2 && \
cd expat-2.4.8 && \
./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-3380500.tar.gz && \
cd sqlite-autoconf-3380500 && \
./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.12.tar.gz && \
cd zlib-1.2.12 && \
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.18.1.tar.gz && \
cd c-ares-1.18.1 && \
./configure \
--disable-shared \
--enable-static \
--without-random \
--prefix=/usr/local/$HOST \
--host=$HOST \
--build=`dpkg-architecture -qDEB_BUILD_GNU_TYPE` \
LIBS="-lws2_32 -liphlpapi" && \
make install
RUN tar xf libssh2-1.10.0.tar.gz && \
cd libssh2-1.10.0 && \
./configure \
--disable-shared \
--enable-static \
--prefix=/usr/local/$HOST \
--host=$HOST \
--build=`dpkg-architecture -qDEB_BUILD_GNU_TYPE` \
--without-openssl \
--with-wincng \
LIBS="-lws2_32" && \
make install
ADD https://api.github.com/repos/chitao1234/aria2-2048-threads/git/refs/heads/master version.json
RUN git clone https://github.com/chitao1234/aria2-2048-threads && \
cd aria2-2048-threads && autoreconf -i && ./mingw-config && make && \
$HOST-strip src/aria2c.exe