summaryrefslogtreecommitdiffstats
path: root/php-kukulich-fshl.spec
blob: 5c1da8b246a1d6017be933264e8d8bb4192944b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# 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:        2%{?dist}
Summary:        FSHL: fast syntax highlighter

Group:          Development/Libraries
License:        GPLv2+
URL:            http://fshl.kukulich.cz/
# 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
* 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