summaryrefslogtreecommitdiffstats
path: root/php56.spec
blob: 32b8da9a666654355c3ebb289a9459a72b6c459e (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
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
# remirepo spec file for php56 SCL metapackage
#
# Copyright (c) 2013-2023 Remi Collet
# License: CC-BY-SA-4.0
# http://creativecommons.org/licenses/by-sa/4.0/
#
# Please, preserve the changelog entries
#
%global scl_name_base    php
%global scl_name_version 56
%global scl              %{scl_name_base}%{scl_name_version}
%global macrosdir        %(d=%{_rpmconfigdir}/macros.d; [ -d $d ] || d=%{_root_sysconfdir}/rpm; echo $d)
%global install_scl      1

%if 0%{?fedora} >= 26 || 0%{?rhel} >= 8
%global rh_layout        1
%endif

%if 0%{?fedora} >= 20 && 0%{?fedora} < 27
# Requires scl-utils v2 for SCL integration, dropeed in F29
%global with_modules     1
%else
# Works with file installed in /usr/share/Modules/modulefiles/
%global with_modules     0
%endif

%scl_package %scl

# do not produce empty debuginfo package
%global debug_package %{nil}

Summary:       Package that installs PHP 5.6
Name:          %scl_name
Version:       5.6
Release:       1%{?dist}
Group:         Development/Languages
License:       GPL-2.0-or-later

Source0:       macros-build
Source1:       README
Source2:       LICENSE

BuildRoot:     %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: scl-utils-build
BuildRequires: help2man
# Temporary work-around
BuildRequires: iso-codes
BuildRequires: environment-modules

Requires:      %{?scl_prefix}php-common%{?_isa} >= 5.6.31
Requires:      %{?scl_prefix}php-cli%{?_isa}
Requires:      %{?scl_prefix}php-pear           >= 1:1.10.5
Requires:      %{?scl_name}-runtime%{?_isa}      = %{version}-%{release}

%description
This is the main package for %scl Software Collection,
that install PHP 5.6 language.


%package runtime
Summary:   Package that handles %scl Software Collection.
Group:     Development/Languages
Requires:  scl-utils
Requires:  environment-modules
Requires(post): %{_root_sbindir}/semanage
Requires(post): %{_root_sbindir}/selinuxenabled
Provides:  %{?scl_name}-runtime(%{scl_vendor})
Provides:  %{?scl_name}-runtime(%{scl_vendor})%{?_isa}

%description runtime
Package shipping essential scripts to work with %scl Software Collection.


%package build
Summary:   Package shipping basic build configuration
Group:     Development/Languages
Requires:  scl-utils-build
Requires:  %{?scl_name}-runtime%{?_isa} = %{version}-%{release}

%description build
Package shipping essential configuration macros
to build %scl Software Collection.


%package scldevel
Summary:   Package shipping development files for %scl
Group:     Development/Languages
Requires:  %{?scl_name}-runtime%{?_isa} = %{version}-%{release}

%description scldevel
Package shipping development files, especially usefull for development of
packages depending on %scl Software Collection.


%package syspaths
Summary:   System-wide wrappers for the %{name} package
Requires:  %{?scl_name}-runtime%{?_isa} = %{version}-%{release}
Requires:  %{?scl_name}-php-cli%{?_isa}
Requires:  %{?scl_name}-php-common%{?_isa}
Conflicts: php-common
Conflicts: php-cli
Conflicts: php54-syspaths
Conflicts: php55-syspaths
Conflicts: php70-syspaths
Conflicts: php71-syspaths
Conflicts: php72-syspaths
Conflicts: php73-syspaths

%description syspaths
System-wide wrappers for the %{name}-php-cli package.

Using the %{name}-syspaths package does not require running the
'scl enable' or 'module command. This package practically replaces the system
default php-cli package. It provides the php, phar and php-cgi commands.

Note that the php-cli and %{name}-syspaths packages conflict and cannot
be installed on one system.


%prep
%setup -c -T

cat <<EOF | tee enable
export PATH=%{_bindir}:%{_sbindir}\${PATH:+:\${PATH}}
export LD_LIBRARY_PATH=%{_libdir}\${LD_LIBRARY_PATH:+:\${LD_LIBRARY_PATH}}
export MANPATH=%{_mandir}:\${MANPATH}
EOF

# Broken: /usr/share/Modules/bin/createmodule.sh enable | tee envmod
# See https://bugzilla.redhat.com/show_bug.cgi?id=1197321
cat << EOF | tee envmod
#%%Module1.0
prepend-path    X_SCLS              %{scl}
prepend-path    PATH                %{_bindir}:%{_sbindir}
prepend-path    LD_LIBRARY_PATH     %{_libdir}
prepend-path    MANPATH             %{_mandir}
prepend-path    PKG_CONFIG_PATH     %{_libdir}/pkgconfig
EOF

# generate rpm macros file for depended collections
cat << EOF | tee scldev
%%scl_%{scl_name_base}         %{scl}
%%scl_prefix_%{scl_name_base}  %{scl_prefix}
EOF

# This section generates README file from a template and creates man page
# from that file, expanding RPM macros in the template file.
cat >README <<'EOF'
%{expand:%(cat %{SOURCE1})}
EOF

# copy the license file so %%files section sees it
cp %{SOURCE2} .

: prefix in %{_prefix}
: config in %{_sysconfdir}
: data in %{_localstatedir}


%build
# generate a helper script that will be used by help2man
cat >h2m_helper <<'EOF'
#!/bin/bash
[ "$1" == "--version" ] && echo "%{scl_name} Software Collection (PHP %{version})" || cat README
EOF
chmod a+x h2m_helper

# generate the man page
help2man -N --section 7 ./h2m_helper -o %{scl_name}.7


%install
install -D -m 644 enable %{buildroot}%{_scl_scripts}/enable
%if %{with_modules}
install -D -m 644 envmod %{buildroot}%{_scl_scripts}/%{scl_name}
%else
install -D -m 644 envmod %{buildroot}%{_root_datadir}/Modules/modulefiles/%{scl_name}
%endif
install -D -m 644 scldev %{buildroot}%{macrosdir}/macros.%{scl_name_base}-scldevel
install -D -m 644 %{scl_name}.7 %{buildroot}%{_root_mandir}/man7/%{scl_name}.7

install -d -m 755 %{buildroot}%{_datadir}/licenses
install -d -m 755 %{buildroot}%{_datadir}/doc/pecl
install -d -m 755 %{buildroot}%{_datadir}/tests/pecl
install -d -m 755 %{buildroot}%{_localstatedir}/lib/pear/pkgxml

%scl_install

# Add the scl_package_override macro
sed -e 's/@SCL@/%{scl}/g;s:@PREFIX@:/opt/%{scl_vendor}:;s/@VENDOR@/%{scl_vendor}/' %{SOURCE0} \
  | tee -a %{buildroot}%{_root_sysconfdir}/rpm/macros.%{scl}-config

# Move in correct location, if needed
if [ "%{_root_sysconfdir}/rpm" != "%{macrosdir}" ]; then
  mv  %{buildroot}%{_root_sysconfdir}/rpm/macros.%{scl}-config \
      %{buildroot}%{macrosdir}/macros.%{scl}-config
fi

%if 0%{?fedora} < 26 && 0%{?rhel} < 8
# Create symlinks
mkdir -p                %{buildroot}%{_root_sysconfdir}/opt/%{scl_vendor}
ln -s %{_sysconfdir}    %{buildroot}%{_root_sysconfdir}/opt/%{scl_vendor}/%{scl}
mkdir -p                %{buildroot}%{_root_localstatedir}/opt/%{scl_vendor}
ln -s %{_localstatedir} %{buildroot}%{_root_localstatedir}/opt/%{scl_vendor}/%{scl}
%endif

# syspaths
mkdir -p %{buildroot}%{_root_sysconfdir}
ln -s %{_sysconfdir}/php.ini %{buildroot}%{_root_sysconfdir}/php.ini
ln -s %{_sysconfdir}/php.d   %{buildroot}%{_root_sysconfdir}/php.d
mkdir -p %{buildroot}%{_root_bindir}
ln -s %{_bindir}/php     %{buildroot}%{_root_bindir}/php
ln -s %{_bindir}/phar    %{buildroot}%{_root_bindir}/phar
ln -s %{_bindir}/php-cgi %{buildroot}%{_root_bindir}/php-cgi
mkdir -p %{buildroot}%{_root_mandir}/man1
ln -s %{_mandir}/man1/php.1.gz     %{buildroot}%{_root_mandir}/man1/php.1.gz
ln -s %{_mandir}/man1/phar.1.gz    %{buildroot}%{_root_mandir}/man1/phar.1.gz
ln -s %{_mandir}/man1/php-cgi.1.gz %{buildroot}%{_root_mandir}/man1/php-cgi.1.gz


%post runtime
# Simple copy of context from system root to SCL root.
semanage fcontext -a -e /                      %{?_scl_root}     &>/dev/null || :
%if 0%{?fedora} >= 26 || 0%{?rhel} >= 8
semanage fcontext -a -e %{_root_sysconfdir}    %{_sysconfdir}    &>/dev/null || :
semanage fcontext -a -e %{_root_localstatedir} %{_localstatedir} &>/dev/null || :
%endif
selinuxenabled && load_policy || :
restorecon -R %{?_scl_root}     &>/dev/null || :
%if 0%{?fedora} >= 26 || 0%{?rhel} >= 8
restorecon -R %{_sysconfdir}    &>/dev/null || :
restorecon -R %{_localstatedir} &>/dev/null || :
%endif


%{!?_licensedir:%global license %%doc}

%files


%if 0%{?fedora} < 19 && 0%{?rhel} < 7
%files runtime
%else
%files runtime -f filesystem
%endif
%defattr(-,root,root)
%license LICENSE
%doc README
%scl_files
%{_root_mandir}/man7/%{scl_name}.*
%{?_licensedir:%{_datadir}/licenses}
%{_datadir}/tests
%if ! %{with_modules}
%{_root_datadir}/Modules/modulefiles/%{scl_name}
%endif
%if 0%{?fedora} < 26 && 0%{?rhel} < 8
%{_root_sysconfdir}/opt/%{scl_vendor}/%{scl}
%{_root_localstatedir}/opt/%{scl_vendor}/%{scl}
%endif


%files build
%defattr(-,root,root)
%{macrosdir}/macros.%{scl}-config


%files scldevel
%defattr(-,root,root)
%{macrosdir}/macros.%{scl_name_base}-scldevel


%changelog
%files syspaths
%{_root_sysconfdir}/php.ini
%{_root_sysconfdir}/php.d
%{_root_bindir}/php
%{_root_bindir}/phar
%{_root_bindir}/php-cgi
%{_root_mandir}/man1/php.1.gz
%{_root_mandir}/man1/phar.1.gz
%{_root_mandir}/man1/php-cgi.1.gz


%changelog
* Wed Jun 21 2023 Remi Collet <remi@remirepo.net> 5.6-1
- define %%scl_vendor and %%_scl_prefix in macros.php56-config
- redefine %%__phpize and %%__phpconfig
- move man page out of scl tree
- improve the man page

* Wed Feb 20 2019 Remi Collet <remi@remirepo.net> 3.0-1
- add syspaths sub package providing system-wide wrappers

* Mon Jan 21 2019 Remi Collet <remi@remirepo.net> 2.3-3
- cleanup for EL-8

* Fri Aug 24 2018 Remi Collet <remi@remirepo.net> 2.3-2
- scl-utils 2.0.2 drop modules support

* Mon Aug 28 2017 Remi Collet <remi@remirepo.net> - 2.3-1
- add symlinks for /etc/opt/remi/php56 and /var/opt/remi/php56

* Fri Mar 17 2017 Remi Collet <remi@remirepo.net> - 2.2-1
- use rh_layout on F26

* Thu Mar 10 2016 Remi Collet <remi@fedoraproject.org> 2.1-5
- add module file for EL

* Wed Mar  9 2016 Remi Collet <remi@fedoraproject.org> 2.1-4
- fix override for pecl_xmldir (F24)

* Tue Jan  5 2016 Remi Collet <remi@fedoraproject.org> 2.1-3
- add missing "sbin" in PATH (Fedora)

* Fri Nov 13 2015 Remi Collet <remi@fedoraproject.org> 2.1-2
- fix selinux context

* Wed Mar 25 2015 Remi Collet <remi@fedoraproject.org> 2.1-1
- fix licenses location
- own directories for pecl packages

* Mon Mar  2 2015 Remi Collet <remi@fedoraproject.org> 2.0-3
- add environement module file

* Wed Nov 26 2014 Remi Collet <remi@fedoraproject.org> 2.0-2
- add LD_LIBRARY_PATH in enable script for embedded

* Mon Sep  8 2014 Remi Collet <remi@fedoraproject.org> 2.0-1
- provides php56-runtime(remi)
- add _sclreq macro

* Sun Aug 24 2014 Remi Collet <rcollet@redhat.com> 1.0-1
- initial packaging from php55 from rhscl 1.1
- install macro in /usr/lib/rpm/macros.d
- each package requires runtime (for license)

* Mon Mar 31 2014 Honza Horak <hhorak@redhat.com> - 1.1-7
- Fix path typo in README
  Related: #1061455

* Mon Mar 24 2014 Remi Collet <rcollet@redhat.com> 1.1-6
- own locale and man directories, #1074337

* Wed Feb 12 2014 Remi Collet <rcollet@redhat.com> 1.1-5
- avoid empty debuginfo subpackage
- add LICENSE, README and php55.7 man page #1061455
- add scldevel subpackage #1063357

* Mon Jan 20 2014 Remi Collet <rcollet@redhat.com> 1.1-4
- rebuild with latest scl-utils #1054731

* Tue Nov 19 2013 Remi Collet <rcollet@redhat.com> 1.1-2
- fix scl_package_override

* Tue Nov 19 2013 Remi Collet <rcollet@redhat.com> 1.1-1
- build for RHSCL 1.1

* Tue Sep 17 2013 Remi Collet <rcollet@redhat.com> 1-1.5
- add macros.php55-build for scl_package_override

* Fri Aug  2 2013 Remi Collet <rcollet@redhat.com> 1-1
- initial packaging