Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: introduce haiku x86_64 builder #44381

Merged
merged 4 commits into from
Sep 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions src/ci/docker/disabled/dist-x86_64-haiku/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
FROM ubuntu:16.04

RUN apt-get update && apt-get install -y --no-install-recommends \
autoconf \
automake \
bison \
bzip2 \
ca-certificates \
cmake \
curl \
file \
flex \
g++ \
gawk \
git \
libcurl4-openssl-dev \
libssl-dev \
make \
nasm \
pkg-config \
python2.7 \
sudo \
texinfo \
wget \
xz-utils \
zlib1g-dev

COPY dist-x86_64-haiku/llvm-config.sh /bin/llvm-config-haiku

ENV ARCH=x86_64

WORKDIR /tmp
COPY dist-x86_64-haiku/build-toolchain.sh /tmp/
RUN /tmp/build-toolchain.sh $ARCH

COPY dist-x86_64-haiku/fetch-packages.sh /tmp/
RUN /tmp/fetch-packages.sh

COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh

ENV HOST=x86_64-unknown-haiku
ENV TARGET=target.$HOST

ENV RUST_CONFIGURE_ARGS --host=$HOST --target=$HOST --disable-jemalloc \
--set=$TARGET.cc=x86_64-unknown-haiku-gcc \
--set=$TARGET.cxx=x86_64-unknown-haiku-g++ \
--set=$TARGET.llvm-config=/bin/llvm-config-haiku
ENV SCRIPT python2.7 ../x.py dist
74 changes: 74 additions & 0 deletions src/ci/docker/disabled/dist-x86_64-haiku/build-toolchain.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#!/bin/bash
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution and at
# http://rust-lang.org/COPYRIGHT.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
# option. This file may not be copied, modified, or distributed
# except according to those terms.

set -ex

ARCH=$1

TOP=$(pwd)

BUILDTOOLS=$TOP/buildtools
HAIKU=$TOP/haiku
OUTPUT=/tools
SYSROOT=$OUTPUT/cross-tools-$ARCH/sysroot
PACKAGE_ROOT=/system

hide_output() {
set +x
on_err="
echo ERROR: An error was encountered with the build.
cat /tmp/build.log
exit 1
"
trap "$on_err" ERR
bash -c "while true; do sleep 30; echo \$(date) - building ...; done" &
PING_LOOP_PID=$!
$@ &> /tmp/build.log
trap - ERR
kill $PING_LOOP_PID
set -x
}

# First up, build a cross-compiler
git clone --depth=1 https://git.haiku-os.org/haiku
git clone --depth=1 https://git.haiku-os.org/buildtools
cd $BUILDTOOLS/jam
hide_output make
hide_output ./jam0 install
mkdir -p $OUTPUT
cd $OUTPUT
hide_output $HAIKU/configure --build-cross-tools $ARCH $TOP/buildtools

# Set up sysroot to redirect to /system
mkdir -p $SYSROOT/boot
mkdir -p $PACKAGE_ROOT
ln -s $PACKAGE_ROOT $SYSROOT/boot/system

# Build needed packages and tools for the cross-compiler
hide_output jam -q haiku.hpkg haiku_devel.hpkg '<build>package'

