diff options
| -rwxr-xr-x | php-JMSParser-strip.sh | 26 | ||||
| -rw-r--r-- | php-JMSParser.spec | 96 | 
2 files changed, 122 insertions, 0 deletions
diff --git a/php-JMSParser-strip.sh b/php-JMSParser-strip.sh new file mode 100755 index 0000000..b155801 --- /dev/null +++ b/php-JMSParser-strip.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +if [ $# != 2 ]; then +	echo "Usage: $0 VERSION GITHUB_COMMIT" 1>&2 +	exit 1 +fi + +VERSION=$1 +GITHUB_COMMIT=$2 + +ORIGINAL_SOURCE_FILE="${GITHUB_COMMIT}.tar.gz" +NEW_SOURCE_FILE="php-JMSParser-${VERSION}-${GITHUB_COMMIT}.tar.gz" + +if [ ! -f "$ORIGINAL_SOURCE_FILE" ]; then +	echo "ERROR: Original source file '${ORIGINAL_SOURCE_FILE}' not found" 1>&2 +	exit 1 +fi + +TAR=`which tar` + +$TAR -xzf "$ORIGINAL_SOURCE_FILE" +rm -rf "parser-lib-${GITHUB_COMMIT}/doc" "$NEW_SOURCE_FILE" +$TAR -czf "$NEW_SOURCE_FILE" "parser-lib-${GITHUB_COMMIT}" + +echo "${NEW_SOURCE_FILE} created" +exit 0 diff --git a/php-JMSParser.spec b/php-JMSParser.spec new file mode 100644 index 0000000..76af1c0 --- /dev/null +++ b/php-JMSParser.spec @@ -0,0 +1,96 @@ +%global github_owner      schmittjoh +%global github_name       parser-lib +%global github_version    1.0.0 +%global github_commit     c509473bc1b4866415627af0e1c6cc8ac97fa51d + +%global php_min_ver       5.3.0 +%global phpoption_min_ver 0.9 +%global phpoption_max_ver 2.0 + +Name:          php-JMSParser +Version:       %{github_version} +Release:       3%{?dist} +Summary:       Library for writing recursive-descent parsers + +Group:         Development/Libraries +License:       ASL 2.0 +URL:           http://jmsyst.com/libs/%{github_name} +# To create source: +# wget https://github.com/schmittjoh/parser-lib/archive/%%{github_commit}.tar.gz +# php-JMSParser-strip.sh %%{github_version} %%{github_commit} +Source0:       %{name}-%{github_version}-%{github_commit}.tar.gz +Source1:       %{name}-strip.sh + +BuildArch:     noarch +# Test build requires +BuildRequires: php(language) >= %{php_min_ver} +BuildRequires: php-pear(pear.phpunit.de/PHPUnit) +BuildRequires: php-PhpOption >= %{phpoption_min_ver} +BuildRequires: php-PhpOption <  %{phpoption_max_ver} +# Test build requires: phpci +BuildRequires: php-json +BuildRequires: php-pcre +BuildRequires: php-reflection +BuildRequires: php-spl + +Requires:      php(language) >= %{php_min_ver} +Requires:      php-PhpOption >= %{phpoption_min_ver} +Requires:      php-PhpOption <  %{phpoption_max_ver} +# phpci requires +Requires:      php-json +Requires:      php-pcre +Requires:      php-reflection +Requires:      php-spl + +%description +%{summary}. + + +%prep +%setup -q -n %{github_name}-%{github_commit} + +# Rewrite tests' bootstrap (which uses Composer autoloader) with simple +# autoloader that uses include path +( cat <<'AUTOLOAD' +<?php +spl_autoload_register(function ($class) { +    $src = str_replace('\\', '/', str_replace('_', '/', $class)).'.php'; +    @include_once $src; +}); +AUTOLOAD +) > tests/bootstrap.php + + +%build +# Empty build section, nothing to build + + +%install +mkdir -p -m 755 %{buildroot}%{_datadir}/php/JMS +cp -rp src/JMS/Parser %{buildroot}%{_datadir}/php/JMS/ + + +%check +%{_bindir}/phpunit \ +    -d include_path="./src:./tests:.:%{pear_phpdir}:%{_datadir}/php" \ +    -c phpunit.xml.dist + + +%files +%doc LICENSE README.md composer.json +%dir %{_datadir}/php/JMS +     %{_datadir}/php/JMS/Parser + + +%changelog +* Mon Mar 18 2013 Shawn Iwinski <shawn.iwinski@gmail.com> 1.0.0-3 +- Added %%{name}-strip.sh as Source1 + +* Sat Mar 16 2013 Shawn Iwinski <shawn.iwinski@gmail.com> 1.0.0-2 +- Added phpoption_min_ver and phpoption_max_ver globals +- Bad licensed files stripped from source +- php-common => php(language) +- Removed tests sub-package + +* Thu Jan 24 2013 Shawn Iwinski <shawn.iwinski@gmail.com> 1.0.0-1 +- Initial package  | 
