Skip to content

Commit f157ed9

Browse files
committed
refactor: Mac OS X SDK 10.15, openssl 1.1.1h and libpq 13.1
1 parent b4b1d37 commit f157ed9

File tree

3 files changed

+43
-28
lines changed

3 files changed

+43
-28
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@
77
**/*.iml
88
**/.idea
99
.vscode
10+
**/.DS_Store
11+
tarballs

docker/Dockerfile

+39-26
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,22 @@ ARG TOOLCHAIN=stable
1212
# Dependencies
1313

1414
# OpenSSL v1.1.1
15-
ARG OPENSSL_VERSION=1.1.1g
15+
# https://www.openssl.org/source/old/1.1.1/
16+
ARG OPENSSL_VERSION=1.1.1h
1617

1718
# zlib - http://zlib.net/
1819
ARG ZLIB_VERSION=1.2.11
1920

2021
# libpq - https://ftp.postgresql.org/pub/source/
21-
ARG POSTGRESQL_VERSION=11.10
22+
ARG POSTGRESQL_VERSION=13.1
2223

23-
# Mac OS X SDK version for OS X Cross
24-
ARG MACOSX_SDK_VERSION=10.11
24+
# Mac OS X SDK version
25+
ARG OSX_SDK_VERSION=10.15
26+
ARG OSX_SDK_SUM=aee7b132a4b10cc26ab9904706412fd0907f5b8b660251e465647d8763f9f009
2527

28+
# OS X Cross
29+
ARG OSX_CROSS_COMMIT=4287300a5c96397a2ee9ab3942e66578a1982031
30+
ARG OSX_VERSION_MIN=10.14
2631

