From 79a34ff948489c53da0d670b14cde956268a0699 Mon Sep 17 00:00:00 2001
From: Jeremy Soller <jackpot51@gmail.com>
Date: Fri, 16 Dec 2022 10:28:52 -0700
Subject: [PATCH] Update pathfinder recipe

---
 recipes/pathfinder/recipe.sh   | 25 -------------------------
 recipes/pathfinder/recipe.toml | 23 +++++++++++++++++++++++
 2 files changed, 23 insertions(+), 25 deletions(-)
 delete mode 100644 recipes/pathfinder/recipe.sh
 create mode 100644 recipes/pathfinder/recipe.toml

diff --git a/recipes/pathfinder/recipe.sh b/recipes/pathfinder/recipe.sh
deleted file mode 100644
index 37f8eb446..000000000
--- a/recipes/pathfinder/recipe.sh
+++ /dev/null
@@ -1,25 +0,0 @@
-GIT=https://gitlab.redox-os.org/redox-os/pathfinder.git
-BRANCH=redox
-GIT_UPSTREAM=https://github.com/servo/pathfinder.git
-BUILD_DEPENDS=(llvm mesa zlib)
-BRANCH=redox
-CARGOFLAGS="--manifest-path examples/canvas_glutin_minimal/Cargo.toml"
-
-function recipe_build {
-    sysroot="$(realpath ../sysroot)"
-    cp -p "$ROOT/Xargo.toml" "Xargo.toml"
-    set -x
-    xargo rustc --target "$TARGET" --release ${CARGOFLAGS} \
-        -- \
-        -L "${sysroot}/lib" \
-        -C link-args="$("${PKG_CONFIG}" --libs osmesa) -lglapi -lz -lstdc++ -lc -lgcc"
-    set +x
-    skip=1
-}
-
-function recipe_stage {
-    dest="$(realpath $1)"
-    mkdir -pv "$dest/bin"
-    cp -v "target/${TARGET}/release/canvas_glutin_minimal" "$dest/bin/pathfinder"
-    skip=1
-}
diff --git a/recipes/pathfinder/recipe.toml b/recipes/pathfinder/recipe.toml
new file mode 100644
index 000000000..358b0a2aa
--- /dev/null
+++ b/recipes/pathfinder/recipe.toml
@@ -0,0 +1,23 @@
+[source]
+git = "https://gitlab.redox-os.org/redox-os/pathfinder.git"
+branch = "redox"
+upstream = "https://github.com/servo/pathfinder.git"
+
+[build]
+template = "custom"
+dependencies = [
+    "llvm",
+    "mesa",
+    "zlib",
+]
+script = """
+cargo rustc \
+    --target "$TARGET" \
+    --release \
+    --manifest-path "${COOKBOOK_SOURCE}/examples/canvas_glutin_minimal/Cargo.toml" \
+    -- \
+    -L "${COOK_SYSROOT}/lib" \
+    -C link-args="-Wl,-Bstatic $("${TARGET}-pkg-config" --libs osmesa) -lz -lstdc++ -lc -lgcc"
+mkdir -pv "${COOKBOOK_STAGE}/bin"
+cp -v "target/${TARGET}/release/canvas_glutin_minimal" "${COOKBOOK_STAGE}/bin/pathfinder"
+"""
-- 
GitLab