Skip to content

Commit 320b996

Browse files
committed
build dist for x86_64-unknown-illumos
This change adds the "x86_64-unknown-illumos" host triple to the "dist-various-2" builder and sets things up to build the full set of "dist" packages for illumos hosts so that illumos users can use "rustup" to install packages. It also adjusts the manifest builder to expect complete toolchains for this platform.
1 parent cff9a75 commit 320b996

File tree

4 files changed

+214
-24
lines changed

4 files changed

+214
-24
lines changed

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

+17-8
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ RUN apt-get update && apt-get build-dep -y clang llvm && apt-get install -y --no
2828
RUN apt-key adv --batch --yes --keyserver keyserver.ubuntu.com --recv-keys 74DA7924C5513486
2929
RUN add-apt-repository -y 'deb http://apt.dilos.org/dilos dilos2 main'
3030

31+
COPY scripts/illumos-toolchain.sh /tmp/
32+
RUN bash /tmp/illumos-toolchain.sh x86_64 sysroot
33+
RUN bash /tmp/illumos-toolchain.sh x86_64 binutils
34+
RUN bash /tmp/illumos-toolchain.sh x86_64 gcc
35+
3136
WORKDIR /build
3237
COPY scripts/musl.sh /build
3338
RUN env \
@@ -63,17 +68,19 @@ ENV \
6368
AR_aarch64_fuchsia=aarch64-fuchsia-ar \
6469
CC_aarch64_fuchsia=aarch64-fuchsia-clang \
6570
CXX_aarch64_fuchsia=aarch64-fuchsia-clang++ \
66-
AR_sparcv9_sun_solaris=sparcv9-sun-solaris2.10-ar \
67-
CC_sparcv9_sun_solaris=sparcv9-sun-solaris2.10-gcc \
68-
CXX_sparcv9_sun_solaris=sparcv9-sun-solaris2.10-g++ \
69-
AR_x86_64_sun_solaris=x86_64-sun-solaris2.10-ar \
70-
CC_x86_64_sun_solaris=x86_64-sun-solaris2.10-gcc \
71-
CXX_x86_64_sun_solaris=x86_64-sun-solaris2.10-g++ \
71+
AR_sparcv9_sun_solaris=sparcv9-solaris-ar \
72+
CC_sparcv9_sun_solaris=sparcv9-solaris-gcc \
73+
CXX_sparcv9_sun_solaris=sparcv9-solaris-g++ \
74+
AR_x86_64_sun_solaris=x86_64-solaris-ar \
75+
CC_x86_64_sun_solaris=x86_64-solaris-gcc \
76+
CXX_x86_64_sun_solaris=x86_64-solaris-g++ \
77+
AR_x86_64_unknown_illumos=x86_64-illumos-ar \
78+
CC_x86_64_unknown_illumos=x86_64-illumos-gcc \
79+
CXX_x86_64_unknown_illumos=x86_64-illumos-g++ \
7280
CC_armv7_unknown_linux_gnueabi=arm-linux-gnueabi-gcc-7 \
7381
CXX_armv7_unknown_linux_gnueabi=arm-linux-gnueabi-g++-7 \
7482
CC=gcc-7 \
7583
CXX=g++-7
76-
7784
ENV CARGO_TARGET_X86_64_FUCHSIA_AR /usr/local/bin/llvm-ar
7885
ENV CARGO_TARGET_X86_64_FUCHSIA_RUSTFLAGS \
7986
-C link-arg=--sysroot=/usr/local/x86_64-fuchsia \
@@ -85,6 +92,8 @@ ENV CARGO_TARGET_AARCH64_FUCHSIA_RUSTFLAGS \
8592
-C link-arg=-L/usr/local/aarch64-fuchsia/lib \
8693
-C link-arg=-L/usr/local/lib/aarch64-fuchsia/lib
8794

95+
ENV HOSTS=x86_64-unknown-illumos
96+
8897
ENV TARGETS=x86_64-fuchsia
8998
ENV TARGETS=$TARGETS,aarch64-fuchsia
9099
ENV TARGETS=$TARGETS,wasm32-unknown-unknown
@@ -110,4 +119,4 @@ ENV RUST_CONFIGURE_ARGS --enable-extended --enable-lld --disable-docs \
110119
--set target.wasm32-wasi.wasi-root=/wasm32-wasi \
111120
--musl-root-armv7=/musl-armv7
112121

113-
ENV SCRIPT python3 ../x.py dist --target $TARGETS
122+
ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS,$TARGETS

src/ci/docker/dist-various-2/build-solaris-toolchain.sh