2732
# Make sure we have basic dev tools for building C libraries. Our goal
2833
# here is to support the musl-libc builds and Cargo builds needed for a
@@ -54,15 +59,15 @@ RUN set -eux \
5459
python \
5560
xutils-dev \
5661
zlib1g-dev \
57-
# Clean up local repository of retrieved packages and remove the package lists
62+
# Clean up local repository of retrieved packages and remove the package lists
5863
&& apt-get clean \
5964
&& rm -rf /var/lib/apt/lists/* \
6065
&& true
6166

6267
# Static linking for C++ code
6368
RUN set -eux \
6469
&& ln -s "/usr/bin/g++" "/usr/bin/musl-g++" \
65-
# Create appropriate directories for current user
70+
# Create appropriate directories for current user
6671
&& mkdir -p /root/libs /root/src \
6772
&& true
6873

@@ -89,24 +94,24 @@ RUN set -eux \
8994
&& git config --global credential.https://github.com.helper ghtoken \
9095
&& true
9196

92-
# Build a static library version of OpenSSL using musl-libc. This is needed by
97+
# Build a static library version of OpenSSL using musl-libc. This is needed by
9398
# the popular Rust `hyper` crate.
9499
#
95100
# We point /usr/local/musl/include/linux at some Linux kernel headers (not
96101
# necessarily the right ones) in an effort to compile OpenSSL 1.1's "engine"
97102
# component. It's possible that this will cause bizarre and terrible things to
98103
# happen. There may be "sanitized" header
99104
RUN set -eux \
100-
&& echo "Building OpenSSL..." \
105+
&& echo "Building OpenSSL ${OPENSSL_VERSION}..." \
101106
&& ls /usr/include/linux \
102107
&& mkdir -p /usr/local/musl/include \
103108
&& ln -s /usr/include/linux /usr/local/musl/include/linux \
104109
&& ln -s /usr/include/x86_64-linux-gnu/asm /usr/local/musl/include/asm \
105110
&& ln -s /usr/include/asm-generic /usr/local/musl/include/asm-generic \
106111
&& cd /tmp \
107-
&& curl -LO "https://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz" \
108-
&& tar xvzf "openssl-$OPENSSL_VERSION.tar.gz" \
109-
&& cd "openssl-$OPENSSL_VERSION" \
112+
&& curl -LO "https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz" \
113+
&& tar xvzf "openssl-${OPENSSL_VERSION}.tar.gz" \
114+
&& cd "openssl-${OPENSSL_VERSION}" \
110115
&& env CC=musl-gcc ./Configure no-shared no-zlib -fPIC --prefix=/usr/local/musl -DOPENSSL_NO_SECURE_MEMORY linux-x86_64 \
111116
&& env C_INCLUDE_PATH=/usr/local/musl/include/ make depend \
112117
&& env C_INCLUDE_PATH=/usr/local/musl/include/ make \
@@ -117,23 +122,23 @@ RUN set -eux \
117122
&& true
118123

119124
RUN set -eux \
120-
&& echo "Building zlib..." \
125+
&& echo "Building zlib ${ZLIB_VERSION}..." \
121126
&& cd /tmp \
122-
&& curl -LO "http://zlib.net/zlib-$ZLIB_VERSION.tar.gz" \
123-
&& tar xzf "zlib-$ZLIB_VERSION.tar.gz" \
124-
&& cd "zlib-$ZLIB_VERSION" \
127+
&& curl -LO "http://zlib.net/zlib-${ZLIB_VERSION}.tar.gz" \
128+
&& tar xzf "zlib-${ZLIB_VERSION}.tar.gz" \
129+
&& cd "zlib-${ZLIB_VERSION}" \
125130
&& env CC=musl-gcc ./configure --static --prefix=/usr/local/musl \
126131
&& make \
127132
&& make install \
128133
&& rm -r /tmp/* \
129134
&& true
130135

131136
RUN set -eux \
132-
&& echo "Building libpq..." \
137+
&& echo "Building libpq ${POSTGRESQL_VERSION}..." \
133138
&& cd /tmp \
134-
&& curl -LO "https://ftp.postgresql.org/pub/source/v$POSTGRESQL_VERSION/postgresql-$POSTGRESQL_VERSION.tar.gz" \
135-
&& tar xzf "postgresql-$POSTGRESQL_VERSION.tar.gz" \
136-
&& cd "postgresql-$POSTGRESQL_VERSION" \
139+
&& curl -LO "https://ftp.postgresql.org/pub/source/v${POSTGRESQL_VERSION}/postgresql-${POSTGRESQL_VERSION}.tar.gz" \
140+
&& tar xzf "postgresql-${POSTGRESQL_VERSION}.tar.gz" \
141+
&& cd "postgresql-${POSTGRESQL_VERSION}" \
137142
&& env CC=musl-gcc CPPFLAGS=-I/usr/local/musl/include LDFLAGS=-L/usr/local/musl/lib ./configure --with-openssl --without-readline --prefix=/usr/local/musl \
138143
&& cd src/interfaces/libpq \
139144
&& make all-static-lib \
@@ -162,13 +167,21 @@ ENV X86_64_UNKNOWN_LINUX_MUSL_OPENSSL_DIR=/usr/local/musl/ \
162167
# A Mac OS X cross toolchain for Linux, FreeBSD, OpenBSD and Android
163168

164169
RUN set -eux \
165-
&& echo "Building osxcross..." \
166-
&& cd /usr/local/ \
167-
&& git clone --depth 1 https://github.com/tpoechtrager/osxcross \
168-
&& cd osxcross \
169-
&& curl -L -o "./tarballs/MacOSX$MACOSX_SDK_VERSION.sdk.tar.xz" \
170-
"https://s3.amazonaws.com/andrew-osx-sdks/MacOSX$MACOSX_SDK_VERSION.sdk.tar.xz" \
171-
&& env UNATTENDED=yes OSX_VERSION_MIN=10.7 ./build.sh \
170+
&& echo "Cloning osxcross..." \
171+
&& git clone https://github.com/tpoechtrager/osxcross.git /usr/local/osxcross \
172+
&& cd /usr/local/osxcross \
173+
&& git checkout -q "${OSX_CROSS_COMMIT}" \
174+
&& rm -rf ./.git \
175+
&& true
176+
177+
RUN set -eux \
178+
&& echo "Building osxcross with ${OSX_SDK_VERSION}..." \
179+
&& cd /usr/local/osxcross \
180+
&& curl -Lo "./tarballs/MacOSX${OSX_SDK_VERSION}.sdk.tar.xz" \
181+
"https://github.com/joseluisq/macosx-sdks/releases/download/${OSX_SDK_VERSION}/MacOSX${OSX_SDK_VERSION}.sdk.tar.xz" \
182+
&& echo "${OSX_SDK_SUM} ./tarballs/MacOSX${OSX_SDK_VERSION}.sdk.tar.xz" \
183+
| sha256sum -c - \
184+
&& env UNATTENDED=yes OSX_VERSION_MIN=${OSX_VERSION_MIN} ./build.sh \
172185
&& rm -rf *~ taballs *.tar.xz \
173186
&& rm -rf /tmp/* \
174187
&& true

docker/cargo-config.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ target = "x86_64-unknown-linux-musl"
66
linker = "arm-linux-gnueabihf-gcc"
77

88
[target.x86_64-apple-darwin]
9-
linker = "x86_64-apple-darwin15-clang"
10-
ar = "x86_64-apple-darwin15-ar"
9+
linker = "x86_64-apple-darwin19-clang"
10+
ar = "x86_64-apple-darwin19-ar"

0 commit comments

Comments
 (0)