From d16c60277ace3b07ad0ee78e7814cc2dbd718de1 Mon Sep 17 00:00:00 2001
From: Andy Postnikov <apostnikov@gmail.com>
Date: Sat, 27 Jul 2024 11:52:56 +0200
Subject: [PATCH] testing/php84-spx: new aport

---
 testing/php84-spx/APKBUILD        | 41 +++++++++++++++++++++++++++++++
 testing/php84-spx/fix-build.patch | 11 +++++++++
 2 files changed, 52 insertions(+)
 create mode 100644 testing/php84-spx/APKBUILD
 create mode 100644 testing/php84-spx/fix-build.patch

diff --git a/testing/php84-spx/APKBUILD b/testing/php84-spx/APKBUILD
new file mode 100644
index 000000000000..6ffeff8f250c
--- /dev/null
+++ b/testing/php84-spx/APKBUILD
@@ -0,0 +1,41 @@
+# Maintainer: Andy Postnikov <apostnikov@gmail.com>
+pkgname=php84-spx
+_extname=spx
+pkgver=0.4.16
+pkgrel=0
+pkgdesc="A simple & straight-to-the-point PHP 8.4 profiling extension with its built-in web UI"
+url="https://github.com/NoiseByNorthwest/php-spx"
+arch="x86_64 aarch64"
+license="GPL-3.0-or-later"
+_phpv=84
+_php=php$_phpv
+depends="$_php-common"
+makedepends="$_php-dev zlib-dev"
+checkdepends="$_php-cgi"
+source="php-$_extname-$pkgver.tar.gz::https://github.com/NoiseByNorthwest/php-spx/archive/v$pkgver.tar.gz
+	fix-build.patch"
+builddir="$srcdir/php-$_extname-$pkgver"
+
+build() {
+	phpize$_phpv
+	./configure --prefix=/usr --with-php-config=php-config$_phpv
+	make
+}
+
+check() {
+	TEST_PHP_CGI_EXECUTABLE=/usr/bin/php-cgi$_phpv \
+	make NO_INTERACTION=1 REPORT_EXIT_STATUS=1 test TESTS=--show-diff
+	$_php -d extension=modules/$_extname.so --ri $_extname
+}
+
+package() {
+	make INSTALL_ROOT="$pkgdir" install
+	local _confdir="$pkgdir"/etc/$_php/conf.d
+	install -d $_confdir
+	echo "extension=$_extname" > $_confdir/$_extname.ini
+}
+
+sha512sums="
+9679ac1c527139e3f6cd22925ec2035ff0b829da7e506244d220c36480f79a23851de01ba6c164e59f7cb52a133683f1ba5bada7fd485abd55b364839026e1c9  php-spx-0.4.16.tar.gz
+cc6aaccb80c9b23bf7ee454ecfe30acef2c316bae3df922b7cc258e637f71b07ce8fa80dfe9cd75fbc4572bf0fc092ba242c31b11f5413f555148419e4fb3d2d  fix-build.patch
+"
diff --git a/testing/php84-spx/fix-build.patch b/testing/php84-spx/fix-build.patch
new file mode 100644
index 000000000000..f1cf850f25a1
--- /dev/null
+++ b/testing/php84-spx/fix-build.patch
@@ -0,0 +1,11 @@
+--- a/src/php_spx.h
++++ b/src/php_spx.h
+@@ -31,7 +31,7 @@
+ #   error "Only x86-64 and ARM64 architectures are supported"
+ #endif
+ 
+-#if ZEND_MODULE_API_NO < 20100525 || ZEND_MODULE_API_NO > 20230831 // 8.3-RC5
++#if ZEND_MODULE_API_NO < 20100525 || ZEND_MODULE_API_NO > 20230901 // 8.4-alpha2
+ #   error "Only the following PHP versions are supported: 5.4 to 8.3"
+ #endif
+ 
-- 
GitLab