summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--php-ircmaxell-random-lib.spec44
1 files changed, 33 insertions, 11 deletions
diff --git a/php-ircmaxell-random-lib.spec b/php-ircmaxell-random-lib.spec
index 476707d..0748d2b 100644
--- a/php-ircmaxell-random-lib.spec
+++ b/php-ircmaxell-random-lib.spec
@@ -14,7 +14,7 @@
Name: php-ircmaxell-random-lib
Version: 1.1.0
-Release: 1%{?dist}
+Release: 3%{?dist}
Summary: A Library For Generating Secure Random Numbers
Group: Development/Libraries
@@ -37,6 +37,9 @@ BuildRequires: php-spl
BuildRequires: php-composer(ircmaxell/security-lib) >= 1.0
# "mikey179/vfsStream": "1.1.*", ignore max version on purpose
BuildRequires: php-composer(mikey179/vfsStream) >= 1.1
+# For autoloader
+BuildRequires: php-mikey179-vfsstream >= 1.6.0
+BuildRequires: php-ircmaxell-security-lib >= 1.1.0-3
%endif
# From composer.json
@@ -49,6 +52,8 @@ Requires: php-hash
Requires: php-openssl
Requires: php-posix
Requires: php-spl
+# For autoloader
+Requires: php-ircmaxell-security-lib >= 1.1.0-3
Provides: php-composer(ircmaxell/random-lib) = %{version}
@@ -58,6 +63,8 @@ A library for generating random numbers and strings of various strengths.
This library is useful in security contexts.
+Autoloader: %{_datadir}/php/RandomLib/autoload.php
+
%prep
%setup -q -n %{gh_project}-%{gh_commit}
@@ -66,7 +73,13 @@ chmod -x lib/RandomLib/Generator.php
%build
-# Nothing
+: Generate library autoloader
+%{_bindir}/phpab --output lib/RandomLib/autoload.php lib
+
+cat << EOF | tee -a lib/RandomLib/autoload.php
+// Dependency
+require_once '%{_datadir}/php/SecurityLib/autoload.php';
+EOF
%install
@@ -77,17 +90,23 @@ cp -pr lib/* %{buildroot}%{_datadir}/php
%check
%if %{with_tests}
-: Generate autoloader
-%{_bindir}/phpab \
- --basedir $PWD \
- --output autoload.php \
- %{_datadir}/php/org/bovigo/vfs \
- %{_datadir}/php/SecurityLib \
- lib test
+: Generate test suite autoloader
+%{_bindir}/phpab --output test/autoload.php test
+
+mkdir vendor
+cat << 'EOF' | tee vendor/autoload.php
+<?php
+require_once __DIR__ . '/../test/autoload.php';
+require_once '%{_datadir}/php/org/bovigo/vfs/autoload.php';
+require_once '%{buildroot}%{_datadir}/php/RandomLib/autoload.php';
+EOF
: Run test suite
-%{_bindir}/phpunit \
- --bootstrap autoload.php
+%{_bindir}/phpunit --verbose
+
+if which php70; then
+ php70 %{_bindir}/phpunit --verbose
+fi
%else
: Test suite disabled
%endif
@@ -107,6 +126,9 @@ rm -rf %{buildroot}
%changelog
+* Thu Jan 14 2016 Remi Collet <remi@fedoraproject.org> - 1.1.0-3
+- add autoloader
+
* Fri Jan 16 2015 Remi Collet <remi@fedoraproject.org> - 1.1.0-1
- update to 1.1.0