]> git.lizzy.rs Git - rust.git/blob - src/ci/docker/scripts/musl.sh
Rollup merge of #106144 - tgross35:patch-1, r=Mark-Simulacrum
[rust.git] / src / ci / docker / scripts / musl.sh
1 #!/bin/sh
2 set -ex
3
4 hide_output() {
5   set +x
6   on_err="
7 echo ERROR: An error was encountered with the build.
8 cat /tmp/build.log
9 exit 1
10 "
11   trap "$on_err" ERR
12   bash -c "while true; do sleep 30; echo \$(date) - building ...; done" &
13   PING_LOOP_PID=$!
14   "$@" &> /tmp/build.log
15   trap - ERR
16   kill $PING_LOOP_PID
17   rm /tmp/build.log
18   set -x
19 }
20
21 TAG=$1
22 shift
23
24 # Ancient binutils versions don't understand debug symbols produced by more recent tools.
25 # Apparently applying `-fPIC` everywhere allows them to link successfully.
26 export CFLAGS="-fPIC $CFLAGS"
27
28 MUSL=musl-1.1.24
29
30 # may have been downloaded in a previous run
31 if [ ! -d $MUSL ]; then
32   curl https://www.musl-libc.org/releases/$MUSL.tar.gz | tar xzf -
33 fi
34
35 cd $MUSL
36 ./configure --enable-debug --disable-shared --prefix=/musl-$TAG "$@"
37 if [ "$TAG" = "i586" -o "$TAG" = "i686" ]; then
38   hide_output make -j$(nproc) AR=ar RANLIB=ranlib
39 else
40   hide_output make -j$(nproc)
41 fi
42 hide_output make install
43 hide_output make clean