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.
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.
18 BUILDTOOLS=$TOP/buildtools
21 SYSROOT=$OUTPUT/cross-tools-$ARCH/sysroot
27 echo ERROR: An error was encountered with the build.
32 bash -c "while true; do sleep 30; echo \$(date) - building ...; done" &
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
45 hide_output ./jam0 install
48 hide_output $HAIKU/configure --build-cross-tools $ARCH $TOP/buildtools
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
55 # Build needed packages and tools for the cross-compiler
56 hide_output jam -q haiku.hpkg haiku_devel.hpkg '<build>package'
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/ \;
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 {} \;
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
73 rm -rf $BUILDTOOLS $HAIKU $OUTPUT/Jamfile $OUTPUT/attributes $OUTPUT/build \
74 $OUTPUT/build_packages $OUTPUT/download $OUTPUT/objects