Browse Source

initial package creation

Signed-off-by: Toshaan Bharvani <toshaan@powerel.org>
master
Toshaan Bharvani 3 weeks ago
commit
82f4071c4a
  1. 63
      SOURCES/apcu-5.1.19.ini
  2. 9
      SOURCES/apcu-panel.conf
  3. 23
      SOURCES/apcu.conf.php
  4. 226
      SPECS/php-pecl-apcu.spec

63
SOURCES/apcu-5.1.19.ini

@ -0,0 +1,63 @@ @@ -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

9
SOURCES/apcu-panel.conf

@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
# APC Control Panel
Alias /apcu-panel /usr/share/apcu-panel

<Directory /usr/share/apcu-panel>
<IfModule mod_authz_core.c>
Require local
</IfModule>
</Directory>

23
SOURCES/apcu.conf.php

@ -0,0 +1,23 @@ @@ -0,0 +1,23 @@
<?php
define('USE_AUTHENTICATION',1); // Use (internal) authentication - best choice if
// no other authentication is available
// If set to 0:
// There will be no further authentication. You
// will have to handle this by yourself!
// If set to 1:
// You need to change ADMIN_PASSWORD to make
// this work!
define('ADMIN_USERNAME','apc'); // Admin Username
define('ADMIN_PASSWORD','password'); // Admin Password - CHANGE THIS TO ENABLE!!!

// (beckerr) I'm using a clear text password here, because I've no good idea how to let
// users generate a md5 or crypt password in a easy way to fill it in above

//define('DATE_FORMAT', "d.m.Y H:i:s"); // German
//define('DATE_FORMAT', "d/m/Y H:i:s"); // French
define('DATE_FORMAT', 'Y/m/d H:i:s'); // US

define('GRAPH_SIZE',200); // Image size

//define('PROXY', 'tcp://127.0.0.1:8080');

226
SPECS/php-pecl-apcu.spec

@ -0,0 +1,226 @@ @@ -0,0 +1,226 @@
%undefine _strict_symbol_defs_build
%bcond_without tests

%global gh_commit b771cd50a7fe519b6aaccbe5dc97594e68e0c88f
%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
%global gh_owner krakjoe
%global gh_project apcu
%global pecl_name apcu
%global with_zts 0%{!?_without_zts:%{?__ztsphp:1}}
%global ini_name 40-%{pecl_name}.ini
%global sources %{pecl_name}-%{version}
%global _configure ../%{sources}/configure

Name: php-pecl-apcu
Version: 5.1.24
Release: 1%{dist}
License: PHP-3.01
URL: https://pecl.php.net/package/APCu
Summary: APC User Cache
Release: 2%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
Source0: https://pecl.php.net/get/%{pecl_name}-%{version}.tgz
Source1: %{pecl_name}-5.1.19.ini
Source2: %{pecl_name}-panel.conf
Source3: %{pecl_name}.conf.php

BuildRequires: make
BuildRequires: gcc
BuildRequires: php-devel >= 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
Loading…
Cancel
Save