summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--php-phpseclib-Remove-include-statement-from-BigInteger-TestCase.patch30
-rw-r--r--php-phpseclib-autoload.php19
-rw-r--r--php-phpseclib.spec79
3 files changed, 128 insertions, 0 deletions
diff --git a/php-phpseclib-Remove-include-statement-from-BigInteger-TestCase.patch b/php-phpseclib-Remove-include-statement-from-BigInteger-TestCase.patch
new file mode 100644
index 0000000..329bc6c
--- /dev/null
+++ b/php-phpseclib-Remove-include-statement-from-BigInteger-TestCase.patch
@@ -0,0 +1,30 @@
+From 785b37b50578bd9135c917977c496fdbdeb25fd7 Mon Sep 17 00:00:00 2001
+From: Andreas Fischer <bantu@phpbb.com>
+Date: Thu, 13 Aug 2015 15:12:20 -0400
+Subject: [PATCH] Remove include statement from BigInteger TestCase.
+
+This was previously required to load MATH_BIGINTEGER_MODE_* constants, but
+these are autoloadable via \phpseclib\Math\BigInteger::MODE_* now and the
+include path was removed.
+---
+ tests/Unit/Math/BigInteger/TestCase.php | 3 ---
+ 1 file changed, 3 deletions(-)
+
+diff --git a/tests/Unit/Math/BigInteger/TestCase.php b/tests/Unit/Math/BigInteger/TestCase.php
+index e417b05..0b236d2 100644
+--- a/tests/Unit/Math/BigInteger/TestCase.php
++++ b/tests/Unit/Math/BigInteger/TestCase.php
+@@ -9,10 +9,7 @@ abstract class Unit_Math_BigInteger_TestCase extends PhpseclibTestCase
+ {
+ public static function setUpBeforeClass()
+ {
+- include_once 'Math/BigInteger.php';
+-
+ parent::setUpBeforeClass();
+-
+ self::reRequireFile('Math/BigInteger.php');
+ }
+
+--
+2.4.3
+
diff --git a/php-phpseclib-autoload.php b/php-phpseclib-autoload.php
new file mode 100644
index 0000000..b195e0d
--- /dev/null
+++ b/php-phpseclib-autoload.php
@@ -0,0 +1,19 @@
+<?php
+
+/**
+ * Autoloader for phpseclib/phpseclib.
+ */
+$vendorDir = '/usr/share/php';
+
+// Use Symfony autoloader
+if (!isset($fedoraClassLoader) || !($fedoraClassLoader instanceof \Symfony\Component\ClassLoader\ClassLoader)) {
+ if (!class_exists('Symfony\\Component\\ClassLoader\\ClassLoader', false)) {
+ require_once $vendorDir.'/Symfony/Component/ClassLoader/ClassLoader.php';
+ }
+
+ $fedoraClassLoader = new \Symfony\Component\ClassLoader\ClassLoader();
+ $fedoraClassLoader->register();
+}
+$fedoraClassLoader->addPrefixes(array(
+ 'phpseclib' => dirname(__DIR__),
+));
diff --git a/php-phpseclib.spec b/php-phpseclib.spec
new file mode 100644
index 0000000..15d21be
--- /dev/null
+++ b/php-phpseclib.spec
@@ -0,0 +1,79 @@
+%global composer_vendor phpseclib
+%global composer_project phpseclib
+
+%global github_owner phpseclib
+%global github_name phpseclib
+
+Name: php-%{composer_vendor}
+Version: 2.0.0
+Release: 3%{?dist}
+Summary: PHP Secure Communications Library
+
+Group: System Environment/Libraries
+License: MIT
+URL: https://github.com/%{github_owner}/%{github_name}
+Source0: https://github.com/%{github_owner}/%{github_name}/archive/%{version}.tar.gz
+Source1: %{name}-autoload.php
+
+# https://github.com/phpseclib/phpseclib/commit/2b36d44ded043ac07ee470d0e1e7f785dadcf2c0
+Patch0: %{name}-Remove-include-statement-from-BigInteger-TestCase.patch
+
+BuildArch: noarch
+
+Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version}
+
+Requires: php(language) >= 5.3.3
+
+Requires: php-bcmath
+Requires: php-date
+Requires: php-gmp
+Requires: php-hash
+Requires: php-openssl
+Requires: php-pcre
+Requires: php-session
+Requires: php-standard
+Requires: php-xml
+Requires: php-composer(symfony/class-loader)
+
+BuildRequires: php-composer(symfony/class-loader)
+BuildRequires: %{_bindir}/phpunit
+BuildRequires: %{_bindir}/phpab
+
+%description
+MIT-licensed pure-PHP implementations of an arbitrary-precision integer
+arithmetic library, fully PKCS#1 (v2.1) compliant RSA, DES, 3DES, RC4,
+Rijndael, AES, Blowfish, Twofish, SSH-1, SSH-2, SFTP, and X.509
+
+%prep
+%setup -qn %{github_name}-%{version}
+%patch0 -p1
+cp %{SOURCE1} %{composer_vendor}/autoload.php
+
+%build
+
+%install
+mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/php
+cp -pr %{composer_vendor} ${RPM_BUILD_ROOT}%{_datadir}/php
+
+%check
+%{_bindir}/phpab --output tests/bootstrap.php tests
+echo 'require "%{buildroot}%{_datadir}/php/%{composer_vendor}/autoload.php";' >> tests/bootstrap.php
+%{_bindir}/phpunit
+
+%files
+%defattr(-,root,root,-)
+%{_datadir}/php/%{composer_vendor}
+%doc AUTHORS CHANGELOG.md composer.json README.md
+%license LICENSE
+
+%changelog
+* Wed Sep 02 2015 François Kooman <fkooman@tuxed.net> - 2.0.0-3
+- apply patch for test to avoid loading class that is now autoloaded
+
+* Wed Sep 02 2015 François Kooman <fkooman@tuxed.net> - 2.0.0-2
+- add autoload script
+- make use of autoload script when running tests during build
+- fix double inclusion of directory
+
+* Sat Aug 08 2015 François Kooman <fkooman@tuxed.net> - 2.0.0-1
+- initial package