From a1f1a839cd3ff23247ecee6fabc3ddba843df36e Mon Sep 17 00:00:00 2001
From: Jeremy Soller <jackpot51@gmail.com>
Date: Wed, 9 Oct 2024 08:34:44 -0600
Subject: [PATCH] gstreamer: convert recipe to toml

---
 recipes/libs/gstreamer/recipe.sh   | 73 ------------------------------
 recipes/libs/gstreamer/recipe.toml | 68 ++++++++++++++++++++++++++++
 2 files changed, 68 insertions(+), 73 deletions(-)
 delete mode 100644 recipes/libs/gstreamer/recipe.sh
 create mode 100644 recipes/libs/gstreamer/recipe.toml

diff --git a/recipes/libs/gstreamer/recipe.sh b/recipes/libs/gstreamer/recipe.sh
deleted file mode 100644
index 735c0d885..000000000
--- a/recipes/libs/gstreamer/recipe.sh
+++ /dev/null
@@ -1,73 +0,0 @@
-VERSION=1.20.6
-TAR=https://gstreamer.freedesktop.org/src/gstreamer/gstreamer-$VERSION.tar.xz
-BUILD_DEPENDS=(gettext glib libffi libiconv pcre zlib)
-
-function recipe_version {
-    echo "$VERSION"
-    skip=1
-}
-
-function recipe_build {
-    sysroot="$(realpath ../sysroot)"
-    export GLIB_GENMARSHAL="$(which glib-genmarshal)"
-    export GLIB_MKENUMS="$(which glib-mkenums)"
-    export LDFLAGS="-static"
-
-    # TODO: Fix this annoying shite
-    echo "[binaries]" > cross_file.txt
-    echo "c = '${CC}'" >> cross_file.txt
-    echo "cpp = '${CXX}'" >> cross_file.txt
-    echo "ar = '${AR}'" >> cross_file.txt
-    echo "strip = '${STRIP}'" >> cross_file.txt
-    echo "pkgconfig = '${PKG_CONFIG}'" >> cross_file.txt
-
-    echo "[host_machine]" >> cross_file.txt
-	echo "system = 'redox'" >> cross_file.txt
-	echo "cpu_family = '$(echo "${TARGET}" | cut -d - -f1)'" >> cross_file.txt
-	echo "cpu = '$(echo "${TARGET}" | cut -d - -f1)'" >> cross_file.txt
-	echo "endian = 'little'" >> cross_file.txt
-
-	echo "[paths]" >> cross_file.txt
-	echo "prefix = '${sysroot}'" >> cross_file.txt
-	echo "libdir = 'lib'" >> cross_file.txt
-	echo "bindir = 'bin'" >> cross_file.txt
-
-	unset AR
-	unset AS
-	unset CC
-	unset CXX
-	unset LD
-	unset NM
-	unset OBJCOPY
-	unset OBJDUMP
-	unset PKG_CONFIG
-	unset RANLIB
-	unset READELF
-	unset STRIP
-
-	meson . _build \
-	    --cross-file cross_file.txt \
-	    --buildtype release \
-	    --strip \
-	    -Ddefault_library=static \
-	    -Dprefix=/ \
-	    -Dlibdir=lib \
-        -Dbenchmarks=disabled \
-        -Dcoretracers=disabled \
-        -Dexamples=disabled \
-        -Dtests=disabled
-	ninja -C _build -v
-    skip=1
-}
-
-function recipe_clean {
-    "$REDOX_MAKE" clean
-    skip=1
-}
-
-function recipe_stage {
-	dest="$(realpath $1)"
-	DESTDIR="$dest" ninja -C _build -v install
-	rm -f "$dest/lib/"*.la
-    skip=1
-}
diff --git a/recipes/libs/gstreamer/recipe.toml b/recipes/libs/gstreamer/recipe.toml
new file mode 100644
index 000000000..56fb4da4a
--- /dev/null
+++ b/recipes/libs/gstreamer/recipe.toml
@@ -0,0 +1,68 @@
+[source]
+tar = "https://gstreamer.freedesktop.org/src/gstreamer/gstreamer-1.20.6.tar.xz"
+blake3 = "d96a7fd8bb9bec309bc40ccafdbac3bd4d11d06a9be41c38337cea02deaea95d"
+patches = [
+	"redox.patch"
+]
+
+[build]
+template = "custom"
+dependencies = [
+	"gettext",
+	"glib",
+	"libffi",
+	"libiconv",
+	"pcre",
+	"zlib"
+]
+script = """
+export GLIB_GENMARSHAL="$(which glib-genmarshal)"
+export GLIB_MKENUMS="$(which glib-mkenums)"
+export LDFLAGS="-static"
+
+# TODO: Fix this annoying shite
+echo "[binaries]" > cross_file.txt
+echo "c = '${CC}'" >> cross_file.txt
+echo "cpp = '${CXX}'" >> cross_file.txt
+echo "ar = '${AR}'" >> cross_file.txt
+echo "strip = '${STRIP}'" >> cross_file.txt
+echo "pkgconfig = '${TARGET}-pkg-config'" >> cross_file.txt
+
+echo "[host_machine]" >> cross_file.txt
+echo "system = 'redox'" >> cross_file.txt
+echo "cpu_family = '$(echo "${TARGET}" | cut -d - -f1)'" >> cross_file.txt
+echo "cpu = '$(echo "${TARGET}" | cut -d - -f1)'" >> cross_file.txt
+echo "endian = 'little'" >> cross_file.txt
+
+echo "[paths]" >> cross_file.txt
+echo "prefix = '${COOKBOOK_SYSROOT}'" >> cross_file.txt
+echo "libdir = 'lib'" >> cross_file.txt
+echo "bindir = 'bin'" >> cross_file.txt
+
+unset AR
+unset AS
+unset CC
+unset CXX
+unset LD
+unset NM
+unset OBJCOPY
+unset OBJDUMP
+unset PKG_CONFIG
+unset RANLIB
+unset READELF
+unset STRIP
+
+meson setup "${COOKBOOK_SOURCE}" _build \
+	--cross-file cross_file.txt \
+	--buildtype release \
+	--strip \
+	-Ddefault_library=static \
+	-Dprefix=/ \
+	-Dlibdir=lib \
+	-Dbenchmarks=disabled \
+	-Dcoretracers=disabled \
+	-Dexamples=disabled \
+	-Dtests=disabled
+ninja -C _build -v
+DESTDIR="${COOKBOOK_STAGE}" ninja -C _build -v install
+"""
-- 
GitLab