summaryrefslogtreecommitdiffstats
path: root/php-symfony-polyfill.spec
blob: 78e88104d09687c64c869f94db9a46fc6d241b7a (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
# remirepo spec file for php-symfony-polyfill
#
# Fedora spec file for php-symfony-polyfill
#
# Copyright (c) 2015-2020 Shawn Iwinski <shawn@iwin.ski>
#
# License: MIT
# http://opensource.org/licenses/MIT
#
# Please preserve changelog entries
#

%global github_owner     symfony
%global github_name      polyfill
%global github_version   1.23.1
%global github_commit    163f6bb9f9f151fa74f245077636b78e2560487e

%global composer_vendor  symfony
%global composer_project polyfill

# "php": ">=7.1"
%global php_min_ver 7.1

# Build using "--without tests" to disable tests
%bcond_without     tests

%{!?phpdir:  %global phpdir  %{_datadir}/php}

Name:          php-%{composer_vendor}-%{composer_project}
Version:       %{github_version}
Release:       1%{?github_release}%{?dist}
Summary:       Symfony polyfills backporting features to lower PHP versions

License:       MIT
URL:           https://github.com/%{github_owner}/%{github_name}
Source0:       %{url}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz

BuildArch:     noarch
# Autoloader
BuildRequires: php-fedora-autoloader-devel
# Tests
%if %{with tests}
%if 0%{?fedora} >= 31 || 0%{?rhel} >= 9
%global phpunit %{_bindir}/phpunit9
%else
%global phpunit %{_bindir}/phpunit8
%endif
BuildRequires: php-symfony4-intl
BuildRequires: php-symfony4-var-dumper
BuildRequires: %{phpunit}
## composer.json
BuildRequires: php(language) >= %{php_min_ver}
## phpcompatinfo (computed from version 1.8.0)
BuildRequires: php-hash
BuildRequires: php-iconv
BuildRequires: php-intl
BuildRequires: php-json
BuildRequires: php-ldap
BuildRequires: php-pcre
BuildRequires: php-reflection
BuildRequires: php-spl
%endif

# composer.json
Requires:      php(language) >= %{php_min_ver}
# phpcompatinfo (computed from version 1.8.0)
Requires:      php-hash
Requires:      php-iconv
Requires:      php-intl
Requires:      php-json
Requires:      php-pcre
Requires:      php-reflection
Requires:      php-spl
# Autoloader
Requires:      php-composer(fedora/autoloader)

# Composer
Provides:      php-composer(%{composer_vendor}/%{composer_project})       = %{version}
Provides:      php-composer(%{composer_vendor}/%{composer_project}-mbstring) = %{version}
Provides:      php-composer(%{composer_vendor}/%{composer_project}-util)  = %{version}
Provides:      php-composer(%{composer_vendor}/%{composer_project}-php72) = %{version}
Provides:      php-composer(%{composer_vendor}/%{composer_project}-php73) = %{version}
Provides:      php-composer(%{composer_vendor}/%{composer_project}-php74) = %{version}
Provides:      php-composer(%{composer_vendor}/%{composer_project}-php80) = %{version}
Provides:      php-composer(%{composer_vendor}/%{composer_project}-php81) = %{version}

%description
%{summary}.

Autoloader: %{phpdir}/Symfony/Polyfill/autoload.php


%prep
%setup -qn %{github_name}-%{github_commit}

: Docs
mkdir -p docs/{Mbstring,Php72,Php73,Php74,Php80,Php81,Util}
mv *.md composer.json docs/
mv src/Mbstring/{*.md,composer.json}  docs/Mbstring/
mv src/Php72/{*.md,composer.json} docs/Php72/
mv src/Php73/{*.md,composer.json} docs/Php73/
mv src/Php74/{*.md,composer.json} docs/Php74/
mv src/Php80/{*.md,composer.json} docs/Php80/
mv src/Php81/{*.md,composer.json} docs/Php81/
mv src/Util/{*.md,composer.json}  docs/Util/

: Remove unneeded polyfills as extensions are available
rm -rf {src,tests}/{Apcu,Ctype,Iconv,Intl,Uuid,Xml}


%build
: Create autoloader classmap
%{_bindir}/phpab --template fedora --tolerant --output src/autoload.php src/
cat src/autoload.php

: Create autoloader
cat <<'AUTOLOAD' | tee -a src/autoload.php

\Fedora\Autoloader\Dependencies::required(array(
    __DIR__ . '/bootstrap.php',
    __DIR__ . '/Mbstring/bootstrap.php',
));
AUTOLOAD


%install

: Library
mkdir -p %{buildroot}%{phpdir}/Symfony/Polyfill
cp -rp src/* %{buildroot}%{phpdir}/Symfony/Polyfill/


%check
%if %{with tests}
mkdir vendor
cat << 'EOF' | tee vendor/autoload.php
<?php
require '%{buildroot}%{phpdir}/Symfony/Polyfill/autoload.php';
require '%{phpdir}/Symfony4/Component/Intl/autoload.php';
require '%{phpdir}/Symfony4/Component/VarDumper/autoload.php';
EOF

: Upstream tests
RETURN_CODE=0
for cmdarg in "php %{phpunit}" "php72 %{_bindir}/phpunit8" php73 php74 php80; do
    if which $cmdarg; then
        set $cmdarg
        $1 ${2:-%{_bindir}/phpunit9} --verbose \
            || RETURN_CODE=1
    fi
done
exit $RETURN_CODE
%else
: Tests skipped
%endif


%files
%{!?_licensedir:%global license %%doc}
%license LICENSE
%doc docs/*
%dir %{phpdir}/Symfony
     %{phpdir}/Symfony/Polyfill
%exclude %{phpdir}/Symfony/Polyfill/*/LICENSE


%changelog
* Thu Jul 29 2021 Remi Collet <remi@remirepo.net> - 1.23.1-1
- update to 1.23.1

* Mon May 31 2021 Remi Collet <remi@remirepo.net> - 1.23.0-1
- update to 1.23.0

* Tue Feb 16 2021 Remi Collet <remi@remirepo.net> - 1.22.1-1
- update to 1.22.1

* Fri Jan  8 2021 Remi Collet <remi@remirepo.net> - 1.22.0-1
- update to 1.22.0
- provides symfony/polyfill-php81

* Mon Oct 26 2020 Remi Collet <remi@remirepo.net> - 1.20.0-1
- update to 1.20.0
- raise dependency on PHP 7.1
- switch to phpunit9

* Fri Oct 23 2020 Remi Collet <remi@remirepo.net> - 1.19.0-1
- update to 1.19.0

* Tue Aug 11 2020 Remi Collet <remi@remirepo.net> - 1.18.1-1
- update to 1.18.1

* Wed Jul 15 2020 Remi Collet <remi@remirepo.net> - 1.18.0-1
- update to 1.18.0

* Thu Jul  2 2020 Remi Collet <remi@remirepo.net> - 1.17.1-1
- update to 1.17.1

* Wed May 13 2020 Remi Collet <remi@remirepo.net> - 1.17.0-1
- update to 1.17.0

* Mon May 11 2020 Remi Collet <remi@remirepo.net> - 1.16.0-1
- update to 1.16.0

* Fri Mar 27 2020 Remi Collet <remi@remirepo.net> - 1.15.0-1
- update to 1.15.0

* Mon Feb 17 2020 Remi Collet <remi@remirepo.net> - 1.14.0-1
- update to 1.14.0
- provides symfony/polyfill-php80

* Wed Dec  4 2019 Remi Collet <remi@remirepo.net> - 1.13.1-1
- update to 1.13.1 (no change)

* Thu Nov 28 2019 Remi Collet <remi@remirepo.net> - 1.13.0-1
- update to 1.13.0

* Tue Aug 20 2019 Remi Collet <remi@remirepo.net> - 1.12.0-1
- update to 1.12.0
- add symfony/polyfill-php74

* Tue Mar 26 2019 Remi Collet <remi@remirepo.net> - 1.11.0-1
- update to 1.11.0

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

* Mon Aug 27 2018 Remi Collet <remi@remirepo.net> - 1.9.0-1
- update to 1.9.0

* Mon Jul 16 2018 Remi Collet <remi@remirepo.net> - 1.8.0-3
- raise dependency on PHP 7 and ignore dependencies on
  ircmaxell/password-compat and paragonie/random_compat

* Fri May  4 2018 Remi Collet <remi@remirepo.net> - 1.8.0-1
- update to 1.8.0
- add symfony/polyfill-php73
- use range dependencies

* Wed Apr 11 2018 Remi Collet <remi@remirepo.net> - 1.7.0-2
- add symfony/polyfill-mbstring for mb_chr, mb_ord, mb_scrub
- add dependency on iconv and intl extensions

* Fri Mar  2 2018 Remi Collet <remi@remirepo.net> - 1.7.0-1
- Update to 1.7.0

* Wed Aug 30 2017 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.5.0-1
- Updated to 1.5.0 (RHBZ #1482156)
- Added version constraints to ircmaxell/password-compat
- Added max version constraint to paragonie/random_compat BuildeRequires
- Removed php-mbstring dependency

* Sun Jul 09 2017 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.4.0-1
- Updated to 1.4.0 (RHBZ #1460473)
- Provide php-composer(symfony/polyfill-php72)
- Test with SCLs if available

* Mon Nov 14 2016 Remi Collet <remi@fedoraproject.org> - 1.3.0-1
- Updated to 1.3.0
- provide php-composer(symfony/polyfill-php71)
- switch to fedora/autoloader

* Thu Jun 16 2016 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.2.0-1
- Updated to 1.2.0 (RHBZ #1301791)

* Tue Apr 12 2016 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.1.1-1
- Updated to 1.1.1 (RHBZ #1301791)

* Tue Dec 29 2015 Shawn Iwinski <shawn@iwin.ski> - 1.0.1-1
- update to 1.0.1

* Mon Dec 07 2015 Shawn Iwinski <shawn@iwin.ski> - 1.0.0-3
- Fixed Util docs
- Added "%%dir %%{phpdir}/Symfony" to %%files

* Sun Dec 06 2015 Shawn Iwinski <shawn@iwin.ski> - 1.0.0-2
- Always include ALL polyfills

* Sun Dec  6 2015 Remi Collet <remi@remirepo.net> - 1.0.0-1
- provide everything for all PHP version
- add backport stuff

* Wed Nov 25 2015 Shawn Iwinski <shawn@iwin.ski> - 1.0.0-1
- Initial package