From d2f5588d92a284f935d540ee9be7e4b7b7087f4d Mon Sep 17 00:00:00 2001
From: Jeremy Soller <jackpot51@gmail.com>
Date: Mon, 31 Oct 2016 12:49:59 -0600
Subject: [PATCH] Fix building of libstd

---
 .gitignore                                    |  1 +
 cook.sh                                       | 45 +++++++++++++++++++
 recipes/libstd/recipe.sh                      |  1 +
 recipes/smith/recipe.sh                       |  1 +
 .../x86_64-unknown-redox.json                 |  0
 5 files changed, 48 insertions(+)
 create mode 100644 .gitignore
 create mode 100755 cook.sh
 create mode 100644 recipes/libstd/recipe.sh
 create mode 100755 recipes/smith/recipe.sh
 rename x86_64-unknown-redox.json => targets/x86_64-unknown-redox.json (100%)

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000..378eac25d
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+build
diff --git a/cook.sh b/cook.sh
new file mode 100755
index 000000000..9d7d11386
--- /dev/null
+++ b/cook.sh
@@ -0,0 +1,45 @@
+export RUST_TARGET_PATH=`realpath targets`
+export RUSTFLAGS="--cfg redox"
+TARGET=x86_64-unknown-redox
+
+set -e
+
+if [ -n "$1" ]
+then
+    if [ -d "recipes/$1" ]
+    then
+        pushd "recipes/$1"
+        source recipe.sh
+        case "$2" in
+            build)
+                pushd build
+                xargo build --target "$TARGET"
+                popd
+                ;;
+            clean)
+                pushd build
+                xargo clean
+                popd
+                ;;
+            fetch)
+                git clone --recursive "$GIT" build
+                ;;
+            unfetch)
+                rm -rf build
+                ;;
+            update)
+                pushd build
+                xargo update
+                popd
+                ;;
+            *)
+                echo "$0 {package} {build|clean|fetch|update}"
+                ;;
+        esac
+        popd
+    else
+        echo "$0: recipe '$1' not found"
+    fi
+else
+    echo "$0 {package} {build|clean|fetch|update}"
+fi
diff --git a/recipes/libstd/recipe.sh b/recipes/libstd/recipe.sh
new file mode 100644
index 000000000..68680c5af
--- /dev/null
+++ b/recipes/libstd/recipe.sh
@@ -0,0 +1 @@
+GIT=https://github.com/redox-os/libstd.git
diff --git a/recipes/smith/recipe.sh b/recipes/smith/recipe.sh
new file mode 100755
index 000000000..9f38e91de
--- /dev/null
+++ b/recipes/smith/recipe.sh
@@ -0,0 +1 @@
+GIT=https://github.com/IGI-111/Smith.git
diff --git a/x86_64-unknown-redox.json b/targets/x86_64-unknown-redox.json
similarity index 100%
rename from x86_64-unknown-redox.json
rename to targets/x86_64-unknown-redox.json
-- 
GitLab