From 26d207c535feb8cb275e55836c111838fc019d26 Mon Sep 17 00:00:00 2001
From: Jeremy Soller <jeremy@system76.com>
Date: Fri, 11 Jan 2019 19:50:18 -0700
Subject: [PATCH] Add all examples to webrender

---
 recipes/webrender/recipe.sh | 28 +++++++++++++++++-----------
 1 file changed, 17 insertions(+), 11 deletions(-)

diff --git a/recipes/webrender/recipe.sh b/recipes/webrender/recipe.sh
index fe7571553..8b640f878 100644
--- a/recipes/webrender/recipe.sh
+++ b/recipes/webrender/recipe.sh
@@ -2,26 +2,32 @@ GIT=https://gitlab.redox-os.org/redox-os/webrender.git
 GIT_UPSTREAM=https://github.com/servo/webrender.git
 BRANCH=redox
 BUILD_DEPENDS=(freetype libpng llvm mesa zlib)
-CARGOFLAGS="--manifest-path examples/Cargo.toml --bin basic"
 
 function recipe_build {
     sysroot="$(realpath ../sysroot)"
     cp -p "$ROOT/Xargo.toml" "Xargo.toml"
-    set -x
-    xargo rustc --target "$TARGET" --release ${CARGOFLAGS} \
-        -- \
-        -L "${sysroot}/lib" \
-        -l static=freetype \
-        -l static=png \
-        -C link-args="$("${PKG_CONFIG}" --libs osmesa) -lglapi -lz -lstdc++ -lc -lgcc"
-    set +x
+    for rs in $(find examples/ -maxdepth 1 -type f -name '*.rs')
+    do
+        bin="$(basename "$rs" .rs)"
+        set -x
+        xargo rustc --target "$TARGET" --release --manifest-path examples/Cargo.toml --bin "$bin" \
+            -- \
+            -L "${sysroot}/lib" \
+            -l static=freetype \
+            -l static=png \
+            -C link-args="$("${PKG_CONFIG}" --libs osmesa) -lglapi -lz -lstdc++ -lc -lgcc"
+        set +x
+    done
     skip=1
 }
 
-
 function recipe_stage {
     dest="$(realpath $1)"
     mkdir -pv "$dest/bin"
-    cp -v "target/${TARGET}/release/basic" "$dest/bin/webrender"
+    for rs in $(find examples/ -maxdepth 1 -type f -name '*.rs')
+    do
+        bin="$(basename "$rs" .rs)"
+        "${STRIP}" -v "target/$TARGET/release/$bin" -o "$dest/bin/webrender_$bin"
+    done
     skip=1
 }
-- 
GitLab