From 02e154692a9197d8c8e53c512eb6322c74584a5e Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 21 Oct 2016 07:49:27 +0200 Subject: php-asm89-stack-cors: import from Fedora --- ...ack-cors-pull-request-32-add-license-file.patch | 35 ++++++ php-asm89-stack-cors.spec | 135 +++++++++++++++++++++ 2 files changed, 170 insertions(+) create mode 100644 php-asm89-stack-cors-pull-request-32-add-license-file.patch create mode 100644 php-asm89-stack-cors.spec diff --git a/php-asm89-stack-cors-pull-request-32-add-license-file.patch b/php-asm89-stack-cors-pull-request-32-add-license-file.patch new file mode 100644 index 0000000..9761fc0 --- /dev/null +++ b/php-asm89-stack-cors-pull-request-32-add-license-file.patch @@ -0,0 +1,35 @@ +From d99ded172a229de32bbef71083f11b043a2c8597 Mon Sep 17 00:00:00 2001 +From: Shawn Iwinski +Date: Sun, 9 Oct 2016 17:01:36 -0400 +Subject: [PATCH] Add LICENSE file + +--- + LICENSE | 19 +++++++++++++++++++ + 1 file changed, 19 insertions(+) + create mode 100644 LICENSE + +diff --git a/LICENSE b/LICENSE +new file mode 100644 +index 0000000..2ddd2b6 +--- /dev/null ++++ b/LICENSE +@@ -0,0 +1,19 @@ ++Copyright (c) 2013-2016 Alexander Mols ++ ++Permission is hereby granted, free of charge, to any person obtaining a copy ++of this software and associated documentation files (the "Software"), to deal ++in the Software without restriction, including without limitation the rights ++to use, copy, modify, merge, publish, distribute, sublicense, and/or sell ++copies of the Software, and to permit persons to whom the Software is furnished ++to do so, subject to the following conditions: ++ ++The above copyright notice and this permission notice shall be included in all ++copies or substantial portions of the Software. ++ ++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ++IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ++FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE ++AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ++LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, ++OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN ++THE SOFTWARE. diff --git a/php-asm89-stack-cors.spec b/php-asm89-stack-cors.spec new file mode 100644 index 0000000..063f9a6 --- /dev/null +++ b/php-asm89-stack-cors.spec @@ -0,0 +1,135 @@ +# +# Fedora spec file for php-asm89-stack-cors +# +# Copyright (c) 2016 Shawn Iwinski +# +# License: MIT +# http://opensource.org/licenses/MIT +# +# Please preserve changelog entries +# + +%global github_owner asm89 +%global github_name stack-cors +%global github_version 1.0.0 +%global github_commit 3ae8ef219bb4c9a6caf857421719aa07fa7776cc + +%global composer_vendor asm89 +%global composer_project stack-cors + +# "php": ">=5.3.2" +%global php_min_ver 5.3.2 +# "symfony/http-foundation": "~2.1|~3.0" +# "symfony/http-kernel": "~2.1|~3.0" +# NOTE: Min version not 2.1 because autoloader required +%global symfony_min_ver %{?el6:2.3.31}%{!?el6:2.7.1} +%global symfony_max_ver 4.0 + +# Build using "--without tests" to disable tests +%global with_tests 0%{!?_without_tests:1} + +%{!?phpdir: %global phpdir %{_datadir}/php} + +Name: php-%{composer_vendor}-%{composer_project} +Version: %{github_version} +Release: 1%{?github_release}%{?dist} +Summary: Cross-origin resource sharing library and stack middleware + +Group: Development/Libraries +License: MIT +URL: https://github.com/%{github_owner}/%{github_name} +Source0: %{url}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz + +# Add LICENSE file +# https://github.com/asm89/stack-cors/pull/32 +Patch0: %{name}-pull-request-32-add-license-file.patch + +BuildArch: noarch +# Autoloader +BuildRequires: %{_bindir}/phpab +# Tests +%if %{with_tests} +## composer.json +BuildRequires: php(language) >= %{php_min_ver} +BuildRequires: php-composer(phpunit/phpunit) +BuildRequires: php-composer(symfony/http-foundation) >= %{symfony_min_ver} +BuildRequires: php-composer(symfony/http-kernel) >= %{symfony_min_ver} +## phpcompatinfo (computed from version 1.0.0) +BuildRequires: php-spl +%endif + +# composer.json +Requires: php(language) >= %{php_min_ver} +Requires: php-composer(symfony/http-foundation) >= %{symfony_min_ver} +Requires: php-composer(symfony/http-foundation) < %{symfony_max_ver} +Requires: php-composer(symfony/http-kernel) >= %{symfony_min_ver} +Requires: php-composer(symfony/http-kernel) < %{symfony_max_ver} +# phpcompatinfo (computed from version 1.0.0) +# + +# Composer +Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version} + +%description +Library and middleware enabling cross-origin resource sharing for your +http-{foundation,kernel} using application. It attempts to implement the +W3C Candidate Recommendation [1] for cross-origin resource sharing. + +Autoloader: %{phpdir}/Asm89/Stack/autoload-cors.php + +[1] http://www.w3.org/TR/cors/ + + +%prep +%setup -qn %{github_name}-%{github_commit} + +: Remove executable bits from non-executable files +: https://github.com/asm89/stack-cors/pull/31 +find . -type f -executable -name '*.php' -print0 | xargs -0 chmod a-x + +: Add LICENSE file +: https://github.com/asm89/stack-cors/pull/32 +%patch0 -p1 + + +%build +: Create autoloader +%{_bindir}/phpab --output src/Asm89/Stack/autoload-cors.php src/ + +cat <<'AUTOLOAD' | tee -a src/Asm89/Stack/autoload-cors.php + +// Required dependencies +require_once '%{phpdir}/Symfony/Component/HttpFoundation/autoload.php'; +require_once '%{phpdir}/Symfony/Component/HttpKernel/autoload.php'; +AUTOLOAD + + +%install +mkdir -p %{buildroot}%{phpdir} +cp -rp src/* %{buildroot}%{phpdir}/ + + +%check +%if %{with_tests} +%{_bindir}/phpunit --verbose \ + --bootstrap %{buildroot}%{phpdir}/Asm89/Stack/autoload-cors.php +%else +: Tests skipped +%endif + + +%files +%{!?_licensedir:%global license %%doc} +%license LICENSE +%doc *.md +%doc composer.json +%dir %{phpdir}/Asm89 +%dir %{phpdir}/Asm89/Stack + %{phpdir}/Asm89/Stack/autoload-cors.php + %{phpdir}/Asm89/Stack/Cors.php + %{phpdir}/Asm89/Stack/CorsService.php + + +%changelog +* Sun Oct 09 2016 Shawn Iwinski - 1.0.0-1 +- Initial package -- cgit