From 15d9970802462ddc551d1f4f66506fa5b8f54146 Mon Sep 17 00:00:00 2001
From: Ron Williams <ron.williams.redox@gmail.com>
Date: Sat, 27 Jan 2024 13:23:27 +0000
Subject: [PATCH] move helix to tools, with working recipe, plus fix
 COOKBOOK_DEBUG

---
 recipes/tools/helix/recipe.toml | 16 ++++++++++++++++
 recipes/wip/helix/recipe.toml   |  9 ---------
 src/bin/cook.rs                 |  7 +++++--
 3 files changed, 21 insertions(+), 11 deletions(-)
 create mode 100644 recipes/tools/helix/recipe.toml
 delete mode 100644 recipes/wip/helix/recipe.toml

diff --git a/recipes/tools/helix/recipe.toml b/recipes/tools/helix/recipe.toml
new file mode 100644
index 000000000..09b594881
--- /dev/null
+++ b/recipes/tools/helix/recipe.toml
@@ -0,0 +1,16 @@
+#TODO signal handling is disabled, it should be re-enabled when Redox is ready
+#TODO language files are not built, only the "hx" editor is built
+#TODO Consider adding `export RUSTFLAGS+="-C target-feature=-crt-static"` when adding language support
+#TODO configuration - https://docs.helix-editor.com/install.html#configuring-helixs-runtime-files
+[source]
+git = "https://gitlab.redox-os.org/redox-os/helix.git"
+branch = "redox"
+
+[build]
+template = "custom"
+script = """
+export HELIX_DISABLE_AUTO_GRAMMAR_BUILD=1
+COOKBOOK_SOURCE+="/helix-term"
+cookbook_cargo
+"""
+
diff --git a/recipes/wip/helix/recipe.toml b/recipes/wip/helix/recipe.toml
deleted file mode 100644
index 27490396f..000000000
--- a/recipes/wip/helix/recipe.toml
+++ /dev/null
@@ -1,9 +0,0 @@
-#TODO program source code error
-#TODO configuration - https://docs.helix-editor.com/install.html#configuring-helixs-runtime-files
-[source]
-tar = "https://github.com/helix-editor/helix/releases/download/23.10/helix-23.10-source.tar.xz"
-[build]
-template = "custom"
-script = """
-cookbook_cargo_packages helix-term
-"""
diff --git a/src/bin/cook.rs b/src/bin/cook.rs
index b2bf5c86c..5767d7cac 100644
--- a/src/bin/cook.rs
+++ b/src/bin/cook.rs
@@ -453,9 +453,12 @@ export PKG_CONFIG_SYSROOT_DIR="${COOKBOOK_SYSROOT}"
 # to not strip symbols from the final package, add COOKBOOK_NOSTRIP=true to the recipe
 # (or to your environment) before calling cookbook_cargo or cookbook_cargo_packages
 build_type=release
+install_flags=
+build_flags=--release
 if [ ! -z "${COOKBOOK_DEBUG}" ]
 then
     install_flags=--debug
+    build_flags=
     build_type=debug
 fi
 
@@ -479,7 +482,7 @@ function cookbook_cargo_examples {
         "${COOKBOOK_CARGO}" build \
             --manifest-path "${COOKBOOK_SOURCE}/Cargo.toml" \
             --example "${example}" \
-            --${build_type}
+            ${build_flags}
         mkdir -pv "${COOKBOOK_STAGE}/usr/bin"
         cp -v \
             "target/${TARGET}/${build_type}/examples/${example}" \
@@ -495,7 +498,7 @@ function cookbook_cargo_packages {
         "${COOKBOOK_CARGO}" build \
             --manifest-path "${COOKBOOK_SOURCE}/Cargo.toml" \
             --package "${package}" \
-            --${build_type}
+            ${build_flags}
         mkdir -pv "${COOKBOOK_STAGE}/usr/bin"
         cp -v \
             "target/${TARGET}/${build_type}/${package}" \
-- 
GitLab