Skip to content

Commit 092af47

Browse files
committed
build dist for x86_64-unknown-illumos
This change creates a new Docker image, "dist-x86_64-illumos", 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 092af47

File tree

6 files changed

+191
-0
lines changed

6 files changed

+191
-0
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,7 @@ jobs:
330330
- dist-x86_64-apple
331331
- dist-x86_64-apple-alt
332332
- dist-x86_64-freebsd
333+
- dist-x86_64-illumos
333334
- dist-x86_64-linux
334335
- dist-x86_64-linux-alt
335336
- dist-x86_64-mingw
@@ -426,6 +427,9 @@ jobs:
426427
- name: dist-x86_64-freebsd
427428
os: ubuntu-latest-xl
428429
env: {}
430+
- name: dist-x86_64-illumos
431+
os: ubuntu-latest-xl
432+
env: {}
429433
- name: dist-x86_64-linux
430434
os: ubuntu-latest-xl
431435
env: {}

src/ci/azure-pipelines/auto.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ jobs:
5555
dist-powerpc64le-linux: {}
5656
dist-s390x-linux: {}
5757
dist-x86_64-freebsd: {}
58+
dist-x86_64-illumos: {}
5859
dist-x86_64-musl: {}
5960
dist-x86_64-netbsd: {}
6061
i686-gnu: {}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
FROM ubuntu:18.04
2+
3+
# Enable source repositories, which are disabled by default on Ubuntu >= 18.04
4+
RUN sed -i 's/^# deb-src/deb-src/' /etc/apt/sources.list
5+
6+
COPY scripts/cross-apt-packages.sh /tmp/
7+
RUN bash /tmp/cross-apt-packages.sh
8+
9+
# Required for cross-build gcc
10+
RUN apt-get update && \
11+
apt-get install -y --no-install-recommends \
12+
libgmp-dev \
13+
libmpfr-dev \
14+
libmpc-dev
15+
16+
COPY scripts/illumos-toolchain.sh /tmp/
17+
18+
RUN bash /tmp/illumos-toolchain.sh x86_64 sysroot
19+
RUN bash /tmp/illumos-toolchain.sh x86_64 binutils
20+
RUN bash /tmp/illumos-toolchain.sh x86_64 gcc
21+
22+
COPY scripts/sccache.sh /scripts/
23+
RUN sh /scripts/sccache.sh
24+
25+
ENV \
26+
AR_x86_64_unknown_illumos=x86_64-sun-solaris2.10-ar \
27+
CC_x86_64_unknown_illumos=x86_64-sun-solaris2.10-gcc \
28+
CXX_x86_64_unknown_illumos=x86_64-sun-solaris2.10-g++
29+
30+
ENV HOSTS=x86_64-unknown-illumos
31+
32+
ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
33+
ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS
Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
#!/bin/bash
2+
3+
set -o errexit
4+
set -o pipefail
5+
set -o xtrace
6+
7+
JOBS="$(getconf _NPROCESSORS_ONLN)"
8+
9+
case "$1" in
10+
x86_64)
11+
SYSROOT_MACH='i386'
12+
;;
13+
*)
14+
printf 'ERROR: unknown architecture: %s\n' "$1"
15+
exit 1
16+
esac
17+
18+
BUILD_TARGET="$1-sun-solaris2.10"
19+
20+
#
21+
# NOTE: The compiler version selected here is more specific than might appear.
22+
# GCC 7.X releases do not appear to cross-compile correctly for Solaris
23+
# targets, at least insofar as they refuse to enable TLS in libstdc++. When
24+
# changing the GCC version in future, one must carefully verify that TLS is
25+
# enabled in all of the static libraries we intend to include in output
26+
# binaries.
27+
#
28+
GCC_VERSION='8.4.0'
29+
GCC_MD5='bb815a8e3b7be43c4a26fa89dbbd9795'
30+
GCC_BASE="gcc-$GCC_VERSION"
31+
GCC_TAR="gcc-$GCC_VERSION.tar.xz"
32+
GCC_URL="https://ftp.gnu.org/gnu/gcc/$GCC_BASE/$GCC_TAR"
33+
34+
SYSROOT_VER='20181213-de6af22ae73b-v1'
35+
SYSROOT_MD5='23462f7f5297f390803d27c424c32ad6'
36+
SYSROOT_TAR="illumos-sysroot-$SYSROOT_MACH-$SYSROOT_VER.tar.gz"
37+
SYSROOT_URL='https://github.com/illumos/sysroot/releases/download/'
38+
SYSROOT_URL+="$SYSROOT_VER/$SYSROOT_TAR"
39+
SYSROOT_DIR='/ws/sysroot'
40+
41+
BINUTILS_VERSION='2.25.1'
42+
BINUTILS_MD5='ac493a78de4fee895961d025b7905be4'
43+
BINUTILS_BASE="binutils-$BINUTILS_VERSION"
44+
BINUTILS_TAR="$BINUTILS_BASE.tar.bz2"
45+
BINUTILS_URL="https://ftp.gnu.org/gnu/binutils/$BINUTILS_TAR"
46+
47+
48+
download_file() {
49+
local file="$1"
50+
local url="$2"
51+
local md5="$3"
52+
53+
while :; do
54+
if [[ -f "$file" ]]; then
55+
if ! h="$(md5sum "$file" | awk '{ print $1 }')"; then
56+
printf 'ERROR: reading hash\n' >&2
57+
exit 1
58+
fi
59+
60+
if [[ "$h" == "$md5" ]]; then
61+
return 0
62+
fi
63+
64+
printf 'WARNING: hash mismatch: %s != expected %s\n' \
65+
"$h" "$md5" >&2
66+
rm -f "$file"
67+
fi
68+
69+
printf 'Downloading: %s\n' "$url"
70+
if ! curl -f -L -o "$file" "$url"; then
71+
rm -f "$file"
72+
sleep 1
73+
fi
74+
done
75+
}
76+
77+
78+
case "$2" in
79+
sysroot)
80+
download_file "/tmp/$SYSROOT_TAR" "$SYSROOT_URL" "$SYSROOT_MD5"
81+
mkdir -p "$SYSROOT_DIR"
82+
cd "$SYSROOT_DIR"
83+
tar -xzf "/tmp/$SYSROOT_TAR"
84+
rm -f "/tmp/$SYSROOT_TAR"
85+
;;
86+
87+
binutils)
88+
download_file "/tmp/$BINUTILS_TAR" "$BINUTILS_URL" "$BINUTILS_MD5"
89+
mkdir -p /ws/src/binutils
90+
cd /ws/src/binutils
91+
tar -xjf "/tmp/$BINUTILS_TAR"
92+
rm -f "/tmp/$BINUTILS_TAR"
93+
94+
mkdir -p /ws/build/binutils
95+
cd /ws/build/binutils
96+
"/ws/src/binutils/$BINUTILS_BASE/configure" \
97+
--target="$BUILD_TARGET" \
98+
--with-sysroot="$SYSROOT_DIR"
99+
100+
make -j "$JOBS"
101+
make install
102+
103+
cd /
104+
rm -rf /ws/src/binutils /ws/build/binutils
105+
;;
106+
107+
gcc)
108+
download_file "/tmp/$GCC_TAR" "$GCC_URL" "$GCC_MD5"
109+
mkdir -p /ws/src/gcc
110+
cd /ws/src/gcc
111+
tar -xJf "/tmp/$GCC_TAR"
112+
rm -f "/tmp/$GCC_TAR"
113+
114+
mkdir -p /ws/build/gcc
115+
cd /ws/build/gcc
116+
export CFLAGS='-fPIC'
117+
export CXXFLAGS='-fPIC'
118+
export CXXFLAGS_FOR_TARGET='-fPIC'
119+
export CFLAGS_FOR_TARGET='-fPIC'
120+
"/ws/src/gcc/$GCC_BASE/configure" \
121+
--target="$BUILD_TARGET" \
122+
--with-sysroot="$SYSROOT_DIR" \
123+
--with-gnu-as \
124+
--with-gnu-ld \
125+
--disable-nls \
126+
--disable-libgomp \
127+
--disable-libquadmath \
128+
--disable-libssp \
129+
--disable-libvtv \
130+
--disable-libcilkrts \
131+
--disable-libada \
132+
--disable-libsanitizer \
133+
--disable-libquadmath-support \
134+
--disable-shared \
135+
--enable-tls
136+
137+
make -j "$JOBS"
138+
make install
139+
140+
cd /
141+
rm -rf /ws/src/gcc /ws/build/gcc
142+
;;
143+
144+
*)
145+
printf 'ERROR: unknown phase "%s"\n' "$1" >&2
146+
exit 100
147+
;;
148+
esac

src/ci/github-actions/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,7 @@ jobs:
327327
- dist-x86_64-apple
328328
- dist-x86_64-apple-alt
329329
- dist-x86_64-freebsd
330+
- dist-x86_64-illumos
330331
- dist-x86_64-linux
331332
- dist-x86_64-linux-alt
332333
- dist-x86_64-mingw
@@ -427,6 +428,9 @@ jobs:
427428
- name: dist-x86_64-freebsd
428429
<<: *job-linux-xl
429430

431+
- name: dist-x86_64-illumos
432+
<<: *job-linux-xl
433+
430434
- name: dist-x86_64-linux
431435
<<: *job-linux-xl
432436

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

Lines changed: 1 addition & 0 deletions
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)