summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--composer.json25
-rw-r--r--php-kukulich-fshl-php71.patch72
-rw-r--r--php-kukulich-fshl.spec23
3 files changed, 116 insertions, 4 deletions
diff --git a/composer.json b/composer.json
new file mode 100644
index 0000000..99b56bc
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,25 @@
+{
+ "name": "kukulich/fshl",
+ "type": "library",
+ "description": "FSHL is a free, open source, universal, fast syntax highlighter written in PHP.",
+ "keywords": ["library", "highlight", "syntax"],
+ "homepage": "http://fshl.kukulich.cz/",
+ "license": "GPL-2.0+",
+
+ "authors": [
+ {
+ "name": "Jaroslav HanslĂ­k",
+ "homepage": "https://github.com/kukulich"
+ }
+ ],
+
+ "require": {
+ "php": ">=5.3"
+ },
+
+ "autoload": {
+ "psr-0": {
+ "FSHL": "./"
+ }
+ }
+}
diff --git a/php-kukulich-fshl-php71.patch b/php-kukulich-fshl-php71.patch
new file mode 100644
index 0000000..63fb55e
--- /dev/null
+++ b/php-kukulich-fshl-php71.patch
@@ -0,0 +1,72 @@
+From ae00651ce648c576ba37b79755a804801b592604 Mon Sep 17 00:00:00 2001
+From: Remi Collet <fedora@famillecollet.com>
+Date: Thu, 16 Feb 2017 12:08:34 +0100
+Subject: [PATCH 1/2] workaround PHP 7.1 issue, fixed #12
+
+---
+ FSHL/Highlighter.php | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/FSHL/Highlighter.php b/FSHL/Highlighter.php
+index 04e7b42..d3c9e38 100644
+--- a/FSHL/Highlighter.php
++++ b/FSHL/Highlighter.php
+@@ -250,7 +250,7 @@ public function highlight($text, Lexer $lexer = null)
+ }
+
+ // Switches between lexers (transition to embedded language)
+- if ($this->lexer->flags[$newState] & Generator::STATE_FLAG_NEWLEXER) {
++ if ((int)$this->lexer->flags[$newState] & Generator::STATE_FLAG_NEWLEXER) {
+ if ($newState === $this->lexer->quitState) {
+ // Returns to the previous lexer
+ if ($item = $this->popState()) {
+@@ -275,7 +275,7 @@ public function highlight($text, Lexer $lexer = null)
+ }
+
+ // If newState is marked with recursion flag (alias call), push current state to the context stack
+- if (($this->lexer->flags[$newState] & Generator::STATE_FLAG_RECURSION) && $state !== $newState) {
++ if (((int)$this->lexer->flags[$newState] & Generator::STATE_FLAG_RECURSION) && $state !== $newState) {
+ $this->pushState($lexerName, $state);
+ }
+
+@@ -434,7 +434,7 @@ private function generateCache(Lexer $lexer)
+ */
+ private function template($part, $state)
+ {
+- if ($this->lexer->flags[$state] & Generator::STATE_FLAG_KEYWORD) {
++ if ((int)$this->lexer->flags[$state] & Generator::STATE_FLAG_KEYWORD) {
+ $normalized = Generator::CASE_SENSITIVE === $this->lexer->keywords[Generator::KEYWORD_INDEX_CASE_SENSITIVE] ? $part : strtolower($part);
+
+ if (isset($this->lexer->keywords[Generator::KEYWORD_INDEX_LIST][$normalized])) {
+
+From 213824a607741ef08cffd0d2b7dfa112f2e6ae9d Mon Sep 17 00:00:00 2001
+From: Remi Collet <fedora@famillecollet.com>
+Date: Thu, 16 Feb 2017 12:09:59 +0100
+Subject: [PATCH 2/2] enable more versions in travis
+
+---
+ .travis.yml | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/.travis.yml b/.travis.yml
+index 901bf6a..66db7f9 100644
+--- a/.travis.yml
++++ b/.travis.yml
+@@ -3,6 +3,10 @@ language: php
+ php:
+ - 5.3
+ - 5.4
++ - 5.5
++ - 5.6
++ - 7.0
++ - 7.1
+
+ branches:
+ only:
+@@ -13,4 +17,4 @@ notifications:
+ email:
+ - kontakt@kukulich.cz
+
+-script: phpunit tests/FSHL
+\ No newline at end of file
++script: phpunit tests/FSHL
diff --git a/php-kukulich-fshl.spec b/php-kukulich-fshl.spec
index 8f544a1..4a6922a 100644
--- a/php-kukulich-fshl.spec
+++ b/php-kukulich-fshl.spec
@@ -1,4 +1,4 @@
-# remirepo spec/Fedora file for php-kukulich-fshl
+# remirepo/fedora spec file for php-kukulich-fshl
#
# Copyright (c) 2015-2017 Remi Collet
# License: CC-BY-SA
@@ -16,7 +16,7 @@
Name: php-%{gh_owner}-%{gh_project}
Version: 2.1.0
-Release: 2%{?dist}
+Release: 4%{?dist}
Summary: FSHL: fast syntax highlighter
Group: Development/Libraries
@@ -26,6 +26,9 @@ URL: http://fshl.kukulich.cz/
Source0: %{name}-%{version}-%{gh_short}.tgz
Source1: makesrc.sh
+# https://github.com/kukulich/fshl/pull/13
+Patch0: %{name}-php71.patch
+
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
BuildRequires: php-composer(theseer/autoload)
@@ -58,6 +61,7 @@ To use this library, you just have to add, in your project:
%prep
%setup -q -n %{gh_project}-%{gh_commit}
+%patch0 -p1 -b .pr13
%build
@@ -79,7 +83,13 @@ cp -pr %{ns_project} %{buildroot}%{php_home}/%{ns_project}
sed -e '/bootstrap/s:^.*$:require_once "%{buildroot}%{php_home}/%{ns_project}/autoload.php";:' \
-i tests/%{ns_project}/*Test.php
-%{_bindir}/phpunit --verbose tests
+ret=0
+for cmd in php56 php70 php71 php; do
+ if which $cmd; then
+ $cmd %{_bindir}/phpunit --verbose tests || ret=1
+ fi
+done
+exit $ret
%else
: Test suite disabled
%endif
@@ -99,8 +109,13 @@ rm -rf %{buildroot}
%changelog
+* Thu Feb 16 2017 Remi Collet <remi@fedoraproject.org> - 2.1.0-4
+- open https://github.com/kukulich/fshl/issues/12 failed tests
+- add patch from https://github.com/kukulich/fshl/pull/13
+ workaround for failed test with PHP 7.1, fix FTBFS
+
* Wed Nov 4 2015 Remi Collet <remi@fedoraproject.org> - 2.1.0-2
- License is GPLv2+, from review #1277487
* Tue Oct 20 2015 Remi Collet <remi@fedoraproject.org> - 2.1.0-1
-- initial package, version 2.1.0 \ No newline at end of file
+- initial package, version 2.1.0