From 2348e1cc27724d7136b44ecf7719bc742e5feeac Mon Sep 17 00:00:00 2001
From: Jeremy Soller <jackpot51@gmail.com>
Date: Wed, 2 Nov 2016 21:55:41 -0600
Subject: [PATCH] Compile in release mode

---
 cook.sh                           |  4 ++--
 setup.sh                          | 11 +++++++----
 targets/x86_64-unknown-redox.json |  3 ++-
 3 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/cook.sh b/cook.sh
index 875e78cb7..45a78038d 100755
--- a/cook.sh
+++ b/cook.sh
@@ -33,7 +33,7 @@ function op {
             ;;
         build)
             pushd build > /dev/null
-            xargo build --target "$TARGET" $CARGOFLAGS
+            xargo build --target "$TARGET" --release $CARGOFLAGS
             popd > /dev/null
             ;;
         clean)
@@ -49,7 +49,7 @@ function op {
                 recipe_stage ../stage
             fi
             #TODO xargo install --root "../stage" $CARGOFLAGS
-            bins="$(find target/x86_64-unknown-redox/debug/ -maxdepth 1 -type f ! -name '*.*')"
+            bins="$(find target/x86_64-unknown-redox/release/ -maxdepth 1 -type f ! -name '*.*')"
             if [ -n "$bins" ]
             then
                 mkdir -p ../stage/bin
diff --git a/setup.sh b/setup.sh
index 395d2b639..e33761713 100755
--- a/setup.sh
+++ b/setup.sh
@@ -3,16 +3,19 @@
 set -e
 
 echo "Defaulting to rust nightly"
-rustup default nightly
+rustup override set nightly
 echo "Downloading rust source"
 rustup component add rust-src
-echo "Installing xargo"
-cargo install -f xargo
+if [ -z "$(which xargo)" ]
+then
+    echo "Installing xargo"
+    cargo install -f xargo
+fi
 
 echo "Building libstd"
 ./cook.sh libstd unfetch
 ./cook.sh libstd fetch
 ./cook.sh libstd build
-cp recipes/libstd/build/target/x86_64-unknown-redox/debug/deps/*.rlib ~/.xargo/lib/rustlib/x86_64-unknown-redox/lib/
+cp recipes/libstd/build/target/x86_64-unknown-redox/release/deps/*.rlib ~/.xargo/lib/rustlib/x86_64-unknown-redox/lib/
 
 echo "cook.sh is ready to use"
diff --git a/targets/x86_64-unknown-redox.json b/targets/x86_64-unknown-redox.json
index 3d6de4746..8878e06ed 100644
--- a/targets/x86_64-unknown-redox.json
+++ b/targets/x86_64-unknown-redox.json
@@ -9,7 +9,8 @@
     "vendor": "unknown",
     "target-family": "redox",
     "pre-link-args": ["-m64", "-nostdlib", "-static"],
-    "features": "-sse3,-ssse3,-sse4.1,-sse4.2,-3dnow,-3dnowa,-avx,-avx2",
+    "post-link-args": ["build/userspace/libopenlibm.a"],
+    "features": "",
     "dynamic-linking": false,
     "executables": true,
     "relocation-model": "static",
-- 
GitLab