%define upstream_name PHP_Fork %define xmldir %{_var}/lib/pear %define peardir %(pear config-get php_dir 2> /dev/null) Name: php-pear-%{upstream_name} Version: 0.3.2 Release: %mkrel 2 Summary: Horde alarm libraries License: PHP License Group: Development/PHP Source0: http://pear.php.net/get/PHP_Fork-%{version}.tgz URL: http://pear.php.net/package/PHP_Fork BuildRequires: php-pear >= 1.4.7 BuildArch: noarch %description PHP_Fork class. Wrapper around the pcntl_fork() stuff with a API set like Java language. Practical usage is done by extending this class, and re-defining the run() method. [see basic example] This way PHP developers can enclose logic into a class that extends PHP_Fork, then execute the start() method that forks a child process. Communications with the forked process is ensured by using a Shared Memory Segment; by using a user-defined signal and this shared memory developers can access to child process methods that returns a serializable variable. The shared variable space can be accessed with the tho methods: o void setVariable($name, $value) o mixed getVariable($name) $name must be a valid PHP variable name; $value must be a variable or a serializable object. Resources (db connections, streams, etc.) cannot be serialized and so they're not correctly handled. Requires PHP build with --enable-cli --with-pcntl --enable-shmop. Only runs on *NIX systems, because Windows lacks of the pcntl ext. @example browser_pool.php an interactive tool to perform multiple cuncurrent request over an URL. @example simple_controller.php shows how to attach a controller to started pseudo-threads. @example exec_methods.php shows a workaround to execute methods into the child process. @example passing_vars.php shows variable exchange between the parent process and started pseudo-threads. @example basic.php a basic example, only two pseudo-threads that increment a counter simultaneously. %prep %setup -c -T pear -v -c pearrc \ -d php_dir=%{peardir} \ -d doc_dir=/docs \ -d bin_dir=%{_bindir} \ -d data_dir=%{peardir}/data \ -d test_dir=%{peardir}/tests \ -d ext_dir=%{_libdir} \ -s %build %install rm -rf %{buildroot} pear -c pearrc install --nodeps --packagingroot %{buildroot} %{SOURCE0} # Clean up unnecessary files rm pearrc rm %{buildroot}/%{peardir}/.filemap rm %{buildroot}/%{peardir}/.lock rm -rf %{buildroot}/%{peardir}/.registry rm -rf %{buildroot}%{peardir}/.channels rm %{buildroot}%{peardir}/.depdb rm %{buildroot}%{peardir}/.depdblock mv %{buildroot}/docs . # Install XML package description mkdir -p %{buildroot}%{xmldir} tar -xzf %{SOURCE0} package.xml cp -p package.xml %{buildroot}%{xmldir}/PHP_Fork.xml %clean rm -rf %{buildroot} %post pear install --nodeps --soft --force --register-only %{xmldir}/PHP_Fork.xml %postun if [ "$1" -eq "0" ]; then pear uninstall --nodeps --ignore-errors --register-only pear.php.net/PHP_Fork fi %files %defattr(-,root,root) %doc docs/PHP_Fork/* %{peardir}/* %{xmldir}/PHP_Fork.xml %changelog * Sun Jan 13 2013 umeabot <umeabot> 0.3.2-2.mga3 + Revision: 377200 - Mass Rebuild - https://wiki.mageia.org/en/Feature:Mageia3MassRebuild + spuhler <spuhler> - upgrade to 0.3.2 * Mon Jul 30 2012 spuhler <spuhler> 0.3.2-1.mga3 + Revision: 275938 - upgrade to 0.3.2 * Sat Jan 29 2011 spuhler <spuhler> 0.3.0-10.mga1 + Revision: 44086 - removed buildroot definition from .spec - imported package php-pear-PHP_Fork