# Set up our sysroot
cp $OUTPUT/objects/linux/lib/*.so /lib/x86_64-linux-gnu
cp $OUTPUT/objects/linux/x86_64/release/tools/package/package /bin/
find $SYSROOT/../bin/ -type f -exec ln -s {} /bin/ \;

# Extract packages
package extract -C $PACKAGE_ROOT $OUTPUT/objects/haiku/$ARCH/packaging/packages/haiku.hpkg
package extract -C $PACKAGE_ROOT $OUTPUT/objects/haiku/$ARCH/packaging/packages/haiku_devel.hpkg
find $OUTPUT/download/ -name '*.hpkg' -exec package extract -C $PACKAGE_ROOT {} \;

# Fix libgcc_s so we can link to it
cd $PACKAGE_ROOT/develop/lib
ln -s ../../lib/libgcc_s.so libgcc_s.so

# Clean up
rm -rf $BUILDTOOLS $HAIKU $OUTPUT/Jamfile $OUTPUT/attributes $OUTPUT/build \
$OUTPUT/build_packages $OUTPUT/download $OUTPUT/objects
18 changes: 18 additions & 0 deletions src/ci/docker/disabled/dist-x86_64-haiku/fetch-packages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution and at
# http://rust-lang.org/COPYRIGHT.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
# option. This file may not be copied, modified, or distributed
# except according to those terms.

wget http://packages.haiku-os.org/haikuports/master/hpkg/llvm-4.0.1-2-x86_64.hpkg
wget http://packages.haiku-os.org/haikuports/master/hpkg/llvm_libs-4.0.1-2-x86_64.hpkg

package extract -C /system llvm-4.0.1-2-x86_64.hpkg
package extract -C /system llvm_libs-4.0.1-2-x86_64.hpkg

rm -f *.hpkg
67 changes: 67 additions & 0 deletions src/ci/docker/disabled/dist-x86_64-haiku/llvm-config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#!/bin/sh
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution and at
# http://rust-lang.org/COPYRIGHT.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
# option. This file may not be copied, modified, or distributed
# except according to those terms.

case $1 in
--version) echo 4.0.1;;
--prefix) echo $SCRATCH/haiku-cross/sysroot/boot/system;;
--bindir) echo $SCRATCH/haiku-cross/sysroot/boot/system/bin;;
--includedir) echo $SCRATCH/haiku-cross/sysroot/boot/system/develop/headers;;
--libdir) echo $SCRATCH/haiku-/cross/sysroot/boot/system/develop/lib;;
--cmakedir) echo $SCRATCH/haiku-/cross/sysroot/boot/system/develop/lib/cmake/llvm;;
--cppflags) echo -I$SCRATCH/haiku-/cross/sysroot/boot/system/develop/headers \
-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS;;
--cflags) echo -I$SCRATCH/haiku-cross/sysroot/boot/system/develop/headers \
-fPIC -Wall -W -Wno-unused-parameter -Wwrite-strings \
-Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-comment \
-Werror=date-time -ffunction-sections -fdata-sections -O3 -DNDEBUG \
-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS;;
--cxxflags) echo -I/$SCRATCH/haiku-cross/sysroot/boot/system/develop/headers \
-fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter \
-Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic \
-Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor \
-Wno-comment -Werror=date-time -std=c++11 -ffunction-sections \
-fdata-sections -O3 -DNDEBUG -fno-exceptions \
-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS;;
--ldflags) echo -L$SCRATCH/haiku-cross/sysroot/boot/system/develop/lib ;;
--system-libs) echo ;;
--libs) echo -lLLVM-4.0;;
--libfiles) echo $SCRATCH/haiku-cross/sysroot/boot/system/develop/lib/libLLVM-4.0.so;;
--components) echo aarch64 aarch64asmparser aarch64asmprinter aarch64codegen \
aarch64desc aarch64disassembler aarch64info aarch64utils all \
all-targets amdgpu amdgpuasmparser amdgpuasmprinter amdgpucodegen \
amdgpudesc amdgpudisassembler amdgpuinfo amdgpuutils analysis arm \
armasmparser armasmprinter armcodegen armdesc armdisassembler \
arminfo asmparser asmprinter bitreader bitwriter bpf bpfasmprinter \
bpfcodegen bpfdesc bpfdisassembler bpfinfo codegen core coroutines \
coverage debuginfocodeview debuginfodwarf debuginfomsf debuginfopdb \
demangle engine executionengine globalisel hexagon hexagonasmparser \
hexagoncodegen hexagondesc hexagondisassembler hexagoninfo \
instcombine instrumentation interpreter ipo irreader lanai \
lanaiasmparser lanaicodegen lanaidesc lanaidisassembler lanaiinfo \
lanaiinstprinter libdriver lineeditor linker lto mc mcdisassembler \
mcjit mcparser mips mipsasmparser mipsasmprinter mipscodegen \
mipsdesc mipsdisassembler mipsinfo mirparser msp430 msp430asmprinter \
msp430codegen msp430desc msp430info native nativecodegen nvptx \
nvptxasmprinter nvptxcodegen nvptxdesc nvptxinfo objcarcopts object \
objectyaml option orcjit passes powerpc powerpcasmparser \
powerpcasmprinter powerpccodegen powerpcdesc powerpcdisassembler \
powerpcinfo profiledata riscv riscvcodegen riscvdesc riscvinfo \
runtimedyld scalaropts selectiondag sparc sparcasmparser \
sparcasmprinter sparccodegen sparcdesc sparcdisassembler sparcinfo \
support symbolize systemz systemzasmparser systemzasmprinter \
systemzcodegen systemzdesc systemzdisassembler systemzinfo tablegen \
target transformutils vectorize x86 x86asmparser x86asmprinter \
x86codegen x86desc x86disassembler x86info x86utils xcore \
xcoreasmprinter xcorecodegen xcoredesc xcoredisassembler xcoreinfo;;
--host-target) echo x86_64-unknown-haiku;;
--has-rtti) echo YES;;
--shared-mode) echo shared;;
esac