rust/build.sh

68 lines
1.3 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
2020-05-10 14:54:30 +00:00
#set -x
set -e
codegen_channel=debug
sysroot_channel=debug
flags=
while [[ $# -gt 0 ]]; do
case $1 in
--release)
codegen_channel=release
shift
;;
--release-sysroot)
sysroot_channel=release
shift
;;
--no-default-features)
flags="$flags --no-default-features"
shift
;;
--features)
shift
flags="$flags --features $1"
shift
;;
*)
echo "Unknown option $1"
exit 1
;;
esac
done
if [ -f ./gcc_path ]; then
export GCC_PATH=$(cat gcc_path)
else
echo 'Please put the path to your custom build of libgccjit in the file `gcc_path`, see Readme.md for details'
exit 1
fi
2020-05-10 14:54:30 +00:00
export LD_LIBRARY_PATH="$GCC_PATH"
export LIBRARY_PATH="$GCC_PATH"
if [[ "$codegen_channel" == "release" ]]; then
2020-05-10 14:54:30 +00:00
export CHANNEL='release'
CARGO_INCREMENTAL=1 cargo rustc --release $flags
2020-05-10 14:54:30 +00:00
else
echo $LD_LIBRARY_PATH
export CHANNEL='debug'
cargo rustc $flags
2020-05-10 14:54:30 +00:00
fi
source config.sh
rm -r target/out || true
mkdir -p target/out/gccjit
echo "[BUILD] sysroot"
if [[ "$sysroot_channel" == "release" ]]; then
time ./build_sysroot/build_sysroot.sh --release
else
time ./build_sysroot/build_sysroot.sh
fi