summaryrefslogtreecommitdiffstats
path: root/php-nikic-php-parser4.spec
blob: 0a8405b1496835cd9fdf59eac61170138fcba655 (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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
# remirepo/fedora spec file for php-nikic-php-parser4
#
# Copyright (c) 2016-2024 Remi Collet
# License: CC-BY-SA-4.0
# http://creativecommons.org/licenses/by-sa/4.0/
#
# Please, preserve the changelog entries
#

# remirepo:2
# For compatibility with SCL
%undefine __brp_mangle_shebangs

%if 0%{?fedora}
%bcond_without tests
%else
# disabled as phpunit not availble
%bcond_with    tests
%endif

%global gh_commit    0ed4c8949a32986043e977dbe14776c14d644c45
%global gh_short     %(c=%{gh_commit}; echo ${c:0:7})
%global gh_owner     nikic
%global gh_project   PHP-Parser
%global pk_project   php-parser
%global php_home     %{_datadir}/php
%global ns_project   PhpParser
%global major        4

Name:           php-%{gh_owner}-%{pk_project}%{major}
Version:        4.19.2
Release:        1%{?dist}
Summary:        A PHP parser written in PHP - version %{major}

License:        BSD-3-Clause
URL:            https://github.com/%{gh_owner}/%{gh_project}
Source0:        %{name}-%{version}-%{gh_short}.tgz
Source1:        makesrc.sh

# Autoloader
Patch0:         %{name}-rpm.patch

BuildArch:      noarch
%if %{with tests}
# For tests
# as we use phpunit9
BuildRequires:  php(language) >= 7.3
BuildRequires:  php-tokenizer
BuildRequires:  php-reflection
BuildRequires:  php-ctype
BuildRequires:  php-json
BuildRequires:  php-pcre
BuildRequires:  php-spl
# From composer.json, "require-dev": {
#        "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0",
#        "ircmaxell/php-yacc": "0.0.7"
%global phpunit %{_bindir}/phpunit9
BuildRequires:  phpunit9
# Autoloader
%endif
BuildRequires:  php-fedora-autoloader-devel

# From composer.json, "require": {
#        "php": ">=7.1",
#        "ext-tokenizer": "*"
Requires:       php(language) >= 7.1
Requires:       php-tokenizer
# From phpcompatinfo report for version 4.0.0
Requires:       php-reflection
Requires:       php-ctype
Requires:       php-json
Requires:       php-pcre
Requires:       php-spl
Requires:       php-cli
# Autoloader
Requires:       php-composer(fedora/autoloader)

Provides:       php-composer(%{gh_owner}/%{pk_project}) = %{version}


%description
This is a PHP parser written in PHP.
Its purpose is to simplify static code analysis and manipulation.

This package provides the library version %{major} and the php-parse%{major} command.

Documentation: https://github.com/nikic/PHP-Parser/tree/master/doc

Autoloader: %{php_home}/%{ns_project}%{major}/autoload.php


%prep
%setup -q -n %{gh_project}-%{gh_commit}

%patch -P0 -p1 -b .rpm


%build
: Generate an simple classmap autoloader
phpab --template fedora \
      --output lib/%{ns_project}/autoload.php \
      lib/%{ns_project}


%install
: Library
mkdir -p                 %{buildroot}%{php_home}
cp -pr lib/%{ns_project} %{buildroot}%{php_home}/%{ns_project}%{major}

: Command
install -Dpm 0755 bin/php-parse %{buildroot}%{_bindir}/php-parse%{major}


%check
%if %{with tests}
: Test the command
sed -e 's:%{php_home}:%{buildroot}%{php_home}:' \
    bin/php-parse > bin/php-parse-test
php bin/php-parse-test --help

: Test suite autoloader
mkdir vendor
cat << 'AUTOLOAD' | tee vendor/autoload.php
<?php
\Fedora\Autoloader\Autoload::addPsr4('%{ns_project}\\', dirname(__DIR__).'/test/PhpParser/');
AUTOLOAD

: Upstream test suite
FILTER="--filter '^((?!(testLexNewFeatures)).)*$'"

ret=0
for cmdarg in "php %{phpunit}" php81 php82 php83 php84; do
  if which $cmdarg; then
    set $cmdarg
    $1 -d include_path=%{php_home} \
       -d auto_prepend_file=%{buildroot}/%{php_home}/%{ns_project}%{major}/autoload.php \
      ${2:-%{_bindir}/phpunit9} $FILTER --verbose || ret=1
  fi
done
exit $ret
%else
: Test suite disabled
%endif


%files
%license LICENSE
%doc composer.json
%doc *.md
%{_bindir}/php-parse%{major}
%{php_home}/%{ns_project}%{major}


%changelog
* Wed Sep 18 2024 Remi Collet <remi@remirepo.net> - 4.19.2-1
- update to 4.19.2

* Tue Mar 19 2024 Remi Collet <remi@remirepo.net> - 4.19.1-1
- update to 4.19.1
- raise dependency on PHP 7.1

* Mon Dec 11 2023 Remi Collet <remi@remirepo.net> - 4.18.0-1
- update to 4.18.0

* Fri Aug 18 2023 Remi Collet <remi@remirepo.net> - 4.17.1-1
- update to 4.17.1

* Mon Jun 26 2023 Remi Collet <remi@remirepo.net> - 4.16.0-1
- update to 4.16.0

* Wed May 24 2023 Remi Collet <remi@remirepo.net> - 4.15.5-1
- update to 4.15.5

* Mon Mar  6 2023 Remi Collet <remi@remirepo.net> - 4.15.4-1
- update to 4.15.4

* Tue Jan 17 2023 Remi Collet <remi@remirepo.net> - 4.15.3-1
- update to 4.15.3

* Mon Nov 14 2022 Remi Collet <remi@remirepo.net> - 4.15.2-1
- update to 4.15.2

* Thu Sep  8 2022 Remi Collet <remi@remirepo.net> - 4.15.1-1
- update to 4.15.1

* Mon Jun 13 2022 Remi Collet <remi@remirepo.net> - 4.14.0-2
- only run test suite on Fedora, not on EL

* Wed Jun  1 2022 Remi Collet <remi@remirepo.net> - 4.14.0-1
- update to 4.14.0

* Wed Dec  1 2021 Remi Collet <remi@remirepo.net> - 4.13.2-1
- update to 4.13.2

* Thu Nov  4 2021 Remi Collet <remi@remirepo.net> - 4.13.1-1
- update to 4.13.1

* Tue Sep 21 2021 Remi Collet <remi@remirepo.net> - 4.13.0-1
- update to 4.13.0

* Wed Jul 21 2021 Remi Collet <remi@remirepo.net> - 4.12.0-1
- update to 4.12.0

* Wed Jul 21 2021 Remi Collet <remi@remirepo.net> - 4.11.0-2
- add upstream patches for PHP 8.1

* Mon Jul  5 2021 Remi Collet <remi@remirepo.net> - 4.11.0-1
- update to 4.11.0
- switch to phpunit9

* Tue May  4 2021 Remi Collet <remi@remirepo.net> - 4.10.5-1
- update to 4.10.5

* Mon Dec 21 2020 Remi Collet <remi@remirepo.net> - 4.10.4-1
- update to 4.10.4

* Fri Dec  4 2020 Remi Collet <remi@remirepo.net> - 4.10.3-1
- update to 4.10.3

* Mon Sep 28 2020 Remi Collet <remi@remirepo.net> - 4.10.2-1
- update to 4.10.2

* Thu Sep 24 2020 Remi Collet <remi@remirepo.net> - 4.10.1-1
- update to 4.10.1

* Sun Sep 20 2020 Remi Collet <remi@remirepo.net> - 4.10.0-1
- update to 4.10.0

* Mon Aug 31 2020 Remi Collet <remi@remirepo.net> - 4.9.1-1
- update to 4.9.1

* Wed Aug 19 2020 Remi Collet <remi@remirepo.net> - 4.9.0-1
- update to 4.9.0

* Mon Aug 10 2020 Remi Collet <remi@remirepo.net> - 4.8.0-1
- update to 4.8.0

* Sun Jul 26 2020 Remi Collet <remi@remirepo.net> - 4.7.0-1
- update to 4.7.0

* Fri Jul  3 2020 Remi Collet <remi@remirepo.net> - 4.6.0-1
- update to 4.6.0

* Thu Jun 25 2020 Remi Collet <remi@remirepo.net> - 4.5.0-2
- switch to classmap autoloader
- add missing dependency on fedora/autoloader

* Wed Jun  3 2020 Remi Collet <remi@remirepo.net> - 4.5.0-1
- update to 4.5.0

* Mon Apr 13 2020 Remi Collet <remi@remirepo.net> - 4.4.0-1
- update to 4.4.0

* Tue Nov 12 2019 Remi Collet <remi@remirepo.net> - 4.3.0-1
- update to 4.3.0

* Mon Oct 28 2019 Remi Collet <remi@remirepo.net> - 4.2.5-1
- update to 4.2.5
- sources from git snapshot

* Mon Sep  2 2019 Remi Collet <remi@remirepo.net> - 4.2.4-1
- update to 4.2.4

* Mon Aug 19 2019 Remi Collet <remi@remirepo.net> - 4.2.3-1
- update to 4.2.3
- use phpunit8

* Mon May 27 2019 Remi Collet <remi@remirepo.net> - 4.2.2-1
- update to 4.2.2

* Mon Feb 18 2019 Remi Collet <remi@remirepo.net> - 4.2.1-1
- update to 4.2.1

* Sun Jan 13 2019 Remi Collet <remi@remirepo.net> - 4.2.0-1
- update to 4.2.0

* Thu Dec 27 2018 Remi Collet <remi@remirepo.net> - 4.1.1-1
- update to 4.1.1

* Wed Oct 10 2018 Remi Collet <remi@remirepo.net> - 4.1.0-1
- update to 4.1.0
- https://github.com/nikic/PHP-Parser/issues/539 - PHP 7.3

* Tue Sep 18 2018 Remi Collet <remi@remirepo.net> - 4.0.4-1
- update to 4.0.4

* Mon Jul 16 2018 Remi Collet <remi@remirepo.net> - 4.0.3-1
- update to 4.0.3

* Mon Jun  4 2018 Remi Collet <remi@remirepo.net> - 4.0.2-1
- update to 4.0.2

* Mon Mar 26 2018 Remi Collet <remi@remirepo.net> - 4.0.1-1
- update to 4.0.1

* Thu Mar 22 2018 Remi Collet <remi@remirepo.net> - 4.0.0-1
- Update to 4.0.0
- rename to php-nikic-php-parser4 and move to /usr/share/php/PhpParser4
- raise dependency on PHP 7
- use phpunit6 or phpunit7 (F28+)

* Thu Mar  1 2018 Remi Collet <remi@remirepo.net> - 3.1.5-1
- Update to 3.1.5

* Fri Jan 26 2018 Remi Collet <remi@remirepo.net> - 3.1.4-1
- Update to 3.1.4

* Wed Dec 27 2017 Remi Collet <remi@remirepo.net> - 3.1.3-1
- Update to 3.1.3

* Mon Nov  6 2017 Remi Collet <remi@remirepo.net> - 3.1.2-1
- Update to 3.1.2

* Mon Sep  4 2017 Remi Collet <remi@remirepo.net> - 3.1.1-1
- Update to 3.1.1

* Sat Aug  5 2017 Remi Collet <remi@remirepo.net> - 3.1.0-1
- Update to 3.1.0

* Thu Jun 29 2017 Remi Collet <remi@remirepo.net> - 3.0.6-1
- Update to 3.0.6

* Mon Mar  6 2017 Remi Collet <remi@remirepo.net> - 3.0.5-1
- Update to 3.0.5
- always provide the command, with version suffix

* Sat Feb 11 2017 Remi Collet <remi@fedoraproject.org> - 3.0.4-1
- update to 3.0.4

* Sat Feb  4 2017 Remi Collet <remi@fedoraproject.org> - 3.0.3-1
- update to 3.0.3

* Wed Dec 7  2016 Remi Collet <remi@fedoraproject.org> - 3.0.2-1
- new package for library version 3