about summary refs log tree commit diff
path: root/compiler/rustc_codegen_gcc/build.sh
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_codegen_gcc/build.sh')
-rwxr-xr-xcompiler/rustc_codegen_gcc/build.sh43
1 files changed, 38 insertions, 5 deletions
diff --git a/compiler/rustc_codegen_gcc/build.sh b/compiler/rustc_codegen_gcc/build.sh
index 17a0d2ab3f0..230ab7b6d42 100755
--- a/compiler/rustc_codegen_gcc/build.sh
+++ b/compiler/rustc_codegen_gcc/build.sh
@@ -3,7 +3,27 @@
 #set -x
 set -e
 
-if [ -f ./gcc_path ]; then 
+codegen_channel=debug
+sysroot_channel=debug
+
+while [[ $# -gt 0 ]]; do
+    case $1 in
+        --release)
+            codegen_channel=release
+            shift
+            ;;
+        --release-sysroot)
+            sysroot_channel=release
+            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'
@@ -13,13 +33,21 @@ fi
 export LD_LIBRARY_PATH="$GCC_PATH"
 export LIBRARY_PATH="$GCC_PATH"
 
-if [[ "$1" == "--release" ]]; then
+features=
+
+if [[ "$1" == "--features" ]]; then
+    shift
+    features="--features $1"
+    shift
+fi
+
+if [[ "$codegen_channel" == "release" ]]; then
     export CHANNEL='release'
-    CARGO_INCREMENTAL=1 cargo rustc --release
+    CARGO_INCREMENTAL=1 cargo rustc --release $features
 else
     echo $LD_LIBRARY_PATH
     export CHANNEL='debug'
-    cargo rustc
+    cargo rustc $features
 fi
 
 source config.sh
@@ -28,4 +56,9 @@ rm -r target/out || true
 mkdir -p target/out/gccjit
 
 echo "[BUILD] sysroot"
-time ./build_sysroot/build_sysroot.sh $CHANNEL
+if [[ "$sysroot_channel" == "release" ]]; then
+    time ./build_sysroot/build_sysroot.sh --release
+else
+    time ./build_sysroot/build_sysroot.sh
+fi
+