Skip to content

Commit 10a7591

Browse files
committed
ci: use musl shared script in dist-various-1 (for arm targets)
Update libunwind to 39. This is necessary to build the arm targets
1 parent ca0499d commit 10a7591

File tree

3 files changed

+66
-171
lines changed

3 files changed

+66
-171
lines changed

src/ci/docker/dist-various-1/Dockerfile

+29-13
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,39 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
2222
libssl-dev \
2323
pkg-config
2424

25-
WORKDIR /tmp
25+
WORKDIR /build
2626

27-
COPY dist-various-1/build-rumprun.sh /tmp/
27+
COPY dist-various-1/build-rumprun.sh /build
2828
RUN ./build-rumprun.sh
2929

30-
COPY dist-various-1/build-arm-musl.sh /tmp/
31-
RUN ./build-arm-musl.sh
30+
COPY dist-various-1/install-x86_64-redox.sh /build
31+
RUN ./install-x86_64-redox.sh
32+
33+
COPY scripts/musl.sh /build
34+
RUN env \
35+
CC=arm-linux-gnueabi-gcc CFLAGS="-march=armv6 -marm" \
36+
CXX=arm-linux-gnueabi-g++ CXXFLAGS="-march=armv6 -marm" \
37+
bash musl.sh arm && \
38+
env \
39+
CC=arm-linux-gnueabihf-gcc CFLAGS="-march=armv6 -marm" \
40+
CXX=arm-linux-gnueabihf-g++ CXXFLAGS="-march=armv6 -marm" \
41+
bash musl.sh armhf && \
42+
env \
43+
CC=arm-linux-gnueabihf-gcc CFLAGS="-march=armv7-a" \
44+
CXX=arm-linux-gnueabihf-g++ CXXFLAGS="-march=armv7-a" \
45+
bash musl.sh armv7 && \
46+
env \
47+
CC=aarch64-linux-gnu-gcc \
48+
CXX=aarch64-linux-gnu-g++ \
49+
bash musl.sh aarch64 && \
50+
rm -rf /build/*
3251

33-
COPY dist-various-1/install-mips-musl.sh /tmp/
52+
COPY dist-various-1/install-mips-musl.sh /build
3453
RUN ./install-mips-musl.sh
3554

36-
COPY dist-various-1/install-mipsel-musl.sh /tmp/
55+
COPY dist-various-1/install-mipsel-musl.sh /build
3756
RUN ./install-mipsel-musl.sh
3857

39-
COPY dist-various-1/install-x86_64-redox.sh /tmp/
40-
RUN ./install-x86_64-redox.sh
41-
4258
ENV TARGETS=asmjs-unknown-emscripten
4359
ENV TARGETS=$TARGETS,wasm32-unknown-emscripten
4460
ENV TARGETS=$TARGETS,x86_64-rumprun-netbsd
@@ -67,10 +83,10 @@ ENV STAGING_DIR=/tmp
6783
ENV RUST_CONFIGURE_ARGS \
6884
--enable-extended \
6985
--target=$TARGETS \
70-
--musl-root-arm=/usr/local/arm-linux-musleabi \
71-
--musl-root-armhf=/usr/local/arm-linux-musleabihf \
72-
--musl-root-armv7=/usr/local/armv7-linux-musleabihf \
73-
--musl-root-aarch64=/usr/local/aarch64-linux-musl
86+
--musl-root-arm=/musl-arm \
87+
--musl-root-armhf=/musl-armhf \
88+
--musl-root-armv7=/musl-armv7 \
89+
--musl-root-aarch64=/musl-aarch64
7490
ENV SCRIPT python2.7 ../x.py dist --target $TARGETS
7591

7692
# sccache

src/ci/docker/dist-various-1/build-arm-musl.sh

-147
This file was deleted.

src/ci/docker/scripts/musl.sh

+37-11
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#!/bin/sh
21
# Copyright 2016 The Rust Project Developers. See the COPYRIGHT
32
# file at the top-level directory of this distribution and at
43
# http://rust-lang.org/COPYRIGHT.
@@ -11,31 +10,58 @@
1110

1211
set -ex
1312

13+
hide_output() {
14+
set +x
15+
on_err="
16+
echo ERROR: An error was encountered with the build.
17+
cat /tmp/build.log
18+
exit 1
19+
"
20+
trap "$on_err" ERR
21+
bash -c "while true; do sleep 30; echo \$(date) - building ...; done" &
22+
PING_LOOP_PID=$!
23+
$@ &> /tmp/build.log
24+
trap - ERR
25+
kill $PING_LOOP_PID
26+
rm /tmp/build.log
27+
set -x
28+
}
29+
1430
TAG=$1
1531
shift
1632

1733
MUSL=musl-1.1.17
18-
curl https://www.musl-libc.org/releases/$MUSL.tar.gz | tar xzf -
34+
35+
# may have been downloaded in a previous run
36+
if [ ! -d $MUSL ]; then
37+
curl https://www.musl-libc.org/releases/$MUSL.tar.gz | tar xzf -
38+
fi
39+
1940
cd $MUSL
2041
./configure --disable-shared --prefix=/musl-$TAG $@
21-
make -j10
22-
make install
42+
hide_output make -j$(nproc)
43+
hide_output make install
44+
hide_output make clean
2345

2446
cd ..
25-
rm -rf $MUSL
2647

27-
# To build MUSL we're going to need a libunwind lying around, so acquire that
28-
# here and build it.
29-
curl -L https://github.com/llvm-mirror/llvm/archive/release_37.tar.gz | tar xzf -
30-
curl -L https://github.com/llvm-mirror/libunwind/archive/release_37.tar.gz | tar xzf -
48+
LLVM=39
49+
# may have been downloaded in a previous run
50+
if [ ! -d libunwind-release_$LLVM ]; then
51+
curl -L https://github.com/llvm-mirror/llvm/archive/release_$LLVM.tar.gz | tar xzf -
52+
curl -L https://github.com/llvm-mirror/libunwind/archive/release_$LLVM.tar.gz | tar xzf -
53+
fi
3154

3255
mkdir libunwind-build
3356
cd libunwind-build
34-
cmake ../libunwind-release_37 -DLLVM_PATH=/build/llvm-release_37 \
57+
cmake ../libunwind-release_$LLVM \
58+
-DLLVM_PATH=/build/llvm-release_$LLVM \
3559
-DLIBUNWIND_ENABLE_SHARED=0 \
3660
-DCMAKE_C_COMPILER=$CC \
3761
-DCMAKE_CXX_COMPILER=$CXX \
3862
-DCMAKE_C_FLAGS="$CFLAGS" \
3963
-DCMAKE_CXX_FLAGS="$CXXFLAGS"
40-
make -j10
64+
65+
hide_output make -j$(nproc)
4166
cp lib/libunwind.a /musl-$TAG/lib
67+
cd ../ && rm -rf libunwind-build

0 commit comments

Comments
 (0)