]> git.proxmox.com Git - rustc.git/blame - 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
CommitLineData
abe05a73 1#!/usr/bin/env bash
ea8adc8c
XL
2
3set -ex
4source shared.sh
5
6ARCH=$1
7LIB_ARCH=$2
8APT_ARCH=$3
cdc7bbd5 9MANUFACTURER=$4
ea8adc8c 10BINUTILS=2.28.1
5869c6ff 11GCC=6.5.0
ea8adc8c 12
cdc7bbd5 13TARGET=${ARCH}-${MANUFACTURER}-solaris2.10
6a06907d 14
ea8adc8c
XL
15# First up, build binutils
16mkdir binutils
17cd binutils
18
19curl https://ftp.gnu.org/gnu/binutils/binutils-$BINUTILS.tar.xz | tar xJf -
20mkdir binutils-build
21cd binutils-build
6a06907d 22hide_output ../binutils-$BINUTILS/configure --target=$TARGET
ea8adc8c
XL
23hide_output make -j10
24hide_output make install
25
26cd ../..
27rm -rf binutils
28
29# Next, download and install the relevant solaris packages
30mkdir solaris
31cd solaris
32
33dpkg --add-architecture $APT_ARCH
34apt-get update
f25598a0 35apt-get install -y --download-only \
ee023bcb 36 libc:$APT_ARCH \
ee023bcb
FG
37 liblgrp:$APT_ARCH \
38 libm-dev:$APT_ARCH \
39 libpthread:$APT_ARCH \
40 libresolv:$APT_ARCH \
41 librt:$APT_ARCH \
ee023bcb
FG
42 libsendfile:$APT_ARCH \
43 libsocket:$APT_ARCH \
44 system-crt:$APT_ARCH \
f25598a0 45 system-header:$APT_ARCH
ea8adc8c 46
f25598a0 47for deb in /var/cache/apt/archives/*$APT_ARCH.deb; do
ea8adc8c
XL
48 dpkg -x $deb .
49done
f25598a0 50apt-get clean
ea8adc8c 51
fc512014
XL
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.
55for lib in $(find -name '*.so.*'); do
56 target=${lib%.so.*}.so
57 [ -e $target ] || ln -s ${lib##*/} $target
58done
59
ea8adc8c
XL
60# Remove Solaris 11 functions that are optionally used by libbacktrace.
61# This is for Solaris 10 compatibility.
62rm usr/include/link.h
63patch -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);
68EOF
69
6a06907d
XL
70mkdir /usr/local/$TARGET/usr
71mv usr/include /usr/local/$TARGET/usr/include
72mv usr/lib/$LIB_ARCH/* /usr/local/$TARGET/lib
73mv lib/$LIB_ARCH/* /usr/local/$TARGET/lib
ea8adc8c 74
6a06907d
XL
75ln -s usr/include /usr/local/$TARGET/sys-include
76ln -s usr/include /usr/local/$TARGET/include
ea8adc8c
XL
77
78cd ..
79rm -rf solaris
80
81# Finally, download and build gcc to target solaris
82mkdir gcc
83cd gcc
84
85curl https://ftp.gnu.org/gnu/gcc/gcc-$GCC/gcc-$GCC.tar.xz | tar xJf -
86cd gcc-$GCC
87
88mkdir ../gcc-build
89cd ../gcc-build
90hide_output ../gcc-$GCC/configure \
91 --enable-languages=c,c++ \
6a06907d 92 --target=$TARGET \
ea8adc8c
XL
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
107hide_output make -j10
108hide_output make install
109
110cd ../..
111rm -rf gcc