summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2017-06-27 14:42:51 +0200
committerRemi Collet <remi@remirepo.net>2017-06-27 14:42:51 +0200
commitc3f3395d61d6bcc8343a9aa95086a6ed63daab2f (patch)
treebe761cf448f9ac4ac3a69136849fc932812bf148
New package
-rw-r--r--.gitignore7
-rw-r--r--Makefile4
-rwxr-xr-xcomposer.json45
-rw-r--r--php-endroid-qrcode-el6-rpm.patch17
-rw-r--r--php-endroid-qrcode-rpm.patch17
-rw-r--r--php-endroid-qrcode.spec177
6 files changed, 267 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..1ab5c4f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,7 @@
+package-*.xml
+*.tgz
+*.tar.gz
+*.tar.xz
+*.tar.xz.asc
+*.src.rpm
+*/*rpm
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..91b0fd5
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,4 @@
+SRCDIR := $(shell pwd)
+NAME := $(shell basename $(SRCDIR))
+include ../../common/Makefile
+
diff --git a/composer.json b/composer.json
new file mode 100755
index 0000000..eb785a0
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,45 @@
+{
+ "name": "endroid/qrcode",
+ "description": "Endroid QR Code",
+ "keywords": ["endroid", "qrcode", "qr", "code", "bundle", "symfony"],
+ "homepage": "https://github.com/endroid/QrCode",
+ "type": "library",
+ "license": "MIT",
+ "authors": [
+ {
+ "name": "Jeroen van den Enden",
+ "email": "info@endroid.nl",
+ "homepage": "http://endroid.nl/"
+ }
+ ],
+ "require": {
+ "php": ">=5.4",
+ "ext-gd": "*",
+ "symfony/options-resolver": "^2.3|^3.0"
+ },
+ "require-dev": {
+ "symfony/browser-kit": "^2.3|^3.0",
+ "symfony/framework-bundle": "^2.3|^3.0",
+ "symfony/http-kernel": "^2.3|^3.0",
+ "sensio/framework-extra-bundle": "^3.0",
+ "phpunit/phpunit": "^4.0|^5.0"
+ },
+ "autoload": {
+ "psr-4": {
+ "Endroid\\QrCode\\": "src/"
+ }
+ },
+ "autoload-dev": {
+ "psr-4": {
+ "Endroid\\QrCode\\Tests\\": "tests/"
+ }
+ },
+ "config": {
+ "bin-dir": "bin"
+ },
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.x-dev"
+ }
+ }
+}
diff --git a/php-endroid-qrcode-el6-rpm.patch b/php-endroid-qrcode-el6-rpm.patch
new file mode 100644
index 0000000..beb343a
--- /dev/null
+++ b/php-endroid-qrcode-el6-rpm.patch
@@ -0,0 +1,17 @@
+diff -up src/QrCode.php.rpm src/QrCode.php
+--- src/QrCode.php.rpm 2017-06-27 14:19:50.099124286 +0200
++++ src/QrCode.php 2017-06-27 14:19:54.373148551 +0200
+@@ -177,9 +177,10 @@ class QrCode
+ */
+ public function __construct($text = '')
+ {
+- $this->setPath(__DIR__.'/../assets/data');
+- $this->setImagePath(__DIR__.'/../assets/image');
+- $this->setLabelFontPath(__DIR__.'/../assets/font/opensans.ttf');
++ $assets = (getenv('RPM_ASSETS_BUILDROOT') ?: '') . '@ASSETS@';
++ $this->setPath($assets.'/data');
++ $this->setImagePath($assets.'/image');
++ $this->setLabelFontPath($assets.'/font/opensans.ttf');
+ $this->setText($text);
+ }
+
diff --git a/php-endroid-qrcode-rpm.patch b/php-endroid-qrcode-rpm.patch
new file mode 100644
index 0000000..39fb1d8
--- /dev/null
+++ b/php-endroid-qrcode-rpm.patch
@@ -0,0 +1,17 @@
+diff -up src/QrCode.php.rpm src/QrCode.php
+--- src/QrCode.php.rpm 2017-06-27 14:19:50.099124286 +0200
++++ src/QrCode.php 2017-06-27 14:19:54.373148551 +0200
+@@ -177,9 +177,10 @@ class QrCode
+ */
+ public function __construct($text = '')
+ {
+- $this->setPath(__DIR__.'/../assets/data');
+- $this->setImagePath(__DIR__.'/../assets/image');
+- $this->setLabelFontPath(__DIR__.'/../assets/font/opensans.ttf');
++ $assets = (getenv('RPM_ASSETS_BUILDROOT') ?: '') . '@ASSETS@';
++ $this->setPath($assets.'/data');
++ $this->setImagePath($assets.'/image');
++ $this->setLabelFontPath('/usr/share/fonts/open-sans/OpenSans-Regular.ttf');
+ $this->setText($text);
+ }
+
diff --git a/php-endroid-qrcode.spec b/php-endroid-qrcode.spec
new file mode 100644
index 0000000..3de0ea9
--- /dev/null
+++ b/php-endroid-qrcode.spec
@@ -0,0 +1,177 @@
+# remirepo/fedora spec file for php-endroid-qrcode
+#
+# Copyright (c) 2017 Remi Collet
+# License: CC-BY-SA
+# http://creativecommons.org/licenses/by-sa/4.0/
+#
+# Please, preserve the changelog entries
+#
+%global gh_commit c9644bec2a9cc9318e98d1437de3c628dcd1ef93
+%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
+%global gh_owner endroid
+%global gh_project QrCode
+
+%global pk_vendor %{gh_owner}
+%global pk_project qrcode
+
+%global ns_vendor Endroid
+%global ns_project QrCode
+%global php_home %{_datadir}/php
+%global with_tests 0%{!?_without_tests:1}
+
+Name: php-%{pk_vendor}-%{pk_project}
+Version: 1.9.3
+Release: 1%{?dist}
+Summary: Endroid QR Code
+
+Group: Development/Libraries
+License: MIT
+URL: https://github.com/%{gh_owner}/%{gh_project}
+Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{name}-%{version}-%{gh_short}.tar.gz
+
+# Assets relocation
+Patch0: %{name}-rpm.patch
+Patch1: %{name}-el6-rpm.patch
+
+BuildArch: noarch
+%if %{with_tests}
+# For tests
+BuildRequires: php(language) >= 5.4
+BuildRequires: php-gd
+BuildRequires: php-composer(symfony/options-resolver) < 4
+BuildRequires: php-composer(symfony/options-resolver) >= 2.3
+BuildRequires: php-reflection
+BuildRequires: php-pcre
+BuildRequires: php-spl
+# From composer.json, "require-dev": {
+# "symfony/browser-kit": "^2.3|^3.0",
+# "symfony/framework-bundle": "^2.3|^3.0",
+# "symfony/http-kernel": "^2.3|^3.0",
+# "sensio/framework-extra-bundle": "^3.0",
+# "phpunit/phpunit": "^4.0|^5.0"
+BuildRequires: php-composer(phpunit/phpunit)
+# Required by autoloader
+BuildRequires: php-composer(fedora/autoloader)
+%endif
+# Unbundled assets
+%if 0%{?rhel} != 6
+BuildRequires: open-sans-fonts
+%endif
+
+# From composer.json, "require": {
+# "php": ">=5.4",
+# "ext-gd": "*",
+# "symfony/options-resolver": "^2.3|^3.0"
+Requires: php(language) >= 5.4
+Requires: php-gd
+Requires: php-composer(symfony/options-resolver) < 4
+Requires: php-composer(symfony/options-resolver) >= 2.3
+# From phpcompatinfo report for version 1.9.3
+Requires: php-reflection
+Requires: php-pcre
+Requires: php-spl
+# Required by autoloader
+Requires: php-composer(fedora/autoloader)
+# Unbundled assets
+%if 0%{?rhel} != 6
+Requires: open-sans-fonts
+%else
+Provides: bundled(open-sans-fonts)
+%endif
+
+Provides: php-composer(%{pk_vendor}/%{pk_project}) = %{version}
+
+
+%description
+This library based on QRcode Perl CGI & PHP scripts by Y. Swetake
+helps you generate images containing a QR code.
+
+Autoloader: %{php_home}/%{ns_vendor}/%{ns_project}/autoload.php
+
+
+%prep
+%setup -q -n %{gh_project}-%{gh_commit}
+
+%if 0%{?rhel} != 6
+: Drop bundled font
+rm -r assets/font
+
+: Relocate assets
+%patch0 -p0
+%else
+%patch1 -p0
+%endif
+sed -e 's:@ASSETS@:%{_datadir}/%{name}/assets:' -i src/QrCode.php
+
+: Fix wrong-file-end-of-line-encoding
+sed -e 's/\r//' -i *.md
+
+: Fix perms
+find . -type f -exec chmod -x {} \;
+
+: Generate autoloader
+cat << 'EOF' | tee src/autoload.php
+<?php
+/* Autoloader for %{name} and its dependencies */
+require_once '/usr/share/php/Fedora/Autoloader/autoload.php';
+
+\Fedora\Autoloader\Autoload::addPsr4('%{ns_vendor}\\%{ns_project}\\', __DIR__);
+\Fedora\Autoloader\Dependencies::required([
+ [
+ '%{php_home}/Symfony3/Component/OptionsResolver/autoload.php',
+ '%{php_home}/Symfony/Component/OptionsResolver/autoload.php',
+ ],
+]);
+EOF
+
+
+%build
+# Empty build section, most likely nothing required.
+
+
+%install
+: Library
+mkdir -p %{buildroot}%{php_home}/%{ns_vendor}
+cp -pr src %{buildroot}%{php_home}/%{ns_vendor}/%{ns_project}
+
+: Assets
+mkdir -p %{buildroot}%{_datadir}/%{name}
+cp -pr assets %{buildroot}%{_datadir}/%{name}/assets
+
+
+%check
+%if %{with_tests}
+mkdir vendor
+cat << 'EOF' | tee vendor/autoload.php
+<?php
+require '%{buildroot}%{php_home}/%{ns_vendor}/%{ns_project}/autoload.php';
+\Fedora\Autoloader\Autoload::addPsr4('%{ns_vendor}\\%{ns_project}\\Tests\\', __DIR__ . '/../tests');
+EOF
+
+export RPM_ASSETS_BUILDROOT=%{buildroot}
+
+: Minimal test suite without Symfony integration
+ret=0
+for cmd in php php56 php70 php71 php72; do
+ if which $cmd; then
+ $cmd %{_bindir}/phpunit --bootstrap vendor/autoload.php --verbose tests/QrCodeTest.php || ret=1
+ fi
+done
+exit $ret
+%else
+: Test suite disabled
+%endif
+
+
+%files
+%{!?_licensedir:%global license %%doc}
+%license LICENSE
+%doc composer.json
+%doc README.md
+%{_datadir}/%{name}
+%dir %{php_home}/%{ns_vendor}
+ %{php_home}/%{ns_vendor}/%{ns_project}
+
+%changelog
+* Tue Jun 27 2017 Remi Collet <remi@remirepo.net> - 1.5.1-1
+- initial package, version 1.9.3