1#!/bin/bash 2# 3# Creates a sysroot from a running Haiku system suitable 4# for bootstrapping / cross-compiling Haiku applications 5# under other platforms. 6# 7# Resulting tar.gz is generally extracted at cross-tools-$ARCH/sysroot 8# 9 10OS=$(uname -o) 11ARCH=$(uname -p) 12REV=$(uname -v | awk '{ print $1 }') 13 14EXCLUDE="/boot/system/packages /boot/system/var/swap" 15 16OUTPUT="sysroot-$OS-$ARCH-$REV.tar.gz" 17 18echo "Generating $ARCH sysroot..." 19 20tar $(for i in $EXCLUDE; do echo "--exclude $i"; done) -cvzf $OUTPUT /boot/system /bin /etc /packages /system /tmp 21 22if [ $? -ne 0 ]; then 23 echo "Error creating sysroot package!" 24 return 1; 25fi 26 27echo "sysroot $OUTPUT successfully created!" 28