+19-16
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ cd binutils
1616
curl https://ftp.gnu.org/gnu/binutils/binutils-$BINUTILS.tar.xz | tar xJf -
1717
mkdir binutils-build
1818
cd binutils-build
19-
hide_output ../binutils-$BINUTILS/configure --target=$ARCH-sun-solaris2.10
19+
hide_output ../binutils-$BINUTILS/configure \
20+
--target=$ARCH-sun-solaris2.10 \
21+
--program-prefix="$ARCH-solaris-"
2022
hide_output make -j10
2123
hide_output make install
2224

@@ -74,21 +76,22 @@ cd gcc-$GCC
7476

7577
mkdir ../gcc-build
7678
cd ../gcc-build
77-
hide_output ../gcc-$GCC/configure \
78-
--enable-languages=c,c++ \
79-
--target=$ARCH-sun-solaris2.10 \
80-
--with-gnu-as \
81-
--with-gnu-ld \
82-
--disable-multilib \
83-
--disable-nls \
84-
--disable-libgomp \
85-
--disable-libquadmath \
86-
--disable-libssp \
87-
--disable-libvtv \
88-
--disable-libcilkrts \
89-
--disable-libada \
90-
--disable-libsanitizer \
91-
--disable-libquadmath-support \
79+
hide_output ../gcc-$GCC/configure \
80+
--enable-languages=c,c++ \
81+
--target=$ARCH-sun-solaris2.10 \
82+
--program-prefix="$ARCH-solaris-" \
83+
--with-gnu-as \
84+
--with-gnu-ld \
85+
--disable-multilib \
86+
--disable-nls \
87+
--disable-libgomp \
88+
--disable-libquadmath \
89+
--disable-libssp \
90+
--disable-libvtv \
91+
--disable-libcilkrts \
92+
--disable-libada \
93+
--disable-libsanitizer \
94+
--disable-libquadmath-support \
9295
--disable-lto
9396

