From 82f4071c4aaa4adbd615214d0e9d39f7506d5c00 Mon Sep 17 00:00:00 2001 From: Toshaan Bharvani Date: Mon, 2 Dec 2024 15:35:16 +0100 Subject: [PATCH] initial package creation Signed-off-by: Toshaan Bharvani --- SOURCES/apcu-5.1.19.ini | 63 +++++++++++ SOURCES/apcu-panel.conf | 9 ++ SOURCES/apcu.conf.php | 23 ++++ SPECS/php-pecl-apcu.spec | 226 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 321 insertions(+) create mode 100644 SOURCES/apcu-5.1.19.ini create mode 100644 SOURCES/apcu-panel.conf create mode 100644 SOURCES/apcu.conf.php create mode 100644 SPECS/php-pecl-apcu.spec diff --git a/SOURCES/apcu-5.1.19.ini b/SOURCES/apcu-5.1.19.ini new file mode 100644 index 0000000..dacb938 --- /dev/null +++ b/SOURCES/apcu-5.1.19.ini @@ -0,0 +1,63 @@ +; Enable APCu extension module +extension = apcu.so + +; This can be set to 0 to disable APCu +apc.enabled=1 + +; Setting this enables APCu for the CLI version of PHP +; (Mostly for testing and debugging). +;apc.enable_cli=0 + +; Sets the path to text files containing caches to load from disk upon +; initialization of APCu. preload_path should be a directory where each +; file follows $key.data where $key should be used as the entry name +; and the contents of the file contains serialized data to use as the value +; of the entry. +;apc.preload_path= + +; The size of each shared memory segment, with M/G suffixe +;apc.shm_size=32M + +; The number of seconds a cache entry is allowed to idle in a slot in case +; this cache entry slot is needed by another entry. +;apc.ttl=0 + +; The number of seconds that a cache entry may remain on the +; garbage-collection list. +;apc.gc_ttl=3600 + +; If you begin to get low on resources, an expunge of the cache +; is performed if it is less than half full. This is not always +; a suitable way of determining if an expunge of the cache +; should be per apc.smart allows you to set a runtime configuration +; value which is used to determine if an expunge should be run +; if (available_size < apc.smart * requested_size) +;apc.smart=0 + +; A "hint" about the number variables expected in the cache. +; Set to zero or omit if you are not sure; +;apc.entries_hint=4096 + +; The mktemp-style file_mask to pass to the mmap module +apc.mmap_file_mask=/tmp/apc.XXXXXX + +; On very busy servers whenever you start the server or +; modify files you can create a race of many processes +; all trying to cache the same data at the same time. +; By default, APCu attempts to prevent "slamming" of a key. +; A key is considered "slammed" if it was the last key set, +; and a context other than the current one set it ( ie. it +; was set by another process or thread ) +;apc.slam_defense=0 + +; Defines which serializer should be used +; Default is the standard PHP serializer. +;apc.serializer='php' + +; use the SAPI request start time for TTL +;apc.use_request_time=0 + +; Enables APCu handling of signals, such as SIGSEGV, that write core files +; when signaled. APCu will attempt to unmap the shared memory segment in +; order to exclude it from the core file +;apc.coredump_unmap=0 diff --git a/SOURCES/apcu-panel.conf b/SOURCES/apcu-panel.conf new file mode 100644 index 0000000..de7d690 --- /dev/null +++ b/SOURCES/apcu-panel.conf @@ -0,0 +1,9 @@ +# APC Control Panel +Alias /apcu-panel /usr/share/apcu-panel + + + + Require local + + + diff --git a/SOURCES/apcu.conf.php b/SOURCES/apcu.conf.php new file mode 100644 index 0000000..8ed5320 --- /dev/null +++ b/SOURCES/apcu.conf.php @@ -0,0 +1,23 @@ += 7.0 +BuildRequires: php-pear + +Requires: php(zend-abi) = %{php_zend_api} +Requires: php(api) = %{php_core_api} + +Obsoletes: php-apcu < 4.0.0-1 +Provides: php-apcu = %{version} +Provides: php-apcu%{?_isa} = %{version} +Provides: php-pecl(apcu) = %{version} +Provides: php-pecl(apcu)%{?_isa} = %{version} + + +%description +APCu is userland caching: APC stripped of opcode caching. + +APCu only supports userland caching of variables. + + +%package devel +Summary: APCu developer files (header) +Requires: %{name}%{?_isa} = %{version}-%{release} +Requires: %{?scl_prefix}php-devel%{?_isa} + +Obsoletes: %{?scl_prefix}php-pecl-apc-devel < 4 +Provides: %{?scl_prefix}php-pecl-apc-devel = %{version}-%{release} +Provides: %{?scl_prefix}php-pecl-apc-devel%{?_isa} = %{version}-%{release} + +%description devel +These are the files needed to compile programs using APCu. + + +%package -n apcu-panel +Summary: APCu control panel +BuildArch: noarch +Requires: %{name} = %{version}-%{release} +Requires: php(httpd) +Requires: php-gd +Requires: httpd + +Obsoletes: apc-panel < 4 +Provides: apc-panel = %{version}-%{release} + +%description -n apcu-panel +This package provides the APCu control panel, with Apache +configuration, available on http://localhost/apcu-panel/ + + +%prep +%setup -qc +sed -e '/LICENSE/s/role="doc"/role="src"/' -i package.xml + +cd %{sources} +# Sanity check, really often broken +extver=$(sed -n '/#define PHP_APCU_VERSION/{s/.* "//;s/".*$//;p}' php_apc.h) +if test "x${extver}" != "x%{version}%{?prever}"; then + : Error: Upstream extension version is ${extver}, expecting %{version}%{?prever}. + exit 1 +fi +cd .. + +mkdir NTS +%if %{with_zts} +mkdir ZTS +%endif + +%if 0%{!?scl:1} +# Fix path to configuration file +sed -e s:apc.conf.php:%{_sysconfdir}/apcu-panel/conf.php:g \ + -i %{sources}/apc.php +%else +# Provide the control panel as doc +sed -e '/"apc.php"/s/role="src"/role="doc"/' -i package.xml +%endif + +%build +%{?dtsenable} + +cd %{sources} +%{__phpize} +[ -f Makefile.global ] && GLOBAL=Makefile.global || GLOBAL=build/Makefile.global +sed -e 's/INSTALL_ROOT/DESTDIR/' -i $GLOBAL + +cd ../NTS +%configure \ + --enable-apcu \ + --with-php-config=%{__phpconfig} +%make_build + +%if %{with_zts} +cd ../ZTS +%configure \ + --enable-apcu \ + --with-php-config=%{__ztsphpconfig} +%make_build +%endif + + +%install +%{?dtsenable} + +# Install the NTS stuff +%make_install -C NTS +install -D -m 644 %{SOURCE1} %{buildroot}%{php_inidir}/%{ini_name} + +%if %{with_zts} +# Install the ZTS stuff +%make_install -C ZTS +install -D -m 644 %{SOURCE1} %{buildroot}%{php_ztsinidir}/%{ini_name} +%endif + +# Install the package XML file +install -D -m 644 package.xml %{buildroot}%{pecl_xmldir}/%{name}.xml + +# Install the Control Panel +# Pages +install -D -m 644 -p %{sources}/apc.php \ + %{buildroot}%{_datadir}/apcu-panel/index.php +# Apache config +install -D -m 644 -p %{SOURCE2} \ + %{buildroot}%{_sysconfdir}/httpd/conf.d/apcu-panel.conf +# Panel config +install -D -m 644 -p %{SOURCE3} \ + %{buildroot}%{_sysconfdir}/apcu-panel/conf.php + + +# Test & Documentation +cd %{sources} +for i in $(grep 'role="test"' ../package.xml | sed -e 's/^.*name="//;s/".*$//') +do [ -f $i ] && install -Dpm 644 $i %{buildroot}%{pecl_testdir}/%{pecl_name}/$i + [ -f tests/$i ] && install -Dpm 644 tests/$i %{buildroot}%{pecl_testdir}/%{pecl_name}/tests/$i +done +for i in $(grep 'role="doc"' ../package.xml | sed -e 's/^.*name="//;s/".*$//') +do install -Dpm 644 $i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i +done + + +%check +cd %{sources} + +%{_bindir}/php -n \ + -d extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \ + -m | grep '^apcu$' + +%if %{with tests} +# Upstream test suite for NTS extension +TEST_PHP_EXECUTABLE=%{__php} \ +TEST_PHP_ARGS="-n -d extension=%{buildroot}%{php_extdir}/%{pecl_name}.so" \ +REPORT_EXIT_STATUS=1 \ +%{__php} -n run-tests.php -q --show-diff +%endif + +%if %{with_zts} +%{__ztsphp} -n \ + -d extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so \ + -m | grep '^apcu$' + +%if %{with tests} +# Upstream test suite for ZTS extension +TEST_PHP_EXECUTABLE=%{__ztsphp} \ +TEST_PHP_ARGS="-n -d extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so" \ +REPORT_EXIT_STATUS=1 \ +%{__ztsphp} -n run-tests.php -q --show-diff +%endif +%endif + + +%files +%license %{sources}/LICENSE +%doc %{pecl_docdir}/%{pecl_name} +%{pecl_xmldir}/%{name}.xml + +%config(noreplace) %{php_inidir}/%{ini_name} +%{php_extdir}/%{pecl_name}.so + +%if %{with_zts} +%config(noreplace) %{php_ztsinidir}/%{ini_name} +%{php_ztsextdir}/%{pecl_name}.so +%endif + + +%files devel +%doc %{pecl_testdir}/%{pecl_name} +%{php_incldir}/ext/%{pecl_name} + +%if %{with_zts} +%{php_ztsincldir}/ext/%{pecl_name} +%endif + + +%files -n apcu-panel +# Need to restrict access, as it contains a clear password +%attr(550,apache,root) %dir %{_sysconfdir}/apcu-panel +%config(noreplace) %{_sysconfdir}/apcu-panel/conf.php +%config(noreplace) %{_sysconfdir}/httpd/conf.d/apcu-panel.conf +%{_datadir}/apcu-panel + + +%changelog