Skip to content

Commit 359c3bb

Browse files
committed
Auto merge of #138 - bgermann:master, r=japaric
Add Solaris targets Closes #134.
2 parents 4c5f6b0 + 02c7b81 commit 359c3bb

File tree

6 files changed

+197
-3
lines changed

6 files changed

+197
-3
lines changed

.travis.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,14 @@ matrix:
4141

4242
# BSD
4343
- env: TARGET=i686-unknown-freebsd DYLIB=1 STD=1 OPENSSL=0.7.17
44-
- env: TARGET=x86_64-unknown-dragonfly DYLIB=1 OPENSSL=0.5.5
44+
- env: TARGET=x86_64-unknown-dragonfly DYLIB=1 OPENSSL=0.5.5
4545
- env: TARGET=x86_64-unknown-freebsd DYLIB=1 STD=1 OPENSSL=0.5.5
4646
- env: TARGET=x86_64-unknown-netbsd DYLIB=1 STD=1 OPENSSL=0.7.17
4747

48+
# Solaris
49+
- env: TARGET=sparcv9-sun-solaris DYLIB=1 STD=1 OPENSSL=0.7.17
50+
- env: TARGET=x86_64-sun-solaris DYLIB=1 STD=1 OPENSSL=0.7.17
51+
4852
# Windows
4953
- env: TARGET=x86_64-pc-windows-gnu CPP=1 STD=1 RUN=1
5054
- env: TARGET=i686-pc-windows-gnu CPP=1 STD=1 RUN=1

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,20 +212,22 @@ worst, "hang" (never terminate).
212212
| `powerpc64le-unknown-linux-gnu` | 2.19 | 4.8.2 | 1.0.2k || 2.7.1 ||
213213
| `s390x-unknown-linux-gnu` | 2.23 | 5.3.1 | 1.0.2k || 2.8.0 | |
214214
| `sparc64-unknown-linux-gnu` [2] | 2.23 | 5.3.1 | 1.0.2k || 2.8.0 ||
215+
| `sparcv9-sun-solaris` [1] | 2.11 | 5.3.0 | 1.0.2k | | N/A | |
215216
| `thumbv6m-none-eabi` [3] | 2.2.0 | 5.3.1 | N/A | | N/A | |
216217
| `thumbv7em-none-eabi` [3] | 2.2.0 | 5.3.1 | N/A | | N/A | |
217218
| `thumbv7em-none-eabihf` [3] | 2.2.0 | 5.3.1 | N/A | | N/A | |
218219
| `thumbv7m-none-eabi` [3] | 2.2.0 | 5.3.1 | N/A | | N/A | |
219220
| `wasm32-unknown-emscripten` [4] | 1.1.15 | 1.37.13 | N/A || N/A ||
220221
| `x86_64-linux-android` | N/A | 4.9 | 1.0.2k || N/A | |
221222
| `x86_64-pc-windows-gnu` | N/A | 6.2.0 | N/A || N/A ||
223+
| `x86_64-sun-solaris` [1] | 2.11 | 5.3.0 | 1.0.2k | | N/A | |
222224
| `x86_64-unknown-dragonfly` [1] [2] | 4.6.0 | 5.3.0 | 1.0.2k | | N/A ||
223225
| `x86_64-unknown-freebsd` [1] | 10.2 | 5.3.0 | 1.0.2k | | N/A | |
224226
| `x86_64-unknown-linux-gnu` | 2.15 | 4.6.2 | 1.0.2k || N/A ||
225227
| `x86_64-unknown-linux-musl` | 1.1.15 | 5.3.1 | 1.0.2k | | N/A ||
226228
| `x86_64-unknown-netbsd`[1] | 7.0 | 5.3.0 | 1.0.2k | | N/A | |
227229

228-
[1] For *BSD targets, the libc column indicates the OS release version from
230+
[1] For *BSD and Solaris targets, the libc column indicates the OS release version from
229231
where libc was extracted.
230232

231233
[2] No `std` component available as of 2017-01-10

