]> git.proxmox.com Git - rustc.git/blob - src/ci/docker/host-x86_64/dist-various-2/build-solaris-toolchain.sh
New upstream version 1.68.2+dfsg1
[rustc.git] / src / ci / docker / host-x86_64 / dist-various-2 / build-solaris-toolchain.sh
1 #!/usr/bin/env bash
2
3 set -ex
4 source shared.sh
5
6 ARCH=$1
7 LIB_ARCH=$2
8 APT_ARCH=$3
9 MANUFACTURER=$4
10 BINUTILS=2.28.1
11 GCC=6.5.0
12
13 TARGET=${ARCH}-${MANUFACTURER}-solaris2.10
14
15 # First up, build binutils
16 mkdir binutils
17 cd binutils
18
19 curl https://ftp.gnu.org/gnu/binutils/binutils-$BINUTILS.tar.xz | tar xJf -
20 mkdir binutils-build
21 cd binutils-build
22 hide_output ../binutils-$BINUTILS/configure --target=$TARGET
23 hide_output make -j10
24 hide_output make install
25
26 cd ../..
27 rm -rf binutils
28
29 # Next, download and install the relevant solaris packages
30 mkdir solaris
31 cd solaris
32
33 dpkg --add-architecture $APT_ARCH
34 apt-get update
35 apt-get install -y --download-only \
36 libc:$APT_ARCH \
37 liblgrp:$APT_ARCH \
38 libm-dev:$APT_ARCH \
39 libpthread:$APT_ARCH \
40 libresolv:$APT_ARCH \
41 librt:$APT_ARCH \
42 libsendfile:$APT_ARCH \
43 libsocket:$APT_ARCH \
44 system-crt:$APT_ARCH \
45 system-header:$APT_ARCH
46
47 for deb in /var/cache/apt/archives/*$APT_ARCH.deb; do
48 dpkg -x $deb .
49 done
50 apt-get clean
51
52 # The -dev packages are not available from the apt repository we're using.
53 # However, those packages are just symlinks from *.so to *.so.<version>.
54 # This makes all those symlinks.
55 for lib in $(find -name '*.so.*'); do
56 target=${lib%.so.*}.so
57 [ -e $target ] || ln -s ${lib##*/} $target
58 done
59
60 # Remove Solaris 11 functions that are optionally used by libbacktrace.
61 # This is for Solaris 10 compatibility.
62 rm usr/include/link.h
63 patch -p0 << 'EOF'
64 --- usr/include/string.h
65 +++ usr/include/string10.h
66 @@ -93 +92,0 @@
67 -extern size_t strnlen(const char *, size_t);
68 EOF
69
70 mkdir /usr/local/$TARGET/usr
71 mv usr/include /usr/local/$TARGET/usr/include
72 mv usr/lib/$LIB_ARCH/* /usr/local/$TARGET/lib
73 mv lib/$LIB_ARCH/* /usr/local/$TARGET/lib
74
75 ln -s usr/include /usr/local/$TARGET/sys-include
76 ln -s usr/include /usr/local/$TARGET/include
77
78 cd ..
79 rm -rf solaris
80
81 # Finally, download and build gcc to target solaris
82 mkdir gcc
83 cd gcc
84
85 curl https://ftp.gnu.org/gnu/gcc/gcc-$GCC/gcc-$GCC.tar.xz | tar xJf -
86 cd gcc-$GCC
87
88 mkdir ../gcc-build
89 cd ../gcc-build
90 hide_output ../gcc-$GCC/configure \
91 --enable-languages=c,c++ \
92 --target=$TARGET \
93 --with-gnu-as \
94 --with-gnu-ld \
95 --disable-multilib \
96 --disable-nls \
97 --disable-libgomp \
98 --disable-libquadmath \
99 --disable-libssp \
100 --disable-libvtv \
101 --disable-libcilkrts \
102 --disable-libada \
103 --disable-libsanitizer \
104 --disable-libquadmath-support \
105 --disable-lto
106
107 hide_output make -j10
108 hide_output make install
109
110 cd ../..
111 rm -rf gcc