From b2a60668713ceb97400997a39eea9af51e718365 Mon Sep 17 00:00:00 2001
From: Jeremy Soller <jeremy@system76.com>
Date: Thu, 21 May 2020 11:14:24 -0600
Subject: [PATCH] Simplify recipes

---
 recipes/acid/recipe.toml    |  1 -
 recipes/ion/recipe.toml     |  1 -
 recipes/libxml2/recipe.toml | 24 +++---------------------
 recipes/xz/recipe.toml      | 25 +++++++++++++------------
 recipes/zlib/recipe.toml    |  6 +++---
 5 files changed, 19 insertions(+), 38 deletions(-)

diff --git a/recipes/acid/recipe.toml b/recipes/acid/recipe.toml
index 2c63247f6..1f1262905 100644
--- a/recipes/acid/recipe.toml
+++ b/recipes/acid/recipe.toml
@@ -1,6 +1,5 @@
 [source]
 git = "https://gitlab.redox-os.org/redox-os/acid.git"
-branch = "master"
 
 [build]
 template = "cargo"
diff --git a/recipes/ion/recipe.toml b/recipes/ion/recipe.toml
index 5ac9d4520..80c82e33e 100644
--- a/recipes/ion/recipe.toml
+++ b/recipes/ion/recipe.toml
@@ -1,6 +1,5 @@
 [source]
 git = "https://gitlab.redox-os.org/redox-os/ion.git"
-branch = "master"
 
 [build]
 template = "cargo"
diff --git a/recipes/libxml2/recipe.toml b/recipes/libxml2/recipe.toml
index befedf226..d99963e22 100644
--- a/recipes/libxml2/recipe.toml
+++ b/recipes/libxml2/recipe.toml
@@ -8,26 +8,8 @@ dependencies = [
     "zlib"
 ]
 script = """
-export CFLAGS="-I'${COOKBOOK_SYSROOT}/include'"
-export LDFLAGS="-L'${COOKBOOK_SYSROOT}/lib' --static"
-"${COOKBOOK_SOURCE}/configure" \
-    --host="${TARGET}" \
-    --prefix="" \
-    --disable-shared \
-    --enable-static \
+COOKBOOK_CONFIGURE_FLAGS+=(
     --without-python
-make -j "$(nproc)"
-make install DESTDIR="${COOKBOOK_STAGE}"
-
-# Strip binaries
-if [ -d "${COOKBOOK_STAGE}/bin" ]
-then
-    find "${COOKBOOK_STAGE}/bin" -type f -exec "${TARGET}-strip" -v {} ';'
-fi
-
-# Remove libtool files
-if [ -d "${COOKBOOK_STAGE}/lib" ]
-then
-    find "${COOKBOOK_STAGE}/lib" -type f -name '*.la' -exec rm -fv {} ';'
-fi
+)
+cookbook_configure
 """
diff --git a/recipes/xz/recipe.toml b/recipes/xz/recipe.toml
index 8130662d8..6180ff10b 100644
--- a/recipes/xz/recipe.toml
+++ b/recipes/xz/recipe.toml
@@ -18,17 +18,18 @@ chmod +w build-aux/config.sub
 wget -O build-aux/config.sub http://git.savannah.gnu.org/cgit/config.git/plain/config.sub
 
 export CFLAGS="-static"
-"./configure" \
-    --host="${TARGET}" \
-    --prefix="" \
-    --disable-lzmadec \
-    --disable-lzmainfo \
-    --disable-xz \
-    --disable-xzdec \
-    --enable-shared=no \
-    --enable-static=yes \
-    --enable-threads=no \
+COOKBOOK_CONFIGURE="./configure"
+COOKBOOK_CONFIGURE_FLAGS=(
+    --host="${TARGET}"
+    --prefix=""
+    --disable-lzmadec
+    --disable-lzmainfo
+    --disable-xz
+    --disable-xzdec
+    --enable-shared=no
+    --enable-static=yes
+    --enable-threads=no
     --with-pic=no
-make -j "$(nproc)"
-make install DESTDIR="${COOKBOOK_STAGE}"
+)
+cookbook_configure
 """
diff --git a/recipes/zlib/recipe.toml b/recipes/zlib/recipe.toml
index 178a62eda..11b97874f 100644
--- a/recipes/zlib/recipe.toml
+++ b/recipes/zlib/recipe.toml
@@ -6,9 +6,9 @@ template = "custom"
 script = """
     export LDFLAGS="--static"
     # See https://stackoverflow.com/questions/21396988/zlib-build-not-configuring-properly-with-cross-compiler-ignores-ar.
-    CHOST="${TARGET}" "${COOKBOOK_SOURCE}/configure" \
+    CHOST="${TARGET}" "${COOKBOOK_CONFIGURE}" \
         --prefix="" \
         --static
-    make -j "$(nproc)"
-    make install DESTDIR="${COOKBOOK_STAGE}"
+    "${COOKBOOK_MAKE}" -j "$(nproc)"
+    "${COOKBOOK_MAKE}" install DESTDIR="${COOKBOOK_STAGE}"
 """
-- 
GitLab