-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile-arm64-apple-darwin
157 lines (132 loc) · 6.47 KB
/
Dockerfile-arm64-apple-darwin
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
FROM debian:12.4-slim as stage1
ENV PATH /usr/local/osxcross/bin:${PATH}
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
clang \
clang-tidy \
cmake \
file \
gawk \
git \
libgmp-dev \
libmpc-dev \
libmpfr-dev \
libssl-dev \
libxml2-dev \
llvm \
lzma-dev \
make \
ninja-build \
patch \
python3-pip \
wget \
xz-utils \
zlib1g-dev \
curl \
golang \
ninja-build \
&& \
pip3 install --break-system-packages conan==1.62.0 && \
git clone https://github.com/tpoechtrager/osxcross.git && \
wget -O osxcross/tarballs/MacOSX11.3.sdk.tar.xz https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX11.3.sdk.tar.xz && \
cd osxcross && \
echo 'cd4f08a75577145b8f05245a2975f7c81401d75e9535dcffbb879ee1deefcbf4 tarballs/MacOSX11.3.sdk.tar.xz' | shasum -c && \
mkdir -p /usr/local/osxcross && \
env TARGET_DIR=/usr/local/osxcross UNATTENDED=1 ./build.sh && \
cd / && \
rm -rf osxcross
ENV CXX "arm64-apple-darwin20.4-clang++"
ENV CC "arm64-apple-darwin20.4-clang"
ENV CROSSBUILD "arm64-apple-darwin"
ENV CPPFLAGS "-mmacosx-version-min=10.15"
ARG CURL_COMMIT=d755a5f7c009dd63a61b2c745180d8ba937cbfeb
ARG BORINGSSL_COMMIT=23824fa0fed94f4660ffafb15aaea8b317f2c8a6
ARG NGHTTP2_COMMIT=05b792901933664e7aeb7ebb8c87db81123d484a
ARG ZLIB_COMMIT=04f42ceca40f73e2978b50e93806c2a18c1281fc
ARG ZSTD_COMMIT=a58b48ef0e543980888a4d9d16c9072ff22135ca
ARG BROTLI_COMMIT=71fe6cac061ac62c0241f410fbd43a04a6b4f303
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Etc/UTC
COPY quiche quiche
RUN curl -L -k https://github.com/google/brotli/archive/${BROTLI_COMMIT}.tar.gz -o brotli-${BROTLI_COMMIT}.tar.gz && \
tar -xf brotli-${BROTLI_COMMIT}.tar.gz
RUN cd brotli-${BROTLI_COMMIT} && \
mkdir build && cd build && \
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=./installed -DCMAKE_SYSTEM_NAME="Darwin" -DBUILD_SHARED_LIBS=0 .. && \
cmake --build . --config Release --target install
RUN curl -L -k https://github.com/facebook/zstd/archive/${ZSTD_COMMIT}.tar.gz -o zstd-${ZSTD_COMMIT}.tar.gz && \
tar -xf zstd-${ZSTD_COMMIT}.tar.gz
RUN cd zstd-${ZSTD_COMMIT} && \
cd build && \
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=./installed -DCMAKE_SYSTEM_NAME="Darwin" ./cmake && \
cmake --build . --config Release --target install
RUN curl -L -k https://github.com/madler/zlib/archive/${ZLIB_COMMIT}.tar.gz -o zlib-${ZLIB_COMMIT}.tar.gz && \
tar -xf zlib-${ZLIB_COMMIT}.tar.gz
RUN cd zlib-${ZLIB_COMMIT} && \
mkdir build && cd build && \
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=./installed -DCMAKE_SYSTEM_NAME="Darwin" .. && \
cmake --build . --config Release --target install
RUN curl -L -k https://github.com/nghttp2/nghttp2/archive/${NGHTTP2_COMMIT}.tar.gz -o nghttp2-${NGHTTP2_COMMIT}.tar.gz && \
tar -xf nghttp2-${NGHTTP2_COMMIT}.tar.gz
RUN cd nghttp2-${NGHTTP2_COMMIT} && \
mkdir build && cd build && \
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=./installed -DCMAKE_SYSTEM_NAME="Darwin" -DENABLE_SHARED_LIB=0 -DENABLE_STATIC_LIB=1 .. && \
cmake --build . --config Release --target install
RUN curl -L -k https://github.com/google/boringssl/archive/${BORINGSSL_COMMIT}.tar.gz -o boringssl-${BORINGSSL_COMMIT}.tar.gz && \
tar -xf boringssl-${BORINGSSL_COMMIT}.tar.gz
COPY boringssl-${BORINGSSL_COMMIT}.patch boringssl-${BORINGSSL_COMMIT}/
RUN cd boringssl-${BORINGSSL_COMMIT} && \
patch -p1 < boringssl-${BORINGSSL_COMMIT}.patch
RUN cd boringssl-${BORINGSSL_COMMIT} && \
mkdir build && cd build && \
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=./installed -DCMAKE_SYSTEM_NAME="Darwin" -DBUILD_SHARED_LIBS=0 -DCMAKE_POSITION_INDEPENDENT_CODE=1 -GNinja .. && \
ninja ssl
RUN mkdir boringssl-${BORINGSSL_COMMIT}/build/lib && \
ln -s ../crypto/libcrypto.a boringssl-${BORINGSSL_COMMIT}/build/lib/libcrypto.a && \
ln -s ../ssl/libssl.a boringssl-${BORINGSSL_COMMIT}/build/lib/libssl.a && \
cp -R boringssl-${BORINGSSL_COMMIT}/include boringssl-${BORINGSSL_COMMIT}/build
RUN curl -L -k https://github.com/curl/curl/archive/${CURL_COMMIT}.tar.gz -o curl-${CURL_COMMIT}.tar.gz && \
tar -xf curl-${CURL_COMMIT}.tar.gz
COPY curl-${CURL_COMMIT}.patch curl-${CURL_COMMIT}/
RUN cd curl-${CURL_COMMIT} && \
patch -p1 < curl-${CURL_COMMIT}.patch
RUN cd curl-${CURL_COMMIT} && \
mkdir build && cd build && \
cmake -DCMAKE_INSTALL_PREFIX=./installed \
-DCMAKE_SYSTEM_NAME="Darwin" \
-DBUILD_SHARED_LIBS=0 \
-DCMAKE_BUILD_TYPE=Release \
-DOPENSSL_ROOT_DIR=/boringssl-${BORINGSSL_COMMIT}/build/ \
-DZLIB_INCLUDE_DIR=/zlib-${ZLIB_COMMIT}/build/installed/include \
-DZLIB_LIBRARY=/zlib-${ZLIB_COMMIT}/build/installed/lib/libz.a \
-DUSE_NGHTTP2=1 \
-DNGHTTP2_INCLUDE_DIR=/nghttp2-${NGHTTP2_COMMIT}/build/installed/include \
-DNGHTTP2_LIBRARY=/nghttp2-${NGHTTP2_COMMIT}/build/installed/lib/libnghttp2.a \
-DUSE_QUICHE=1 \
-DQUICHE_INCLUDE_DIR=/quiche \
-DQUICHE_LIBRARY=/quiche/libquiche.a \
-DCURL_ZSTD=1 \
-DZstd_INCLUDE_DIR=/zstd-${ZSTD_COMMIT}/build/installed/include \
-DZstd_LIBRARY=/zstd-${ZSTD_COMMIT}/build/installed/lib/libzstd.a \
-DCURL_BROTLI=1 \
-DBROTLI_INCLUDE_DIR=/brotli-${BROTLI_COMMIT}/build/installed/include \
-DBROTLIDEC_LIBRARY=/brotli-${BROTLI_COMMIT}/build/installed/lib/libbrotlidec.a \
-DBROTLICOMMON_LIBRARY=/brotli-${BROTLI_COMMIT}/build/installed/lib/libbrotlicommon.a \
-DENABLE_WEBSOCKETS=1 \
-DBUILD_CURL_EXE=0 \
-DCMAKE_POSITION_INDEPENDENT_CODE=1 \
-DSYSTEMCONFIGURATION_FRAMEWORK="/usr/local/Frameworks" \
-DCOREFOUNDATION_FRAMEWORK="/usr/local/osxcross/SDK/MacOSX11.3.sdk/System/Library/Frameworks/CoreFoundation.framework" \
-DCORESERVICES_FRAMEWORK="/usr/local/osxcross/SDK/MacOSX11.3.sdk/System/Library/Frameworks/CoreServices.framework" \
.. && \
make libcurl_static && make install
RUN mkdir dist && \
cp /curl-${CURL_COMMIT}/build/installed/lib/libcurl.a /dist && \
cp /zstd-${ZSTD_COMMIT}/build/installed/lib/libzstd.a /dist && \
cp /boringssl-${BORINGSSL_COMMIT}/build/lib/libcrypto.a /dist && \
cp /boringssl-${BORINGSSL_COMMIT}/build/lib/libssl.a /dist
FROM ubuntu:20.04 as stage2
COPY --from=stage1 /dist /curl-dist
CMD cp /curl-dist/* /output