blob: ddd222b4cf872cb4675f463448a9f29b4347b956 (
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
336
337
338
339
340
341
342
343
344
345
346
|
# remirepo spec file for php-twig
# With SCL stuff, from Fedora:
#
# RPM spec file for php-twig
#
# Copyright (c) 2014-2015 Shawn Iwinski <shawn.iwinski@gmail.com>
# Remi Collet <remi@fedoraproject.org>
#
# License: MIT
# http://opensource.org/licenses/MIT
#
# Please preserve changelog entries
#
%global github_owner twigphp
%global github_name Twig
%global github_version 1.20.0
%global github_commit 1ea4e5f81c6d005fe84d0b38e1c4f1955eb86844
%global github_short %(c=%{github_commit}; echo ${c:0:7})
# Lib
%global composer_vendor twig
%global composer_project twig
# Ext
%global ext_name twig
%global with_zts 0%{?__ztsphp:1}
%if "%{php_version}" < "5.6"
%global ini_name %{ext_name}.ini
%else
%global ini_name 40-%{ext_name}.ini
%endif
# "php": ">=5.2.7"
%global php_min_ver 5.2.7
%if 0%{?scl:1}
# PHPUnit not available in SCL
%global with_tests 0
%if "%{scl}" == "rh-php56"
%global sub_prefix more-php56-
%else
%global sub_prefix %{scl_prefix}
%endif
%else
# Build using "--without tests" to disable tests
%global with_tests 0%{!?_without_tests:1}
%endif
%{?scl: %scl_package php-twig}
%{!?scl: %global pkg_name %{name}}
%{!?phpdir: %global phpdir %{_datadir}/php}
%{!?php_inidir: %global php_inidir %{_sysconfdir}/php.d}
%{!?__php: %global __php %{_bindir}/php}
Name: %{?sub_prefix}php-%{composer_project}
Version: %{github_version}
Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
Summary: The flexible, fast, and secure template engine for PHP
Group: Development/Libraries
License: BSD
URL: http://twig.sensiolabs.org
Source0: https://github.com/%{github_owner}/%{github_name}/archive/%{github_commit}/%{pkg_name}-%{github_version}-%{github_short}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: %{?scl_prefix}php-devel >= %{php_min_ver}
%if %{with_tests}
# For tests
BuildRequires: %{_bindir}/phpunit
## phpcompatinfo (computed from version 1.18.2)
BuildRequires: %{?scl_prefix}php-ctype
BuildRequires: %{?scl_prefix}php-date
BuildRequires: %{?scl_prefix}php-dom
BuildRequires: %{?scl_prefix}php-hash
BuildRequires: %{?scl_prefix}php-iconv
BuildRequires: %{?scl_prefix}php-json
BuildRequires: %{?scl_prefix}php-mbstring
BuildRequires: %{?scl_prefix}php-pcre
BuildRequires: %{?scl_prefix}php-reflection
BuildRequires: %{?scl_prefix}php-spl
%endif
# Lib
## composer.json
Requires: %{?scl_prefix}php(language) >= %{php_min_ver}
## phpcompatinfo (computed from version 1.18.2)
Requires: %{?scl_prefix}php-ctype
Requires: %{?scl_prefix}php-date
Requires: %{?scl_prefix}php-dom
Requires: %{?scl_prefix}php-hash
Requires: %{?scl_prefix}php-iconv
Requires: %{?scl_prefix}php-json
Requires: %{?scl_prefix}php-mbstring
Requires: %{?scl_prefix}php-pcre
Requires: %{?scl_prefix}php-reflection
Requires: %{?scl_prefix}php-spl
# Ext
Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api}
Requires: %{?scl_prefix}php(api) = %{php_core_api}
%{?_sclreq:Requires: %{?scl_prefix}runtime%{?_sclreq}%{?_isa}}
# Lib
## Composer
Provides: %{?scl_prefix}php-composer(%{composer_vendor}/%{composer_project}) = %{version}
## Rename
Obsoletes: %{?scl_prefix}php-twig-Twig < %{version}-%{release}
Provides: %{?scl_prefix}php-twig-Twig = %{version}-%{release}
## PEAR
Provides: %{?scl_prefix}php-pear(pear.twig-project.org/Twig) = %{version}
# Ext
## Rename
Obsoletes: %{?scl_prefix}php-twig-ctwig < %{version}-%{release}
Provides: %{?scl_prefix}php-twig-ctwig = %{version}-%{release}
Provides: %{?scl_prefix}php-twig-ctwig%{?_isa} = %{version}-%{release}
## Compat SCL (rh-php56)
Provides: %{?scl_prefix}php-twig = %{version}-%{release}
Provides: %{?scl_prefix}php-twig%{?_isa} = %{version}-%{release}
## PECL
Provides: %{?scl_prefix}php-pecl(pear.twig-project.org/CTwig) = %{version}
Provides: %{?scl_prefix}php-pecl(pear.twig-project.org/CTwig)%{?_isa} = %{version}
# This pkg was the only one in this channel so the channel is no longer needed
Obsoletes: %{?scl_prefix}php-channel-twig
%if "%{?vendor}" == "Remi Collet" && 0%{!?scl:1}
# Other third party repo stuff
Obsoletes: php53-%{ext_name} <= %{version}
Obsoletes: php53u-%{ext_name} <= %{version}
Obsoletes: php54-%{ext_name} <= %{version}
Obsoletes: php54w-%{ext_name} <= %{version}
%if "%{php_version}" > "5.5"
Obsoletes: php55u-%{ext_name} <= %{version}
Obsoletes: php55w-%{ext_name} <= %{version}
%endif
%if "%{php_version}" > "5.6"
Obsoletes: php56u-%{ext_name} <= %{version}
Obsoletes: php56w-%{ext_name} <= %{version}
%endif
%if "%{php_version}" > "7.0"
Obsoletes: php70u-%{ext_name} <= %{version}
Obsoletes: php70w-%{ext_name} <= %{version}
%endif
%endif
%if 0%{?fedora} < 20 && 0%{?rhel} < 7
# Filter shared private
%{?filter_provides_in: %filter_provides_in %{_libdir}/.*\.so$}
%{?filter_setup}
%endif
%description
%{summary}.
* Fast: Twig compiles templates down to plain optimized PHP code. The
overhead compared to regular PHP code was reduced to the very minimum.
* Secure: Twig has a sandbox mode to evaluate untrusted template code. This
allows Twig to be used as a template language for applications where users
may modify the template design.
* Flexible: Twig is powered by a flexible lexer and parser. This allows the
developer to define its own custom tags and filters, and create its own
DSL.
Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')%{?scl: as Software Collection (%{scl})}.
%prep
%setup -qn %{github_name}-%{github_commit}
: Ext -- NTS
mv ext/%{ext_name} ext/NTS
%if %{with_zts}
: Ext -- ZTS
cp -pr ext/NTS ext/ZTS
%endif
: Ext -- Create configuration file
cat > %{ini_name} << 'INI'
; Enable %{ext_name} extension module
extension=%{ext_name}.so
INI
: Create lib autoloader
(cat <<'AUTOLOAD'
<?php
/**
* Autoloader created by %{name}-%{version}-%{release}
*/
require_once __DIR__ . '/Autoloader.php';
Twig_Autoloader::register();
AUTOLOAD
) | tee lib/Twig/autoload.php
%build
: Ext -- NTS
pushd ext/NTS
%{_bindir}/phpize
%configure --with-php-config=%{_bindir}/php-config
make %{?_smp_mflags}
popd
: Ext -- ZTS
%if %{with_zts}
pushd ext/ZTS
%{_bindir}/zts-phpize
%configure --with-php-config=%{_bindir}/zts-php-config
make %{?_smp_mflags}
popd
%endif
%install
rm -rf %{buildroot}
: Lib
mkdir -p %{buildroot}%{phpdir}
cp -rp lib/* %{buildroot}%{phpdir}/
: Ext -- NTS
make -C ext/NTS install INSTALL_ROOT=%{buildroot}
install -D -m 0644 %{ini_name} %{buildroot}%{php_inidir}/%{ini_name}
: Ext -- ZTS
%if %{with_zts}
make -C ext/ZTS install INSTALL_ROOT=%{buildroot}
install -D -m 0644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name}
%endif
%check
: Extension NTS minimal load test
%{__php} --no-php-ini \
--define extension=ext/NTS/modules/%{ext_name}.so \
--modules | grep %{ext_name}
%if %{with_zts}
: Extension ZTS minimal load test
%{__ztsphp} --no-php-ini \
--define extension=ext/ZTS/modules/%{ext_name}.so \
--modules | grep %{ext_name}
%endif
%if %{with_tests}
: Skip tests known to fail
sed 's#function testGetAttributeExceptions#function SKIP_testGetAttributeExceptions#' \
-i test/Twig/Tests/TemplateTest.php
# i386 failing on EL-5
%ifarch ppc64 %{ix86}
sed 's/function testGetAttributeWithTemplateAsObject/function SKIP_testGetAttributeWithTemplateAsObject/' \
-i test/Twig/Tests/TemplateTest.php
%endif
: Test suite without extension
%{_bindir}/phpunit --bootstrap %{buildroot}%{phpdir}/Twig/autoload.php -v
: Test suite with extension
%{_bindir}/php --define extension=ext/NTS/modules/%{ext_name}.so \
%{_bindir}/phpunit --bootstrap %{buildroot}%{phpdir}/Twig/autoload.php -v
%else
: Tests skipped
%endif
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root,-)
%{!?_licensedir:%global license %%doc}
%license LICENSE
%doc CHANGELOG README.rst composer.json
# Lib
%{phpdir}/Twig
# Ext
## NTS
%config(noreplace) %{php_inidir}/%{ini_name}
%{php_extdir}/%{ext_name}.so
## ZTS
%if %{with_zts}
%config(noreplace) %{php_ztsinidir}/%{ini_name}
%{php_ztsextdir}/%{ext_name}.so
%endif
%changelog
* Wed Aug 12 2015 Remi Collet <remi@fedoraproject.org> - 1.20.0-1
- Update to 1.20.0
* Fri Jul 31 2015 Remi Collet <remi@fedoraproject.org> - 1.19.0-1
- Update to 1.19.0
* Mon Jun 22 2015 Remi Collet <rcollet@redhat.com> - 1.18.2-4
- add virtual "rh-php56" provides
* Fri Jun 19 2015 Remi Collet <remi@fedoraproject.org> - 1.18.2-3
- allow build against rh-php56 (as more-php56)
* Mon Jun 15 2015 Remi Collet <remi@fedoraproject.org> - 1.18.2-2
- rebuild for remirepo with rawhide changes (autoloader)
* Thu Jun 11 2015 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.18.2-1
- Updated to 1.18.2 (BZ #1183601)
- Added autoloader
* Sun Jun 7 2015 Remi Collet <remi@fedoraproject.org> - 1.18.2-1
- Update to 1.18.2
* Sun Apr 19 2015 Remi Collet <remi@fedoraproject.org> - 1.18.1-1
- Update to 1.18.1
* Mon Jan 26 2015 Remi Collet <remi@fedoraproject.org> - 1.18.0-1
- Update to 1.18.0
* Wed Jan 14 2015 Remi Collet <remi@fedoraproject.org> - 1.17.0-1
- Update to 1.17.0
* Fri Dec 26 2014 Remi Collet <remi@fedoraproject.org> - 1.16.3-1
- Update to 1.16.3
* Wed Dec 24 2014 Remi Collet <remi@fedoraproject.org> - 1.16.2-1.1
- Fedora 21 SCL mass rebuild
* Fri Oct 17 2014 Remi Collet <remi@fedoraproject.org> - 1.16.2-1
- Update to 1.16.2
* Sat Oct 11 2014 Remi Collet <remi@fedoraproject.org> - 1.16.1-1
- Update to 1.16.1
* Thu Aug 28 2014 Remi Collet <remi@fedoraproject.org> - 1.16.0-2
- allow SCL build
- add backport stuff for EL-5
* Mon Aug 25 2014 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.16.0-2
- Removed obsolete and provide of php-twig-CTwig (never imported into Fedora/EPEL)
- Obsolete php-channel-twig
- Removed comment about optional Xdebug in description (does not provide any new feature)
- Always run extension minimal load test
* Tue Jul 29 2014 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.16.0-1
- Initial package
|