%define peardir %(pear config-get php_dir 2> /dev/null || echo %{_datadir}/pear) %define xmldir /var/lib/pear %global pear_name Console_GetoptPlus Summary: Command-line option parser - Console Getopt+ (Getopt Plus) Name: php-pear-Console-GetoptPlus Version: 1.0.0RC1 Release: 2%{?dist} License: The BSD License Group: Development/Libraries Source0: http://pear.php.net/get/Console_GetoptPlus-%{version}.tgz BuildRoot: %{_tmppath}/%{name}-%{version}-root-%(%{__id_u} -n) URL: http://pear.php.net/package/Console_GetoptPlus BuildRequires: php-pear(PEAR) >= 1.4.7 Provides: php-pear(%{pear_name}) = %{version} #BuildRequires: PEAR::PEAR >= 1.4.7 BuildArch: noarch %description This package is (1) a PHP5 port/rewrite of Console_Getopt, (2) with added functionalities, and (3) with a Web interface to run getopt-like shell commands through a browser (not implemented yet). (1) Console_getoptPlus:getopt() is a replacement for Console_getopt:getopt(). Same for getopt2() and readPHPArgv(). It returns PEAR_Exception instead of PEAR_Error. Error messages are the same. (2) GetoptPlus:getoptplus uses an array-based description of the command. It can generates the command usage/help automaticly. It can return the parsed options and parameters in an associative array. It can be set to accept option shortcut names. Fully tested with phpUnit. Code coverage test close to 100%. Usage is fully documented in docs/examples files. %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}/Console_GetoptPlus.xml %clean rm -rf %{buildroot} %post pear install --nodeps --soft --force --register-only %{xmldir}/Console_GetoptPlus.xml >/dev/null || : %postun if [ "$1" -eq "0" ]; then pear uninstall --nodeps --ignore-errors --register-only pear.php.net/Console_GetoptPlus >/dev/null || : fi %files %defattr(-,root,root) %doc docs/Console_GetoptPlus/* %{peardir}/* %{xmldir}/Console_GetoptPlus.xml %changelog * Mon May 6 2013 John H. Bennett III - 1.0.0RC1-2 - updated spec file requires section, and left original info remarked. * Sun May 5 2013 John H. Bennett III - 1.0.0RC1-1 - Original from pear-make-rpm-spec.