13 TARGET=${ARCH}-${MANUFACTURER}-solaris2.10
15 # First up, build binutils
19 curl https://ftp.gnu.org/gnu/binutils/binutils-$BINUTILS.tar.xz | tar xJf -
22 hide_output ../binutils-$BINUTILS/configure --target=$TARGET
24 hide_output make install
29 # Next, download and install the relevant solaris packages
33 dpkg --add-architecture $APT_ARCH
35 apt-get download $(apt-cache depends --recurse --no-replaces \
37 liblgrp-dev:$APT_ARCH \
40 libpthread:$APT_ARCH \
43 libsendfile-dev:$APT_ARCH \
44 libsendfile:$APT_ARCH \
46 system-crt:$APT_ARCH \
47 system-header:$APT_ARCH \
50 for deb in *$APT_ARCH.deb; do
54 # The -dev packages are not available from the apt repository we're using.
55 # However, those packages are just symlinks from *.so to *.so.<version>.
56 # This makes all those symlinks.
57 for lib in $(find -name '*.so.*'); do
58 target=${lib%.so.*}.so
59 [ -e $target ] || ln -s ${lib##*/} $target
62 # Remove Solaris 11 functions that are optionally used by libbacktrace.
63 # This is for Solaris 10 compatibility.
66 --- usr/include/string.h
67 +++ usr/include/string10.h
69 -extern size_t strnlen(const char *, size_t);
72 mkdir /usr/local/$TARGET/usr
73 mv usr/include /usr/local/$TARGET/usr/include
74 mv usr/lib/$LIB_ARCH/* /usr/local/$TARGET/lib
75 mv lib/$LIB_ARCH/* /usr/local/$TARGET/lib
77 ln -s usr/include /usr/local/$TARGET/sys-include
78 ln -s usr/include /usr/local/$TARGET/include
83 # Finally, download and build gcc to target solaris
87 curl https://ftp.gnu.org/gnu/gcc/gcc-$GCC/gcc-$GCC.tar.xz | tar xJf -
92 hide_output ../gcc-$GCC/configure \
93 --enable-languages=c,c++ \
100 --disable-libquadmath \
103 --disable-libcilkrts \
105 --disable-libsanitizer \
106 --disable-libquadmath-support \
109 hide_output make -j10
110 hide_output make install