docker/solaris.sh

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
set -ex
2+
3+
main() {
4+
local arch=$1
5+
6+
local binutils=2.25.1 \
7+
gcc=5.3.0 \
8+
target=$arch-sun-solaris2.11
9+
10+
local dependencies=(
11+
bzip2
12+
ca-certificates
13+
curl
14+
g++
15+
make
16+
software-properties-common
17+
wget
18+
xz-utils
19+
)
20+
21+
apt-get update
22+
local purge_list=()
23+
for dep in ${dependencies[@]}; do
24+
if ! dpkg -L $dep; then
25+
apt-get install --no-install-recommends -y $dep
26+
purge_list+=( $dep )
27+
fi
28+
done
29+
30+
local td=$(mktemp -d)
31+
32+
mkdir $td/{binutils,gcc}{,-build} $td/solaris
33+
34+
curl https://ftp.gnu.org/gnu/binutils/binutils-$binutils.tar.bz2 | \
35+
tar -C $td/binutils --strip-components=1 -xj
36+
37+
curl https://ftp.gnu.org/gnu/gcc/gcc-$gcc/gcc-$gcc.tar.bz2 | \
38+
tar -C $td/gcc --strip-components=1 -xj
39+
40+
pushd $td
41+
42+
cd gcc
43+
./contrib/download_prerequisites
44+
cd ..
45+
46+
local apt_arch=
47+
local lib_arch=
48+
case $arch in
49+
x86_64)
50+
apt_arch=solaris-i386
51+
lib_arch=amd64
52+
;;
53+
sparcv9)
54+
apt_arch=solaris-sparc
55+
lib_arch=sparcv9
56+
;;
57+
esac
58+
59+
apt-key adv --batch --yes --keyserver keyserver.ubuntu.com --recv-keys 74DA7924C5513486
60+
add-apt-repository -y 'deb http://apt.dilos.org/dilos dilos2-testing main'
61+
dpkg --add-architecture $apt_arch
62+
apt-get update
63+
apt-get download $(apt-cache depends --recurse --no-replaces \
64+
libc-dev:$apt_arch \
65+
libdl-dev:$apt_arch \
66+
libm-dev:$apt_arch \
67+
libnsl-dev:$apt_arch \
68+
libpthread-dev:$apt_arch \
69+
libresolv-dev:$apt_arch \
70+
librt-dev:$apt_arch \
71+
libsocket-dev:$apt_arch \
72+
system-crt:$apt_arch \
73+
system-header:$apt_arch \
74+
| grep "^\w")
75+
76+
for deb in *$apt_arch.deb; do
77+
dpkg -x $deb $td/solaris
78+
done
79+
80+
cd binutils-build
81+
../binutils/configure \
82+
--target=$target
83+
nice make -j$(nproc)
84+
make install
85+
cd ..
86+
87+
local destdir=/usr/local/$target
88+
mkdir $destdir/usr
89+
cp -r $td/solaris/usr/include $destdir/usr
90+
mv $td/solaris/usr/lib/$lib_arch/* $destdir/lib
91+
mv $td/solaris/lib/$lib_arch/* $destdir/lib
92+
93+
ln -s usr/include $destdir/sys-include
94+
ln -s usr/include $destdir/include
95+
96+
cd gcc-build
97+
../gcc/configure \
98+
--disable-libada \
99+
--disable-libcilkrts \
100+
--disable-libgomp \
101+
--disable-libquadmath \
102+
--disable-libquadmath-support \
103+
--disable-libsanitizer \
104+
--disable-libssp \
105+
--disable-libvtv \
106+
--disable-lto \
107+
--disable-multilib \
108+
--disable-nls \
109+
--enable-languages=c,c++ \
110+
--with-gnu-as \
111+
--with-gnu-ld \
112+
--target=$target
113+
nice make -j$(nproc)
114+
make install
115+
cd ..
116+
117+
# clean up
118+
popd
119+
120+
apt-get purge --auto-remove -y ${purge_list[@]}
121+
122+
rm -rf $td
123+
rm $0
124+
}
125+
126+
main "${@}"

docker/sparcv9-sun-solaris/Dockerfile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
FROM ubuntu:16.04
2+
3+
RUN apt-get update && \
4+
apt-get install -y --no-install-recommends \
5+
ca-certificates \
6+
cmake \
7+
gcc \
8+
libc6-dev \
9+
make \
10+
pkg-config
11+
12+
COPY xargo.sh /
13+
RUN bash /xargo.sh
14+
15+
COPY solaris.sh openssl.sh /
16+
RUN bash /solaris.sh sparcv9 && \
17+
bash /openssl.sh solaris64-sparcv9-gcc sparcv9-sun-solaris2.11-
18+
19+
ENV CARGO_TARGET_SPARCV9_SUN_SOLARIS_LINKER=sparcv9-sun-solaris2.11-gcc \
20+
CC_sparcv9_sun_solaris=sparcv9-sun-solaris2.11-gcc \
21+
OPENSSL_DIR=/openssl \
22+
OPENSSL_INCLUDE_DIR=/openssl/include \
23+
OPENSSL_LIB_DIR=/openssl/lib

docker/x86_64-sun-solaris/Dockerfile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
FROM ubuntu:16.04
2+
3+
RUN apt-get update && \
4+
apt-get install -y --no-install-recommends \
5+
ca-certificates \
6+
cmake \
7+
gcc \
8+
libc6-dev \
9+
make \
10+
pkg-config
11+
12+
COPY xargo.sh /
13+
RUN bash /xargo.sh
14+
15+
COPY solaris.sh openssl.sh /
16+
RUN bash /solaris.sh x86_64 && \
17+
bash /openssl.sh solaris64-x86_64-gcc x86_64-sun-solaris2.11-
18+
19+
ENV CARGO_TARGET_X86_64_SUN_SOLARIS_LINKER=x86_64-sun-solaris2.11-gcc \
20+
CC_x86_64_sun_solaris=x86_64-sun-solaris2.11-gcc \
21+
OPENSSL_DIR=/openssl \
22+
OPENSSL_INCLUDE_DIR=/openssl/include \
23+
OPENSSL_LIB_DIR=/openssl/lib

src/main.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@ pub enum Target {
118118
X86_64UnknownFreebsd,
119119
X86_64UnknownNetbsd,
120120

121+
// Solaris / illumos
122+
Sparcv9SunSolaris,
123+
X86_64SunSolaris,
124+
121125
// Windows
122126
X86_64PcWindowsGnu,
123127
I686PcWindowsGnu,
@@ -161,6 +165,14 @@ impl Target {
161165
}
162166
}
163167

168+
fn is_solaris(&self) -> bool {
169+
match *self {
170+
Target::Sparcv9SunSolaris |
171+
Target::X86_64SunSolaris => true,
172+
_ => false,
173+
}
174+
}
175+
164176
fn is_android(&self) -> bool {
165177
match *self {
166178
Target::ArmLinuxAndroideabi |
@@ -214,7 +226,7 @@ impl Target {
214226

215227
fn needs_docker(&self) -> bool {
216228
self.is_linux() || self.is_android() || self.is_bare_metal() || self.is_bsd() ||
217-
!self.is_builtin() || self.is_windows() || self.is_emscripten()
229+
self.is_solaris() || !self.is_builtin() || self.is_windows() || self.is_emscripten()
218230
}
219231

220232
fn needs_interpreter(&self) -> bool {
@@ -265,6 +277,7 @@ impl Target {
265277
PowerpcUnknownLinuxGnu => "powerpc-unknown-linux-gnu",
266278
S390xUnknownLinuxGnu => "s390x-unknown-linux-gnu",
267279
Sparc64UnknownLinuxGnu => "sparc64-unknown-linux-gnu",
280+
Sparcv9SunSolaris => "sparcv9-sun-solaris",
268281
Thumbv6mNoneEabi => "thumbv6m-none-eabi",
269282
Thumbv7emNoneEabi => "thumbv7em-none-eabi",
270283
Thumbv7emNoneEabihf => "thumbv7em-none-eabihf",
@@ -273,6 +286,7 @@ impl Target {
273286
X86_64AppleDarwin => "x86_64-apple-darwin",
274287
X86_64PcWindowsGnu => "x86_64-pc-windows-gnu",
275288
X86_64LinuxAndroid => "x86_64-linux-android",
289+
X86_64SunSolaris => "x86_64-sun-solaris",
276290
X86_64UnknownDragonfly => "x86_64-unknown-dragonfly",
277291
X86_64UnknownFreebsd => "x86_64-unknown-freebsd",
278292
X86_64UnknownLinuxGnu => "x86_64-unknown-linux-gnu",
@@ -315,6 +329,7 @@ impl Target {
315329
"powerpc64le-unknown-linux-gnu" => Powerpc64leUnknownLinuxGnu,
316330
"s390x-unknown-linux-gnu" => S390xUnknownLinuxGnu,
317331
"sparc64-unknown-linux-gnu" => Sparc64UnknownLinuxGnu,
332+
"sparcv9-sun-solaris" => Sparcv9SunSolaris,
318333
"thumbv6m-none-eabi" => Thumbv6mNoneEabi,
319334
"thumbv7em-none-eabi" => Thumbv7emNoneEabi,
320335
"thumbv7em-none-eabihf" => Thumbv7emNoneEabihf,
@@ -323,6 +338,7 @@ impl Target {
323338
"x86_64-apple-darwin" => X86_64AppleDarwin,
324339
"x86_64-linux-android" => X86_64LinuxAndroid,
325340
"x86_64-pc-windows-gnu" => X86_64PcWindowsGnu,
341+
"x86_64-sun-solaris" => X86_64SunSolaris,
326342
"x86_64-unknown-dragonfly" => X86_64UnknownDragonfly,
327343
"x86_64-unknown-freebsd" => X86_64UnknownFreebsd,
328344
"x86_64-unknown-linux-gnu" => X86_64UnknownLinuxGnu,

0 commit comments

Comments
 (0)