From a555a6d865c9dc68e52aedbc893532c1743fbcc6 Mon Sep 17 00:00:00 2001
From: Jeremy Soller <jeremy@system76.com>
Date: Wed, 20 May 2020 21:16:30 -0600
Subject: [PATCH] Add libxml2 and xz recipe.toml

---
 recipes/libxml2/recipe.toml | 33 +++++++++++++++++++++++++++++++++
 recipes/xz/recipe.toml      | 34 ++++++++++++++++++++++++++++++++++
 2 files changed, 67 insertions(+)
 create mode 100644 recipes/libxml2/recipe.toml
 create mode 100644 recipes/xz/recipe.toml

diff --git a/recipes/libxml2/recipe.toml b/recipes/libxml2/recipe.toml
new file mode 100644
index 000000000..befedf226
--- /dev/null
+++ b/recipes/libxml2/recipe.toml
@@ -0,0 +1,33 @@
+[source]
+tar = "ftp://xmlsoft.org/libxml2/libxml2-2.9.9.tar.gz"
+
+[build]
+template = "custom"
+dependencies = [
+    "xz",
+    "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 \
+    --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
+"""
diff --git a/recipes/xz/recipe.toml b/recipes/xz/recipe.toml
new file mode 100644
index 000000000..8130662d8
--- /dev/null
+++ b/recipes/xz/recipe.toml
@@ -0,0 +1,34 @@
+[source]
+tar = "https://codeload.github.com/xz-mirror/xz/tar.gz/v5.2.3"
+patches = [
+    "01-no-poll.patch",
+    "02-o_noctty.patch",
+    "03-no-signals.patch"
+]
+
+[build]
+template = "custom"
+script = """
+#TODO: simpler recipe
+rsync -av --delete "${COOKBOOK_SOURCE}/" ./
+
+./autogen.sh
+
+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 \
+    --with-pic=no
+make -j "$(nproc)"
+make install DESTDIR="${COOKBOOK_STAGE}"
+"""
-- 
GitLab