@@ -52,31 +52,16 @@ RUN chmod a+X /root
5252# Convenience list of versions and variables for compilation later on
5353# This helps continuing manually if anything breaks.
5454ENV SSL_VER="1.1.1w" \
55+ CURL_VER="8.6.0" \
5556 ZLIB_VER="1.3.1" \
5657 PQ_VER="11.12" \
57- PROTOBUF_VER="29.2" \
5858 SCCACHE_VER="0.9.1" \
5959 CC=musl-gcc \
6060 PREFIX=/musl \
6161 PATH=/usr/local/bin:/root/.cargo/bin:$PATH \
6262 PKG_CONFIG_PATH=/usr/local/lib/pkgconfig \
6363 LD_LIBRARY_PATH=$PREFIX
6464
65- ENV RUSTFLAGS="-C target-feature=+crt-static -L/musl/lib"
66-
67- # Install a more recent release of protoc (protobuf-compiler in jammy is 4 years old and misses some features)
68- RUN cd /tmp && \
69- curl -sSL https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOBUF_VER}/protoc-${PROTOBUF_VER}-linux-x86_64.zip -o protoc.zip && \
70- unzip protoc.zip && \
71- cp bin/protoc /usr/bin/protoc && \
72- rm -rf *
73-
74- # Install prebuilt sccache based on platform
75- RUN curl -sSL https://github.com/mozilla/sccache/releases/download/v${SCCACHE_VER}/sccache-v${SCCACHE_VER}-x86_64-unknown-linux-musl.tar.gz | tar xz && \
76- mv sccache-v${SCCACHE_VER}-*-unknown-linux-musl/sccache /usr/local/bin/ && \
77- chmod +x /usr/local/bin/sccache && \
78- rm -rf sccache-v${SCCACHE_VER}-*-unknown-linux-musl
79-
8065# Set up a prefix for musl build libraries, make the linker's job of finding them easier
8166# Primarily for the benefit of postgres.
8267# Lastly, link some linux-headers for openssl 1.1 (not used herein)
@@ -100,9 +85,20 @@ RUN curl -sSL https://www.openssl.org/source/openssl-$SSL_VER.tar.gz | tar xz &&
10085 cd openssl-$SSL_VER && \
10186 ./Configure no-tests no-shared -fPIC --prefix=$PREFIX --openssldir=$PREFIX/ssl linux-x86_64 && \
10287 env C_INCLUDE_PATH=$PREFIX/include make depend 2> /dev/null && \
103- make -j$(nproc) && make install_sw && \
88+ make -j$(nproc) && make all install_sw && \
10489 cd .. && rm -rf openssl-$SSL_VER
10590
91+ # Build curl (needs with-zlib and all this stuff to allow https)
92+ # curl_LDFLAGS needed on stretch to avoid fPIC errors - though not sure from what
93+ RUN curl -sSL https://curl.se/download/curl-$CURL_VER.tar.gz | tar xz && \
94+ cd curl-$CURL_VER && \
95+ CC="musl-gcc -fPIC -pie" LDFLAGS="-L$PREFIX/lib" CFLAGS="-I$PREFIX/include" ./configure \
96+ --enable-shared=no --with-zlib --enable-static=ssl --enable-optimize --prefix=$PREFIX \
97+ --with-ca-path=/etc/ssl/certs/ --with-ca-bundle=/etc/ssl/certs/ca-certificates.crt --without-ca-fallback \
98+ --with-openssl --without-libpsl && \
99+ make -j$(nproc) curl_LDFLAGS="-all-static" && make install && \
100+ cd .. && rm -rf curl-$CURL_VER \
101+
106102# Build libpq
107103RUN curl -sSL https://ftp.postgresql.org/pub/source/v$PQ_VER/postgresql-$PQ_VER.tar.gz | tar xz && \
108104 cd postgresql-$PQ_VER && \
0 commit comments