summaryrefslogtreecommitdiff
path: root/php-ioncube-loader.spec
blob: 56a3ab7dfaef0ea8c288ed017ddda0e158124611 (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
# remirepo spec file for php-ioncube-loader
#
# Copyright (c) 2012-2022 Remi Collet
# License: CC-BY-SA
# http://creativecommons.org/licenses/by-sa/4.0/
#
# Please, preserve the changelog entries
#
%{?scl:          %scl_package             php-ioncube-loader}
%global extname       ioncube_loader
%global debug_package %{nil}
%global __debug_install_post /bin/true
%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8
%global _build_id_links none
%endif
%ifarch armv7hl aarch64 armv7hl
%global with_zts      0
%else
%global with_zts      0%{!?_without_zts:%{?__ztsphp:1}}
%endif
%if "%{php_version}" < "5.6"
%global ininame       %{extname}.ini
%else
# [ionCube Loader] The Loader must appear as the first entry in the php.ini
%global ininame       01-%{extname}.ini
%endif

# Open issues
# http://forum.ioncube.com/viewtopic.php?t=4244 - No version in Reflection

Name:          %{?scl_prefix}php-ioncube-loader
Summary:       Loader for ionCube Encoded Files with ionCube 24 support
%global upstream_version  13.0.0
#global upstream_prever   beta2
Version:       %{upstream_version}%{?upstream_prever:~%{upstream_prever}}
Release:       1
License:       Distribuable

URL:           http://www.ioncube.com
%if 0%{?upstream_prever:1}
Source1:       https://www.ioncube.com/php-7.4.0-beta-loaders/ioncube_loaders_lin_x86-64_7.4_BETA2.tar.gz
%else
Source1:       https://downloads.ioncube.com/loader_downloads/%{extname}s_lin_x86-64_%{upstream_version}.tar.gz
Source2:       https://downloads.ioncube.com/loader_downloads/%{extname}s_lin_aarch64_%{upstream_version}.tar.gz
%endif
Source90:      LICENSE.txt
Source91:      USER-GUIDE.txt

ExclusiveArch: x86_64 aarch64
BuildRequires: %{?scl_prefix}php-devel < 8.0

# ABI check
Requires:      %{?scl_prefix}php(zend-abi) = %{php_zend_api}
Requires:      %{?scl_prefix}php(api) = %{php_core_api}
%{?_sclreq:Requires: %{?scl_prefix}runtime%{?_sclreq}%{?_isa}}

%if "%{?packager}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel}
# Other third party repo stuff
Obsoletes:      php53-ioncube-loader <= %{version}
Obsoletes:     php53u-ioncube-loader <= %{version}
Obsoletes:      php54-ioncube-loader <= %{version}
%if "%{php_version}" > "5.5"
Obsoletes:     php55u-ioncube-loader <= %{version}
%endif
%if "%{php_version}" > "5.6"
Obsoletes:     php56u-ioncube-loader <= %{version}
%endif
%if "%{php_version}" > "7.0"
Obsoletes:     php70u-ioncube-loader <= %{version}
%endif
%if "%{php_version}" > "7.1"
Obsoletes:     php71u-ioncube-loader <= %{version}
%endif
%if "%{php_version}" > "7.2"
Obsoletes:     php72u-ioncube-loader <= %{version}
%endif
%if "%{php_version}" > "7.3"
Obsoletes:      php73-ioncube-loader <= %{version}
%endif
%if "%{php_version}" > "7.4"
Obsoletes:      php74-ioncube-loader <= %{version}
%endif
%endif


%description
Loader for ionCube Encoded Files with ionCube 24 support.

Package built for PHP %(%{__php} -n -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')%{?scl: as Software Collection (%{scl} by %{?scl_vendor}%{!?scl_vendor:rh})}.


%prep
%setup -q -T -c

%ifarch aarch64
tar xvf %{SOURCE2}
%else
tar xvf %{SOURCE1}
%endif

%if 0%{?upstream_prever:1}
mkdir ioncube
mv ioncube_loader_lin_7.4_%{upstream_version}_%{upstream_prever}.so    ioncube/ioncube_loader_lin_7.4.so
mv ioncube_loader_lin_7.4_%{upstream_version}_%{upstream_prever}_ts.so ioncube/ioncube_loader_lin_7.4_ts.so
%endif

[ -d linux_x86_64 ] && ln -s linux_x86_64 ioncube

# Drop in the bit of configuration
# Sometime file is missing
# http://forum.ioncube.com/viewtopic.php?t=4245
[ -f ioncube/LICENSE.txt ]    || cp %{SOURCE90} ioncube/
[ -f ioncube/USER-GUIDE.txt ] || cp %{SOURCE91} ioncube/
sed -e 's/\r//' -i ioncube/*.txt

cat << 'EOF' | tee %{extname}.nts
; Enable %{extname} extension module
zend_extension = %{extname}.so

; ionCube PHP Loader + Intrusion Protection from ioncube24.com configuration
;ic24.enable = 0
;ic24.sec.stop_on_error = 1
;ic24.sec.trusted_include_paths = ''
;ic24.sec.block_uploaded_files = 1
;ic24.api_access_key = ''
;ic24.api_check_ip = 1
;ic24.slt = '7'
;ic24.sec.enable = 'auto'
;ic24.sec.initial_state = 1
;ic24.sec.initial_action = 'block'
;ic24.sec.initial_notify = 'always'
;ic24.sec.initial_cache_all = 1
;ic24.sec.exclusion_key = ''
;ic24.home_dir = ''
;ic24.sec.block_stdin = '1'
;ic24.update_domains_retry_interval = '30'
;ic24.phperr.enable = 'auto'
;ic24.phperr.ignore = 0
;ic24.api.log_msg_errors = 0
;ic24.api.max_timeout = 7
;ioncube.loader.encoded_paths = ''
EOF

cp %{extname}.nts %{extname}.zts

%if "%{php_version}" < "5.5"
sed -e 's:%{extname}.so:%{php_ztsextdir}/%{extname}.so:' \
    -i %{extname}.zts
sed -e 's:%{extname}.so:%{php_extdir}/%{extname}.so:' \
    -i %{extname}.nts
diff %{extname}.nts %{extname}.zts || : ok
%endif


%build
# tarball provides binaries


%install
ver=$(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')

if [ -f ioncube/%{extname}_lin_${ver}.so ]; then

  install -D -pm 755 ioncube/%{extname}_lin_${ver}.so    %{buildroot}%{php_extdir}/%{extname}.so
  %if %{with_zts}
  install -D -pm 755 ioncube/%{extname}_lin_${ver}_ts.so %{buildroot}%{php_ztsextdir}/%{extname}.so
  %endif

elif [ -f linux_x86_64/${ver}.0/ioncube_loader_%{version}.so ]; then

  install -D -pm 755 linux_x86_64/${ver}.0/ioncube_loader_%{version}.so       %{buildroot}%{php_extdir}/%{extname}.so
  %if %{with_zts}
  install -D -pm 755 linux_x86_64/${ver}.0-ts/ioncube_loader_%{version}_ts.so %{buildroot}%{php_ztsextdir}/%{extname}.so
  %endif

else
  : Module for PHP $ver not provided
  exit 1
fi

install -D -m 644  %{extname}.nts %{buildroot}%{php_inidir}/%{ininame}
%if %{with_zts}
install -D -m 644  %{extname}.zts %{buildroot}%{php_ztsinidir}/%{ininame}
%endif


%check
# simple module load test
%{__php} --no-php-ini \
    --define zend_extension=%{buildroot}%{php_extdir}/%{extname}.so \
    --version | grep 'ionCube.*%{upstream_version}'

%if %{with_zts}
%{__ztsphp} --no-php-ini \
    --define zend_extension=%{buildroot}%{php_ztsextdir}/%{extname}.so \
    --version | grep 'ionCube.*%{upstream_version}'
%endif


%files
%{!?_licensedir:%global license %%doc}
%license ioncube/LICENSE.txt
%doc ioncube/USER-GUIDE.txt

%config(noreplace) %{php_inidir}/%{ininame}
%{php_extdir}/%{extname}.so

%if %{with_zts}
%config(noreplace) %{php_ztsinidir}/%{ininame}
%{php_ztsextdir}/%{extname}.so
%endif