summaryrefslogtreecommitdiffstats
path: root/php-PHPParser.spec
blob: 63be0e69d5602e8008f30b725dabd8c4cabae15e (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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
#
# RPM spec file for php-PHPParser
#
# Copyright (c) 2012-2015 Shawn Iwinski <shawn.iwinski@gmail.com>
#
# License: MIT
# http://opensource.org/licenses/MIT
#
# Please preserve changelog entries
#

%global github_owner    nikic
%global github_name     PHP-Parser
%global github_version  1.4.0
%global github_commit   196f177cfefa0f1f7166c0a05d8255889be12418
%global github_short    %(c=%{github_commit}; echo ${c:0:7})

%global lib_name        PhpParser
%global lib_name_old    PHPParser

%global php_min_ver     5.3

Name:          php-%{lib_name_old}
Version:       %{github_version}
Release:       1%{?dist}
Summary:       A PHP parser written in PHP

Group:         Development/Libraries
License:       BSD
URL:           https://github.com/%{github_owner}/%{github_name}
# Upstream tarball don't provide test suite
# Use mksrc.sh to generate a git snapshot tarball
Source0:       %{name}-%{github_version}-%{github_short}.tgz
Source1:       makesrc.sh

# Patch for distribution
Patch0:        %{name}-command.patch

BuildRoot:     %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch:     noarch
# For tests
BuildRequires: php(language) >= %{php_min_ver}
BuildRequires: %{_bindir}/phpunit
# For tests: phpcompatinfo (computed from version 1.4.0)
BuildRequires: php-filter
BuildRequires: php-pcre
BuildRequires: php-spl
BuildRequires: php-tokenizer
BuildRequires: php-xmlreader
BuildRequires: php-xmlwriter

# composer.json
Requires:      php(language) >= %{php_min_ver}
Requires:      php-tokenizer
# phpcompatinfo (computed from version 1.4.0)
Requires:      php-cli
Requires:      php-filter
Requires:      php-pcre
Requires:      php-spl
Requires:      php-tokenizer
Requires:      php-xmlreader
Requires:      php-xmlwriter

Obsoletes:     %{name}-test

Provides:      php-composer(nikic/php-parser) = %{version}


%description
A PHP parser written in PHP to simplify static analysis and code manipulation.


%prep
%setup -q -n %{github_name}-%{github_short}

%patch0 -p0 -b .rpm
rm lib/%{lib_name}/*rpm


%build
# Empty build section, nothing to build


%install
mkdir -p -m 755 %{buildroot}%{_datadir}/php
cp -rp lib/%{lib_name} %{buildroot}%{_datadir}/php/%{lib_name}

# Compat with old version (< 1.0.0)
mkdir -p -m 755 %{buildroot}%{_datadir}/php/%{lib_name_old}
ln -s ../%{lib_name}/Autoloader.php \
    %{buildroot}%{_datadir}/php/%{lib_name_old}/Autoloader.php

install -Dpm 755 bin/php-parse.php %{buildroot}%{_bindir}/php-parse


%check
%{_bindir}/phpunit \
    --bootstrap %{buildroot}%{_datadir}/php/%{lib_name}/autoload.php \
    --verbose


%files
%defattr(-,root,root,-)
%{!?_licensedir:%global license %%doc}
%license LICENSE
%doc *.md doc grammar composer.json
%{_bindir}/php-parse
%{_datadir}/php/%{lib_name_old}
%{_datadir}/php/%{lib_name}


%changelog
* Sun Aug  9 2015 Remi Collet <remi@fedoraproject.org> - 1.4.0-1
- update to 1.4.0
- add a simple autoload.php

* Mon May  4 2015 Remi Collet <remi@fedoraproject.org> - 1.3.0-1
- update to 1.3.0

* Sat Apr  4 2015 Remi Collet <remi@fedoraproject.org> - 1.2.2-1
- update to 1.2.2

* Wed Feb 25 2015 Remi Collet <remi@fedoraproject.org> - 1.1.0-2
- provide the php-parse command

* Wed Feb 25 2015 Remi Collet <remi@fedoraproject.org> - 1.1.0-1
- update to 1.1.0
- use git snapshot as upstream tarball don't provide the test suite

* Wed Nov  5 2014 Remi Collet <remi@fedoraproject.org> 1.0.2-1
- Update to 1.0.2

* Thu Oct 16 2014 Remi Collet <remi@fedoraproject.org> 1.0.1-1
- Update to 1.0.1

* Fri Sep 12 2014 Remi Collet <remi@fedoraproject.org> 1.0.0-1
- Update to 1.0.0

* Wed Jul 23 2014 Remi Collet <remi@fedoraproject.org> 1.0.0-0.2.beta1
- composer dependencies
- fix license handling

* Mon May 12 2014 Remi Collet <remi@fedoraproject.org> 1.0.0-0.1.beta1
- Update to 1.0.0beta1
- library in /usr/share/php/PhpParser
- provide /usr/share/php/PHPParser/Autoloader.php for compatibility
- drop dependencies on xmlreader and xmlwriter

* Sat Nov 16 2013 Remi Collet <remi@fedoraproject.org> 0.9.4-1
- backport 0.9.4 for remi repo.

* Fri Nov 15 2013 Shawn Iwinski <shawn.iwinski@gmail.com> 0.9.4-1
- Updated to 0.9.4
- Spec cleanup

* Tue Jan  8 2013 Remi Collet <remi@fedoraproject.org> 0.9.3-2
- backport 0.9.3 for remi repo.

* Mon Dec 31 2012 Shawn Iwinski <shawn.iwinski@gmail.com> 0.9.3-2
- Added php_min_ver
- Fixed requires for php_min_ver and non-Fedora

* Thu Dec 20 2012 Shawn Iwinski <shawn.iwinski@gmail.com> 0.9.3-1
- Initial package