2 # Copyright 2016 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.
19 BUILDTOOLS
=$TOP/buildtools
22 SYSROOT
=$OUTPUT/cross-tools-
$ARCH/sysroot
23 SYSROOT_SECONDARY
=$OUTPUT/cross-tools-
$SECONDARY_ARCH/sysroot
26 # First up, build a cross-compiler
27 git clone
--depth=1 https
://git.haiku-os.org
/haiku
28 git clone
--depth=1 https
://git.haiku-os.org
/buildtools
30 make && .
/jam0
install
33 configureArgs
="--build-cross-tools $ARCH $TOP/buildtools"
34 if [ -n "$SECONDARY_ARCH" ]; then
35 configureArgs
="$configureArgs --build-cross-tools $SECONDARY_ARCH"
37 $HAIKU/configure
$configureArgs
39 # Set up sysroot to redirect to /system
40 mkdir
-p $SYSROOT/boot
41 mkdir
-p $PACKAGE_ROOT
42 ln -s $PACKAGE_ROOT $SYSROOT/boot
/system
43 if [ -n "$SECONDARY_ARCH" ]; then
44 mkdir
-p $SYSROOT_SECONDARY/boot
45 ln -s $PACKAGEROOT $SYSROOT_SECONDARY/boot
/system
48 # Build needed packages and tools for the cross-compiler
49 jam
-q haiku.hpkg haiku_devel.hpkg
'<build>package'
50 if [ -n "$SECONDARY_ARCH" ]; then
51 jam
-q haiku_
${SECONDARY_ARCH}.hpkg haiku_
${SECONDARY_ARCH}_devel.hpkg
55 cp $OUTPUT/objects
/linux
/lib
/*.so
/lib
/x86_64-linux-gnu
56 cp $OUTPUT/objects
/linux
/x86_64
/release
/tools
/package
/package
/bin
/
57 for file in $SYSROOT/..
/bin
/*; do
58 ln -s $file /bin
/$
(basename $file)
60 #find $SYSROOT/../bin/ -type f -exec ln -s {} /bin/ \;
61 if [ -n "$SECONDARY_ARCH" ]; then
62 for file in $SYSROOT_SECONDARY/..
/bin
/*; do
63 ln -s $file /bin
/$
(basename $file)-$SECONDARY_ARCH
65 #find $SYSROOT_SECONDARY/../bin/ -type f -exec ln -s {} /bin/{}-$SECONDARY_ARCH \;
69 package extract
-C $PACKAGE_ROOT $OUTPUT/objects
/haiku
/$ARCH/packaging
/packages
/haiku.hpkg
70 package extract
-C $PACKAGE_ROOT $OUTPUT/objects
/haiku
/$ARCH/packaging
/packages
/haiku_devel.hpkg
71 if [ -n "$SECONDARY_ARCH" ]; then
72 package extract
-C $PACKAGE_ROOT $OUTPUT/objects
/haiku
/$ARCH/packaging
/packages
/haiku_
${SECONDARY_ARCH}.hpkg
73 package extract
-C $PACKAGE_ROOT $OUTPUT/objects
/haiku
/$ARCH/packaging
/packages
/haiku_
${SECONDARY_ARCH}_devel.hpkg
75 find $OUTPUT/download
/ -name '*.hpkg' -exec package extract
-C $PACKAGE_ROOT {} \
;
76 cd $PACKAGE_ROOT/develop
/lib
77 ln -s ..
/..
/lib
/libgcc_s.so libgcc_s.so
78 if [ -n "$SECONDARY_ARCH" ]; then
79 cd $PACKAGE_ROOT/develop
/lib
/$SECONDARY_ARCH
80 ln -s ..
/..
/..
/lib
/$SECONDARY_ARCH/libgcc_s.so libgcc_s.so
86 rm -rf $OUTPUT/Jamfile
$OUTPUT/attributes
$OUTPUT/build
$OUTPUT/build_packages
$OUTPUT/download
$OUTPUT/objects
88 if [ -n "$SECONDARY_ARCH" ]; then
89 echo "Cross compilers for $ARCH-unknown-haiku and $SECONDARY_ARCH-unknown-haiku built and configured"
91 echo "Cross compiler for $ARCH-unknown-haiku built and configured"