Skip to content

Commit f4984d6

Browse files
committed
Separate libs into their own RUNs
Since there is clean up at each step, there is not much overhead, but it with debugging. Also: - Add LD=$TARGET-ld The HF targets seem to be happier with it. - Organize env vars and dedupe hardcoded paths
1 parent c7c431c commit f4984d6

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

Dockerfile

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ RUN mkdir -p /home/rust/libs /home/rust/src
5151
ENV PATH=/root/.cargo/bin:/usr/local/musl/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
5252
ENV TARGET_CC=$TARGET-gcc
5353
ENV TARGET_CXX=$TARGET-g++
54-
ENV TARGET_C_INCLUDE_PATH=/usr/local/musl/$TARGET/include/
54+
ENV TARGET_HOME=/usr/local/musl/$TARGET
55+
ENV TARGET_C_INCLUDE_PATH=$TARGET_HOME/include/
5556

5657
# Install our Rust toolchain and the `musl` target. We patch the
5758
# command-line we pass to the installer so that it won't attempt to
@@ -81,25 +82,29 @@ RUN export CC=$TARGET_CC && \
8182
echo "$CHECKSUM zlib-$VERS.tar.gz" > checksums.txt && \
8283
sha256sum -c checksums.txt && \
8384
tar xzf zlib-$VERS.tar.gz && cd zlib-$VERS && \
84-
./configure --static --archs="-fPIC" --prefix=/usr/local/musl/$TARGET && \
85+
./configure --static --archs="-fPIC" --prefix=$TARGET_HOME && \
8586
make && sudo make install -j 4 && \
86-
cd .. && rm -rf zlib-$VERS.tar.gz zlib-$VERS checksums.txt && \
87+
cd .. && rm -rf zlib-$VERS.tar.gz zlib-$VERS checksums.txt
88+
89+
RUN export CC=$TARGET_CC && \
90+
export C_INCLUDE_PATH=$TARGET_C_INCLUDE_PATH && \
91+
export LD=$TARGET-ld && \
8792
echo "Building OpenSSL" && \
8893
VERS=1.0.2u && \
8994
CHECKSUM=ecd0c6ffb493dd06707d38b14bb4d8c2288bb7033735606569d8f90f89669d16 && \
9095
curl -sqO https://www.openssl.org/source/openssl-$VERS.tar.gz && \
9196
echo "$CHECKSUM openssl-$VERS.tar.gz" > checksums.txt && \
9297
sha256sum -c checksums.txt && \
9398
tar xzf openssl-$VERS.tar.gz && cd openssl-$VERS && \
94-
./Configure $OPENSSL_ARCH -fPIC --prefix=/usr/local/musl/$TARGET && \
99+
./Configure $OPENSSL_ARCH -fPIC --prefix=$TARGET_HOME && \
95100
make depend && \
96101
make && sudo make install -j 4 && \
97102
cd .. && rm -rf openssl-$VERS.tar.gz openssl-$VERS checksums.txt
98103

99-
ENV OPENSSL_DIR=/usr/local/musl/$TARGET/ \
100-
OPENSSL_INCLUDE_DIR=/usr/local/musl/$TARGET/include/ \
101-
DEP_OPENSSL_INCLUDE=/usr/local/musl/$TARGET/include/ \
102-
OPENSSL_LIB_DIR=/usr/local/musl/$TARGET/lib/ \
104+
ENV OPENSSL_DIR=$TARGET_HOME/ \
105+
OPENSSL_INCLUDE_DIR=$TARGET_HOME/include/ \
106+
DEP_OPENSSL_INCLUDE=$TARGET_HOME/include/ \
107+
OPENSSL_LIB_DIR=$TARGET_HOME/lib/ \
103108
OPENSSL_STATIC=1
104109

105110
# Remove docs and more stuff not needed in this images to make them smaller

0 commit comments

Comments
 (0)