Skip to content

Commit 45e4306

Browse files
authored
Rollup merge of rust-lang#44381 - jessicah:haiku-ci, r=alexcrichton
ci: introduce haiku x86_64 builder
2 parents cafcdbb + 3443dd8 commit 45e4306

File tree

4 files changed

+208
-0
lines changed

4 files changed

+208
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
FROM ubuntu:16.04
2+
3+
RUN apt-get update && apt-get install -y --no-install-recommends \
4+
autoconf \
5+
automake \
6+
bison \
7+
bzip2 \
8+
ca-certificates \
9+
cmake \
10+
curl \
11+
file \
12+
flex \
13+
g++ \
14+
gawk \
15+
git \
16+
libcurl4-openssl-dev \
17+
libssl-dev \
18+
make \
19+
nasm \
20+
pkg-config \
21+
python2.7 \
22+
sudo \
23+
texinfo \
24+
wget \
25+
xz-utils \
26+
zlib1g-dev
27+
28+
COPY dist-x86_64-haiku/llvm-config.sh /bin/llvm-config-haiku
29+
30+
ENV ARCH=x86_64
31+
32+
WORKDIR /tmp
33+
COPY dist-x86_64-haiku/build-toolchain.sh /tmp/
34+
RUN /tmp/build-toolchain.sh $ARCH
35+
36+
COPY dist-x86_64-haiku/fetch-packages.sh /tmp/
37+
RUN /tmp/fetch-packages.sh
38+
39+
COPY scripts/sccache.sh /scripts/
40+
RUN sh /scripts/sccache.sh
41+
42+
ENV HOST=x86_64-unknown-haiku
43+
ENV TARGET=target.$HOST
44+
45+
ENV RUST_CONFIGURE_ARGS --host=$HOST --target=$HOST --disable-jemalloc \
46+
--set=$TARGET.cc=x86_64-unknown-haiku-gcc \
47+
--set=$TARGET.cxx=x86_64-unknown-haiku-g++ \
48+
--set=$TARGET.llvm-config=/bin/llvm-config-haiku
49+
ENV SCRIPT python2.7 ../x.py dist
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
#!/bin/bash
2+
# Copyright 2017 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 -ex
13+
14+
ARCH=$1
15+
16+
TOP=$(pwd)
17+
18+
BUILDTOOLS=$TOP/buildtools
19+
HAIKU=$TOP/haiku
20+
OUTPUT=/tools
21+
SYSROOT=$OUTPUT/cross-tools-$ARCH/sysroot
22+
PACKAGE_ROOT=/system
23+
24+
hide_output() {
25+
set +x
26+
on_err="
27+
echo ERROR: An error was encountered with the build.
28+
cat /tmp/build.log
29+
exit 1
30+
"
31+
trap "$on_err" ERR
32+
bash -c "while true; do sleep 30; echo \$(date) - building ...; done" &
33+
PING_LOOP_PID=$!
34+
$@ &> /tmp/build.log
35+
trap - ERR
36+
kill $PING_LOOP_PID
37+
set -x
38+
}
39+
40+
# First up, build a cross-compiler
41+
git clone --depth=1 https://git.haiku-os.org/haiku
42+
git clone --depth=1 https://git.haiku-os.org/buildtools
43+
cd $BUILDTOOLS/jam
44+
hide_output make
45+
hide_output ./jam0 install
46+
mkdir -p $OUTPUT
47+
cd $OUTPUT
48+
hide_output $HAIKU/configure --build-cross-tools $ARCH $TOP/buildtools
49+
50+
# Set up sysroot to redirect to /system
51+
mkdir -p $SYSROOT/boot
52+
mkdir -p $PACKAGE_ROOT
53+
ln -s $PACKAGE_ROOT $SYSROOT/boot/system
54+
55+
# Build needed packages and tools for the cross-compiler
56+
hide_output jam -q haiku.hpkg haiku_devel.hpkg '<build>package'
57+
58+
# Set up our sysroot
59+
cp $OUTPUT/objects/linux/lib/*.so /lib/x86_64-linux-gnu
60+
cp $OUTPUT/objects/linux/x86_64/release/tools/package/package /bin/
61+
find $SYSROOT/../bin/ -type f -exec ln -s {} /bin/ \;
62+
63+
# Extract packages
64+
package extract -C $PACKAGE_ROOT $OUTPUT/objects/haiku/$ARCH/packaging/packages/haiku.hpkg
65+
package extract -C $PACKAGE_ROOT $OUTPUT/objects/haiku/$ARCH/packaging/packages/haiku_devel.hpkg
66+
find $OUTPUT/download/ -name '*.hpkg' -exec package extract -C $PACKAGE_ROOT {} \;
67+
68+
# Fix libgcc_s so we can link to it
69+
cd $PACKAGE_ROOT/develop/lib
70+
ln -s ../../lib/libgcc_s.so libgcc_s.so
71+
72+
# Clean up
73+
rm -rf $BUILDTOOLS $HAIKU $OUTPUT/Jamfile $OUTPUT/attributes $OUTPUT/build \
74+
$OUTPUT/build_packages $OUTPUT/download $OUTPUT/objects
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
# Copyright 2017 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+
wget http://packages.haiku-os.org/haikuports/master/hpkg/llvm-4.0.1-2-x86_64.hpkg
13+
wget http://packages.haiku-os.org/haikuports/master/hpkg/llvm_libs-4.0.1-2-x86_64.hpkg
14+
15+
package extract -C /system llvm-4.0.1-2-x86_64.hpkg
16+
package extract -C /system llvm_libs-4.0.1-2-x86_64.hpkg
17+
18+
rm -f *.hpkg
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#!/bin/sh
2+
# Copyright 2017 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+
case $1 in
13+
--version) echo 4.0.1;;
14+
--prefix) echo $SCRATCH/haiku-cross/sysroot/boot/system;;
15+
--bindir) echo $SCRATCH/haiku-cross/sysroot/boot/system/bin;;
16+
--includedir) echo $SCRATCH/haiku-cross/sysroot/boot/system/develop/headers;;
17+
--libdir) echo $SCRATCH/haiku-/cross/sysroot/boot/system/develop/lib;;
18+
--cmakedir) echo $SCRATCH/haiku-/cross/sysroot/boot/system/develop/lib/cmake/llvm;;
19+
--cppflags) echo -I$SCRATCH/haiku-/cross/sysroot/boot/system/develop/headers \
20+
-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS;;
21+
--cflags) echo -I$SCRATCH/haiku-cross/sysroot/boot/system/develop/headers \
22+
-fPIC -Wall -W -Wno-unused-parameter -Wwrite-strings \
23+
-Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-comment \
24+
-Werror=date-time -ffunction-sections -fdata-sections -O3 -DNDEBUG \
25+
-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS;;
26+
--cxxflags) echo -I/$SCRATCH/haiku-cross/sysroot/boot/system/develop/headers \
27+
-fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter \
28+
-Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic \
29+
-Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor \
30+
-Wno-comment -Werror=date-time -std=c++11 -ffunction-sections \
31+
-fdata-sections -O3 -DNDEBUG -fno-exceptions \
32+
-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS;;
33+
--ldflags) echo -L$SCRATCH/haiku-cross/sysroot/boot/system/develop/lib ;;
34+
--system-libs) echo ;;
35+
--libs) echo -lLLVM-4.0;;
36+
--libfiles) echo $SCRATCH/haiku-cross/sysroot/boot/system/develop/lib/libLLVM-4.0.so;;
37+
--components) echo aarch64 aarch64asmparser aarch64asmprinter aarch64codegen \
38+
aarch64desc aarch64disassembler aarch64info aarch64utils all \
39+
all-targets amdgpu amdgpuasmparser amdgpuasmprinter amdgpucodegen \
40+
amdgpudesc amdgpudisassembler amdgpuinfo amdgpuutils analysis arm \
41+
armasmparser armasmprinter armcodegen armdesc armdisassembler \
42+
arminfo asmparser asmprinter bitreader bitwriter bpf bpfasmprinter \
43+
bpfcodegen bpfdesc bpfdisassembler bpfinfo codegen core coroutines \
44+
coverage debuginfocodeview debuginfodwarf debuginfomsf debuginfopdb \
45+
demangle engine executionengine globalisel hexagon hexagonasmparser \
46+
hexagoncodegen hexagondesc hexagondisassembler hexagoninfo \
47+
instcombine instrumentation interpreter ipo irreader lanai \
48+
lanaiasmparser lanaicodegen lanaidesc lanaidisassembler lanaiinfo \
49+
lanaiinstprinter libdriver lineeditor linker lto mc mcdisassembler \
50+
mcjit mcparser mips mipsasmparser mipsasmprinter mipscodegen \
51+
mipsdesc mipsdisassembler mipsinfo mirparser msp430 msp430asmprinter \
52+
msp430codegen msp430desc msp430info native nativecodegen nvptx \
53+
nvptxasmprinter nvptxcodegen nvptxdesc nvptxinfo objcarcopts object \
54+
objectyaml option orcjit passes powerpc powerpcasmparser \
55+
powerpcasmprinter powerpccodegen powerpcdesc powerpcdisassembler \
56+
powerpcinfo profiledata riscv riscvcodegen riscvdesc riscvinfo \
57+
runtimedyld scalaropts selectiondag sparc sparcasmparser \
58+
sparcasmprinter sparccodegen sparcdesc sparcdisassembler sparcinfo \
59+
support symbolize systemz systemzasmparser systemzasmprinter \
60+
systemzcodegen systemzdesc systemzdisassembler systemzinfo tablegen \
61+
target transformutils vectorize x86 x86asmparser x86asmprinter \
62+
x86codegen x86desc x86disassembler x86info x86utils xcore \
63+
xcoreasmprinter xcorecodegen xcoredesc xcoredisassembler xcoreinfo;;
64+
--host-target) echo x86_64-unknown-haiku;;
65+
--has-rtti) echo YES;;
66+
--shared-mode) echo shared;;
67+
esac

0 commit comments

Comments
 (0)