Skip to content

Commit 24c3a6d

Browse files
committed
Add a Docker container for doing automated builds for CloudABI.
Setting up a cross compilation toolchain for CloudABI is relatively easy. It's just a matter of installing a somewhat recent version of Clang (5.0 preferred) and installing the corresponding ${target}-cxx-runtime package, containing a set of core C/C++ libraries (libc, libc++, libunwind, etc). Eventually it would be nice if we could also run 'x.py test'. That, however still requires some more work. Both libtest and compiletest would need to be adjusted to deal with CloudABI's requirement of having all of an application's dependencies injected. Let's settle for just doing 'x.py dist' for now.
1 parent da569fa commit 24c3a6d

File tree

3 files changed

+91
-0
lines changed

3 files changed

+91
-0
lines changed

.travis.yml

+2
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ matrix:
126126
if: branch = auto
127127
- env: IMAGE=dist-armv7-linux DEPLOY=1
128128
if: branch = auto
129+
- env: IMAGE=dist-cloudabi DEPLOY=1
130+
if: branch = auto
129131
- env: IMAGE=dist-i586-gnu-i586-i686-musl DEPLOY=1
130132
if: branch = auto
131133
- env: IMAGE=dist-i686-freebsd DEPLOY=1
+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
FROM ubuntu:17.10
2+
3+
ENV TARGETS=aarch64-unknown-cloudabi
4+
# FIXME(EdSchouten): Enable ARMv7 support once libc ≥0.2.37 has been merged.
5+
# ENV TARGETS=armv7-unknown-cloudabi-eabihf
6+
ENV TARGETS=$TARGETS,i686-unknown-cloudabi
7+
ENV TARGETS=$TARGETS,x86_64-unknown-cloudabi
8+
9+
COPY scripts/cloudabi-toolchain.sh /tmp/
10+
RUN /tmp/cloudabi-toolchain.sh
11+
12+
COPY scripts/sccache.sh /scripts/
13+
RUN sh /scripts/sccache.sh
14+
15+
# FIXME(EdSchouten): Remove this once cc ≥1.0.4 has been merged. It can
16+
# automatically pick the right compiler path.
17+
ENV \
18+
AR_aarch64_unknown_cloudabi=aarch64-unknown-cloudabi-ar \
19+
CC_aarch64_unknown_cloudabi=aarch64-unknown-cloudabi-clang \
20+
CXX_aarch64_unknown_cloudabi=aarch64-unknown-cloudabi-clang++ \
21+
AR_i686_unknown_cloudabi=i686-unknown-cloudabi-ar \
22+
CC_i686_unknown_cloudabi=i686-unknown-cloudabi-clang \
23+
CXX_i686_unknown_cloudabi=i686-unknown-cloudabi-clang++ \
24+
AR_x86_64_unknown_cloudabi=x86_64-unknown-cloudabi-ar \
25+
CC_x86_64_unknown_cloudabi=x86_64-unknown-cloudabi-clang \
26+
CXX_x86_64_unknown_cloudabi=x86_64-unknown-cloudabi-clang++
27+
28+
# FIXME(EdSchouten): Work towards being able to run 'x.py test'.
29+
ENV RUST_CONFIGURE_ARGS --target=${TARGETS} --disable-jemalloc
30+
ENV SCRIPT python2.7 /checkout/x.py dist --target ${TARGETS}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/bin/bash
2+
# Copyright 2018 The Rust Project Developers. See the COPYRIGHT
3+
# file at the top-level directory of this distribution and at
4+
# http://rust-lang.org/COPYRIGHT.
5+
#
6+
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
7+
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
8+
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
9+
# option. This file may not be copied, modified, or distributed
10+
# except according to those terms.
11+
12+
set -eux
13+
14+
# Install prerequisites.
15+
apt-get update
16+
apt-get install -y --no-install-recommends \
17+
apt-transport-https \
18+
ca-certificates \
19+
clang-5.0 \
20+
cmake \
21+
curl \
22+
file \
23+
g++ \
24+
gdb \
25+
git \
26+
lld-5.0 \
27+
make \
28+
python \
29+
sudo \
30+
xz-utils
31+
32+
# Set up a Clang-based cross compiler toolchain.
33+
# Based on the steps described at https://nuxi.nl/cloudabi/debian/
34+
IFS=,
35+
for target in ${TARGETS}; do
36+
for tool in ar nm objdump ranlib size; do
37+
ln -s ../lib/llvm-5.0/bin/llvm-${tool} /usr/bin/${target}-${tool}
38+
done
39+
ln -s ../lib/llvm-5.0/bin/clang /usr/bin/${target}-cc
40+
ln -s ../lib/llvm-5.0/bin/clang /usr/bin/${target}-c++
41+
ln -s ../lib/llvm-5.0/bin/lld /usr/bin/${target}-ld
42+
ln -s ../../${target} /usr/lib/llvm-5.0/${target}
43+
44+
# FIXME(EdSchouten): Remove this once cc ≥1.0.4 has been merged. It
45+
# can make use of ${target}-cc and ${target}-c++, without incorrectly
46+
# assuming it's MSVC.
47+
ln -s ../lib/llvm-5.0/bin/clang /usr/bin/${target}-clang
48+
ln -s ../lib/llvm-5.0/bin/clang /usr/bin/${target}-clang++
49+
done
50+
51+
# Install the C++ runtime libraries from CloudABI Ports.
52+
echo deb https://nuxi.nl/distfiles/cloudabi-ports/debian/ cloudabi cloudabi > \
53+
/etc/apt/sources.list.d/cloudabi.list
54+
curl 'https://pgp.mit.edu/pks/lookup?op=get&search=0x0DA51B8531344B15' | \
55+
apt-key add -
56+
apt-get update
57+
for target in ${TARGETS}; do
58+
apt-get install -y $(echo ${target} | sed -e s/_/-/g)-cxx-runtime
59+
done

0 commit comments

Comments
 (0)