9497
hide_output make -j10
+177
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
#!/bin/bash
2+
3+
set -o errexit
4+
set -o pipefail
5+
set -o xtrace
6+
7+
ARCH="$1"
8+
PHASE="$2"
9+
10+
JOBS="$(getconf _NPROCESSORS_ONLN)"
11+
12+
case "$ARCH" in
13+
x86_64)
14+
SYSROOT_MACH='i386'
15+
;;
16+
*)
17+
printf 'ERROR: unknown architecture: %s\n' "$ARCH"
18+
exit 1
19+
esac
20+
21+
BUILD_TARGET="$ARCH-sun-solaris2.10"
22+
23+
#
24+
# The illumos and the Solaris build both use the same GCC-level host triple,
25+
# though different versions of GCC are used and with different configure
26+
# options. To ensure as little accidental cross-pollination as possible, we
27+
# build the illumos toolchain in a specific directory tree and just symlink the
28+
# expected tools into /usr/local/bin at the end. We omit /usr/local/bin from
29+
# PATH here for similar reasons.
30+
#
31+
PREFIX="/opt/illumos/$ARCH"
32+
export PATH="$PREFIX/bin:/usr/bin:/bin:/usr/sbin:/sbin"
33+
34+
#
35+
# NOTE: The compiler version selected here is more specific than might appear.
36+
# GCC 7.X releases do not appear to cross-compile correctly for Solaris
37+
# targets, at least insofar as they refuse to enable TLS in libstdc++. When
38+
# changing the GCC version in future, one must carefully verify that TLS is
39+
# enabled in all of the static libraries we intend to include in output
40+
# binaries.
41+
#
42+
GCC_VERSION='8.4.0'
43+
GCC_MD5='bb815a8e3b7be43c4a26fa89dbbd9795'
44+
GCC_BASE="gcc-$GCC_VERSION"
45+
GCC_TAR="gcc-$GCC_VERSION.tar.xz"
46+
GCC_URL="https://ftp.gnu.org/gnu/gcc/$GCC_BASE/$GCC_TAR"
47+
48+
SYSROOT_VER='20181213-de6af22ae73b-v1'
49+
SYSROOT_MD5='23462f7f5297f390803d27c424c32ad6'
50+
SYSROOT_TAR="illumos-sysroot-$SYSROOT_MACH-$SYSROOT_VER.tar.gz"
51+
SYSROOT_URL='https://github.com/illumos/sysroot/releases/download/'
52+
SYSROOT_URL+="$SYSROOT_VER/$SYSROOT_TAR"
53+
SYSROOT_DIR="$PREFIX/sysroot"
54+
55+
BINUTILS_VERSION='2.25.1'
56+
BINUTILS_MD5='ac493a78de4fee895961d025b7905be4'
57+
BINUTILS_BASE="binutils-$BINUTILS_VERSION"
58+
BINUTILS_TAR="$BINUTILS_BASE.tar.bz2"
59+
BINUTILS_URL="https://ftp.gnu.org/gnu/binutils/$BINUTILS_TAR"
60+
61+
62+
download_file() {
63+
local file="$1"
64+
local url="$2"
65+
local md5="$3"
66+
67+
while :; do
68+
if [[ -f "$file" ]]; then
69+
if ! h="$(md5sum "$file" | awk '{ print $1 }')"; then
70+
printf 'ERROR: reading hash\n' >&2
71+
exit 1
72+
fi
73+
74+
if [[ "$h" == "$md5" ]]; then
75+
return 0
76+
fi
77+
78+
printf 'WARNING: hash mismatch: %s != expected %s\n' \
79+
"$h" "$md5" >&2
80+
rm -f "$file"
81+
fi
82+
83+
printf 'Downloading: %s\n' "$url"
84+
if ! curl -f -L -o "$file" "$url"; then
85+
rm -f "$file"
86+
sleep 1
87+
fi
88+
done
89+
}
90+
91+
92+
case "$PHASE" in
93+
sysroot)
94+
download_file "/tmp/$SYSROOT_TAR" "$SYSROOT_URL" "$SYSROOT_MD5"
95+
mkdir -p "$SYSROOT_DIR"
96+
cd "$SYSROOT_DIR"
97+
tar -xzf "/tmp/$SYSROOT_TAR"
98+
rm -f "/tmp/$SYSROOT_TAR"
99+
;;
100+
101+
binutils)
102+
download_file "/tmp/$BINUTILS_TAR" "$BINUTILS_URL" "$BINUTILS_MD5"
103+
mkdir -p /ws/src/binutils
104+
cd /ws/src/binutils
105+
tar -xjf "/tmp/$BINUTILS_TAR"
106+
rm -f "/tmp/$BINUTILS_TAR"
107+
108+
mkdir -p /ws/build/binutils
109+
cd /ws/build/binutils
110+
"/ws/src/binutils/$BINUTILS_BASE/configure" \
111+
--prefix="$PREFIX" \
112+
--target="$BUILD_TARGET" \
113+
--program-prefix="$ARCH-illumos-" \
114+
--with-sysroot="$SYSROOT_DIR"
115+
116+
make -j "$JOBS"
117+
118+
mkdir -p "$PREFIX"
119+
make install
120+
121+
cd /
122+
rm -rf /ws/src/binutils /ws/build/binutils
123+
;;
124+
125+
gcc)
126+
download_file "/tmp/$GCC_TAR" "$GCC_URL" "$GCC_MD5"
127+
mkdir -p /ws/src/gcc
128+
cd /ws/src/gcc
129+
tar -xJf "/tmp/$GCC_TAR"
130+
rm -f "/tmp/$GCC_TAR"
131+
132+
mkdir -p /ws/build/gcc
133+
cd /ws/build/gcc
134+
export CFLAGS='-fPIC'
135+
export CXXFLAGS='-fPIC'
136+
export CXXFLAGS_FOR_TARGET='-fPIC'
137+
export CFLAGS_FOR_TARGET='-fPIC'
138+
"/ws/src/gcc/$GCC_BASE/configure" \
139+
--prefix="$PREFIX" \
140+
--target="$BUILD_TARGET" \
141+
--program-prefix="$ARCH-illumos-" \
142+
--with-sysroot="$SYSROOT_DIR" \
143+
--with-gnu-as \
144+
--with-gnu-ld \
145+
--disable-nls \
146+
--disable-libgomp \
147+
--disable-libquadmath \
148+
--disable-libssp \
149+
--disable-libvtv \
150+
--disable-libcilkrts \
151+
--disable-libada \
152+
--disable-libsanitizer \
153+
--disable-libquadmath-support \
154+
--disable-shared \
155+
--enable-tls
156+
157+
make -j "$JOBS"
158+
159+
mkdir -p "$PREFIX"
160+
make install
161+
162+
#
163+
# Link toolchain commands into /usr/local/bin so that cmake and others
164+
# can find them:
165+
#
166+
(cd "$PREFIX/bin" && ls -U) | grep "^$ARCH-illumos-" |
167+
xargs -t -I% ln -s "$PREFIX/bin/%" '/usr/local/bin/'
168+
169+
cd /
170+
rm -rf /ws/src/gcc /ws/build/gcc
171+
;;
172+
173+
*)
174+
printf 'ERROR: unknown phase "%s"\n' "$PHASE" >&2
175+
exit 100
176+
;;
177+
esac

src/tools/build-manifest/src/main.rs

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ static HOSTS: &[&str] = &[
4242
"x86_64-pc-windows-gnu",
4343
"x86_64-pc-windows-msvc",
4444
"x86_64-unknown-freebsd",
45+
"x86_64-unknown-illumos",
4546
"x86_64-unknown-linux-gnu",
4647
"x86_64-unknown-linux-musl",
4748
"x86_64-unknown-netbsd",

0 commit comments

Comments
 (0)