summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2015-10-20 15:27:36 +0200
committerRemi Collet <fedora@famillecollet.com>2015-10-20 15:27:36 +0200
commitc7c9f9258fe630c7fd1f70462aace8d7858cb204 (patch)
tree4e030f834b3ec8d1521fa79489cb47dc5f4d280b
php-kukulich-fshl: 2.1.0, new package
-rw-r--r--Makefile4
-rwxr-xr-xmakesrc.sh28
-rw-r--r--php-kukulich-fshl.spec103
3 files changed, 135 insertions, 0 deletions
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/makesrc.sh b/makesrc.sh
new file mode 100755
index 0000000..e9a1ec5
--- /dev/null
+++ b/makesrc.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+NAME=$(basename $PWD)
+OWNER=$(sed -n '/^%global gh_owner/{s/.* //;p}' $NAME.spec)
+PROJECT=$(sed -n '/^%global gh_project/{s/.* //;p}' $NAME.spec)
+VERSION=$(sed -n '/^Version:/{s/.* //;p}' $NAME.spec)
+COMMIT=$(sed -n '/^%global gh_commit/{s/.* //;p}' $NAME.spec)
+SHORT=${COMMIT:0:7}
+
+echo -e "\nCreate git snapshot\nName=$NAME, Owner=$OWNER, Project=$PROJECT, Version=$VERSION\n"
+
+echo "Cloning..."
+rm -rf $PROJECT-$COMMIT
+git clone https://github.com/$OWNER/$PROJECT.git $PROJECT-$COMMIT
+
+echo "Getting commit..."
+pushd $PROJECT-$COMMIT
+git checkout $COMMIT
+cp composer.json ../composer-$VERSION.json
+popd
+
+echo "Archiving..."
+tar czf $NAME-$VERSION-$SHORT.tgz --exclude .git $PROJECT-$COMMIT
+
+echo "Cleaning..."
+rm -rf $PROJECT-$COMMIT
+
+echo "Done."
diff --git a/php-kukulich-fshl.spec b/php-kukulich-fshl.spec
new file mode 100644
index 0000000..be18be9
--- /dev/null
+++ b/php-kukulich-fshl.spec
@@ -0,0 +1,103 @@
+# remirepo spec/Fedora file for php-kukulich-fshl
+#
+# Copyright (c) 2015 Remi Collet
+# License: CC-BY-SA
+# http://creativecommons.org/licenses/by-sa/4.0/
+#
+# Please, preserve the changelog entries
+#
+%global gh_commit 974c294ade5d76c0c16b6fe3fd3a584ba999b24f
+%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
+%global gh_owner kukulich
+%global gh_project fshl
+%global php_home %{_datadir}/php
+%global ns_project FSHL
+%global with_tests 0%{!?_without_tests:1}
+
+Name: php-%{gh_owner}-%{gh_project}
+Version: 2.1.0
+Release: 1%{?dist}
+Summary: FSHL: fast syntax highlighter
+
+Group: Development/Libraries
+License: MIT
+URL: https://github.com/%{gh_owner}/%{gh_project}
+# git snashop to get upstream test suite
+Source0: %{name}-%{version}-%{gh_short}.tgz
+Source1: makesrc.sh
+
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+BuildArch: noarch
+BuildRequires: php-composer(theseer/autoload)
+%if %{with_tests}
+# For tests
+BuildRequires: php(language) >= 5.3
+BuildRequires: php-pcre
+BuildRequires: php-spl
+BuildRequires: php-composer(phpunit/phpunit)
+%endif
+
+# From composer.json, "require": {
+# "php": ">=5.3"
+Requires: php(language) >= 5.3
+# From phpcompatinfo report for version 2.1.0
+Requires: php-pcre
+Requires: php-spl
+
+Provides: php-composer(%{gh_owner}/%{gh_project}) = %{version}
+
+
+%description
+FSHL is a free, open source, universal, fast syntax highlighter written in PHP.
+A very fast parser performs syntax highlighting for few languages and produces
+a HTML output.
+
+To use this library, you just have to add, in your project:
+ require_once '%{php_home}/%{ns_project}/autoload.php';
+
+
+%prep
+%setup -q -n %{gh_project}-%{gh_commit}
+
+
+%build
+: Generate a simple classmap autoloader
+phpab --output %{ns_project}/autoload.php %{ns_project}
+
+
+%install
+rm -rf %{buildroot}
+
+: Library
+mkdir -p %{buildroot}%{php_home}
+cp -pr %{ns_project} %{buildroot}%{php_home}/%{ns_project}
+
+
+%check
+%if %{with_tests}
+: Switch to our autoloader
+sed -e '/bootstrap/s:^.*$:require_once "%{buildroot}%{php_home}/%{ns_project}/autoload.php";:' \
+ -i tests/%{ns_project}/*Test.php
+
+%{_bindir}/phpunit --verbose tests
+%else
+: Test suite disabled
+%endif
+
+
+%clean
+rm -rf %{buildroot}
+
+
+%files
+%defattr(-,root,root,-)
+%{!?_licensedir:%global license %%doc}
+%license LICENSE
+%doc composer.json
+%doc README.md
+%{php_home}/%{ns_project}
+
+
+%changelog
+* 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