summaryrefslogtreecommitdiffstats
path: root/php-noisebynorthwest-php-spx.spec
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2025-06-30 09:48:02 +0200
committerRemi Collet <remi@php.net>2025-06-30 09:48:02 +0200
commit9f62e861d77db6ec137a8450ee0651dfc5ddbc24 (patch)
tree5aa36bbd57b850d50b408121b33013fe2a9de0c2 /php-noisebynorthwest-php-spx.spec
initial package
Diffstat (limited to 'php-noisebynorthwest-php-spx.spec')
-rw-r--r--php-noisebynorthwest-php-spx.spec169
1 files changed, 169 insertions, 0 deletions
diff --git a/php-noisebynorthwest-php-spx.spec b/php-noisebynorthwest-php-spx.spec
new file mode 100644
index 0000000..6285d37
--- /dev/null
+++ b/php-noisebynorthwest-php-spx.spec
@@ -0,0 +1,169 @@
+# remirepo spec file for php-noisebynorthwest-php-spx
+#
+# SPDX-FileCopyrightText: Copyright 2025 Remi Collet
+# SPDX-License-Identifier: CECILL-2.1
+# http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+#
+# Please, preserve the changelog entries
+#
+
+%{?scl:%scl_package php-noisebynorthwest-php-spx}
+
+%bcond_without tests
+
+# Extension
+%global ext_name spx
+%global ini_name 40-%{ext_name}.ini
+%global upstream_version 0.4.19
+#global upstream_prever RC1
+# PIE / packagist
+%global pie_vend noisebynorthwest
+%global pie_proj php-spx
+# Github forge
+%global gh_vend NoiseByNorthwest
+%global gh_proj php-spx
+%global forgeurl https://github.com/%{gh_vend}/%{gh_proj}
+#global commit b3ae87353da524f33374ee0418ad48f704bb6af1
+%global tag v%{upstream_version}%{?upstream_prever}
+# for EL-8 to avoid TAG usage
+%global archivename %{gh_proj}-%{upstream_version}%{?upstream_prever}
+
+Summary: PHP profiling extension
+Name: %{?scl_prefix}php-%{pie_vend}-%{pie_proj}
+Version: %{upstream_version}%{?upstream_prever:~%{upstream_prever}}
+%forgemeta
+Release: 1%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}
+# GPL-3.0-only: php-spx
+# GPL-3.0-or-later: jscolor.js dataTable.js fmt.js layoutSplitter.js math.js profileData.js svg.js utils.js widget.js
+# MIT: jquery
+License: GPL-3.0-only AND GPL-3.0-or-later AND MIT
+URL: %{forgeurl}
+Source0: %{forgesource}
+
+BuildRequires: make
+BuildRequires: gcc
+BuildRequires: zlib-devel
+BuildRequires: %{?scl_prefix}php-devel
+
+Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api}
+Requires: %{?scl_prefix}php(api) = %{php_core_api}
+
+Provides: bundled(js-jscolor)
+Provides: bundled(js-jquery) = 3.2.1
+Provides: %{?scl_prefix}php-%{ext_name} = %{version}
+Provides: %{?scl_prefix}php-%{ext_name}%{?_isa} = %{version}
+Provides: %{?scl_prefix}php-pie(%{pie_vend}/%{pie_proj}) = %{version}
+
+
+%description
+SPX, which stands for Simple Profiling eXtension, is just another profiling
+extension for PHP.
+
+It differentiates itself from other similar extensions as being:
+
+* totally free and confined to your infrastructure
+ (i.e. no data leaks to a SaaS).
+* very simple to use: just set an environment variable (command line) or
+ switch on a radio button (web request) to profile your script.
+ Thus, you are free of:
+ * manually instrumenting your code (Ctrl-C a long running command line
+ script is even supported).
+ * using a dedicated browser extension or command line launcher.
+ multi metrics capable: 22 are currently supported (various time & memory
+ metrics, included files, objects in use, I/O...).
+* able to collect data without losing context. For example Xhprof (and
+ potentially its forks) aggregates data per caller / callee pairs, which
+ implies the loss of the full call stack and forbids timeline or Flamegraph
+ based analysis.
+* shipped with its web UI which allows to:
+ * enable / configure profiling for the current browser session
+ * list profiled script reports
+ * select a report for in-depth analysis, featuring these interactive
+ visualizations:
+ * timeline (scale to millions of function calls)
+ * flat profile
+ * Flamegraph
+
+Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')%{?scl: as Software Collection (%{scl} by %{?scl_vendor}%{!?scl_vendor:rh})}.
+
+
+%prep
+%forgesetup
+
+: Sanity check, really often broken
+extver=$(sed -n '/#define PHP_SPX_VERSION/{s/.* "//;s/".*$//;p}' src/php_spx.h)
+if test "x${extver}" != "x%{upstream_version}%{?upstream_prever}"; then
+ : Error: Upstream extension version is ${extver}, expecting %{version}.
+ exit 1
+fi
+
+: Create configuration file
+cat << 'EOF' | tee %{ini_name}
+; Enable the %{summary}
+extension=%{ext_name}.so
+;spx.debug = 0
+;spx.data_dir = /tmp/spx
+;spx.http_enabled =0
+;spx.http_key =
+;spx.http_ip_var = REMOTE_ADDR
+;spx.http_trusted_proxies =127.0.0.1
+;spx.http_ip_whitelist =
+;spx.http_ui_assets_dir = /usr/share/%{name}/assets/web-ui
+;spx.http_profiling_enabled =
+;spx.http_profiling_auto_start =
+;spx.http_profiling_builtins =
+;spx.http_profiling_sampling_period =
+;spx.http_profiling_depth =
+;spx.http_profiling_metrics =
+EOF
+
+: RPM build options and layout
+sed -e 's/CFLAGS/IGNORED_CFLAGS/' -i config.m4
+sed -e 's:misc/php-spx:%{name}:' -i Makefile.frag
+
+%build
+%{__phpize}
+[ -f Makefile.global ] && GLOBAL=Makefile.global || GLOBAL=build/Makefile.global
+sed -e 's/INSTALL_ROOT/DESTDIR/' -i $GLOBAL Makefile.frag
+
+%configure \
+ --enable-spx \
+ --with-libdir=%{_lib} \
+ --with-php-config=%{__phpconfig}
+
+%make_build
+
+
+%install
+%make_install
+
+# install config file
+install -D -m 644 %{ini_name} %{buildroot}%{php_inidir}/%{ini_name}
+
+
+%check
+: Minimal load test for the extension
+%{__php} --no-php-ini \
+ --define extension=%{buildroot}/%{php_extdir}/%{ext_name}.so \
+ --modules | grep -i '^%{ext_name}$'
+
+%if %{with tests}
+: Upstream test suite for the extension
+REPORT_EXIT_STATUS=1 \
+TEST_PHP_ARGS="-n -d extension=%{buildroot}/%{php_extdir}/%{ext_name}.so" \
+%{__php} -n run-tests.php -P -q --show-diff
+%endif
+
+
+%files
+%license LICENSE
+%doc composer.json
+%doc *.md
+%config(noreplace) %{php_inidir}/%{ini_name}
+%{php_extdir}/%{ext_name}.so
+%{_datadir}/%{name}
+
+
+%changelog
+* Mon Jun 30 2025 Remi Collet <remi@remirepo.net> - 0.4.19-1
+- initial package