summaryrefslogtreecommitdiffstats
path: root/zephir.spec
blob: e08119f7d668b0aa8dd5f1eec16e98445ea34375 (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
# remirepo/fedora spec file for zephir
#
# Copyright (c) 2016-2018 Remi Collet
# License: CC-BY-SA
# http://creativecommons.org/licenses/by-sa/4.0/
#
# Please, preserve the changelog entries
#

%if 0%{?scl:1}
%global with_tests   0
%scl_package zephyr-parser
%else
%if 0%{?fedora} >= 21 || 0%{?rhel} >= 8
%global with_tests   0%{!?_without_tests:1}
%else
# Disable in EL as 5.4 and 5.5 can't use phpunit
%global with_tests   0%{?_with_tests:1}
%endif
%endif

# Get commit from PHP_PHALCON_ZEPVERSION in 
# https://github.com/phalcon/cphalcon/blob/master/ext/php_phalcon.h
%global gh_commit    19e935bdbeeef42043810c4066d374902101e5df
%global gh_short     %(c=%{gh_commit}; echo ${c:0:7})
#global gh_date      20161126
%global gh_owner     phalcon
%global gh_project   zephir
%global ext_name     zephir_parser
%global parser_ver   1.1.1

Name:           %{?scl_prefix}%{gh_project}
Version:        0.10.9
Release:        1%{?gh_date:.%{gh_date}.%{gh_short}}%{?dist}
Summary:        Zephir language for creation of extensions for PHP.

Group:          Development/Languages
License:        MIT
URL:            https://getcomposer.org/
Source0:        https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}-%{gh_short}.tar.gz

# Adapt path used in RPM
Patch0:         %{gh_project}-rpm.patch

BuildArch:      noarch
BuildRequires:  %{?scl_prefix}php-devel > 5.5
BuildRequires:  %{?scl_prefix}php-zephir-parser >= %{parser_ver}
%if %{with_tests}
BuildRequires:  %{?scl_prefix}php-json
BuildRequires:  %{?scl_prefix}php-hash
BuildRequires:  %{?scl_prefix}php-ctype
# From composer.json, "require-dev"
#        "ext-gmp": "*",
#        "ext-pdo": "*",
#        "ext-pdo_sqlite": "*",
#        "squizlabs/php_codesniffer": "^3.2",
#        "phpunit/phpunit": "^4.8"
BuildRequires:  %{?scl_prefix}php-gmp
BuildRequires:  %{?scl_prefix}php-pdo
BuildRequires:  %{?scl_prefix}php-pdo_sqlite
BuildRequires:  %{?scl_prefix}php-composer(phpunit/phpunit) >= 4.8
%endif

Requires:       %{?scl_prefix}php-cli
Requires:       %{?scl_prefix}php-zephir-parser >= %{parser_ver}
# From composer.json, "require"
#        "php": ">=5.5",
#        "ext-json": "*",
#        "ext-hash": "*",
#        "ext-ctype": "*",
#        "ext-xml": "*"
Requires:       %{?scl_prefix}php(language) >= 5.5
Requires:       %{?scl_prefix}php-json
Requires:       %{?scl_prefix}php-hash
Requires:       %{?scl_prefix}php-ctype
Requires:       %{?scl_prefix}php-xml
# From phpcompatinfo
Requires:       %{?scl_prefix}php-reflection
Requires:       %{?scl_prefix}php-date
Requires:       %{?scl_prefix}php-gmp
Requires:       %{?scl_prefix}php-pcre
Requires:       %{?scl_prefix}php-pdo
Requires:       %{?scl_prefix}php-spl

Provides:       %{?scl_prefix}php-composer(%{gh_owner}/%{gh_project}) = %{version}

%description
Zephir - Ze(nd Engine) Ph(p) I(nt)r(mediate) - is a high level language
that eases the creation and maintainability of extensions for PHP.
Zephir extensions are exported to C code that can be compiled and
optimized by major C compilers such as gcc/clang/vc++. Functionality
is exposed to the PHP language.

Main features:
* Both dynamic/static typing
* Reduced execution overhead compared with full interpretation
* Restricted procedural programming, promoting OOP
* Memory safety
* Ahead-of-time (AOT) compiler to provide predictable performance

Compiler design goals:
* Multi-pass compilation
* Type speculation/inference
* Allow runtime profile-guided optimizations, pseudo-constant propagation
  and indirect/virtual function inlining


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

%patch0 -p0 -b .rpm
sed -e 's:@DATADIR@:%{_datadir}:;s:@BINDIR@:%{_bindir}:' \
    -i bin/%{gh_project}

find . -name \*.php -exec chmod -x {} \;


%build
# nothing


%install
: Library and resources
mkdir -p     %{buildroot}%{_datadir}/%{gh_project}
for i in *php Library kernels prototypes templates
do
   cp -pr $i %{buildroot}%{_datadir}/%{gh_project}/$i
done

: Command
install -Dpm 755 bin/%{gh_project} %{buildroot}%{_bindir}/%{gh_project}



%check
sed -e 's:%ZEPHIRDIR%:%{buildroot}%{_datadir}/%{gh_project}:g' \
    -e 's: php:%{_bindir}/php:' \
     bin/%{gh_project}.rpm > bin/%{gh_project}.test
sh ./bin/%{gh_project}.test version
sh ./bin/%{gh_project}.test version | grep %{version}

%if %{with_tests}
: Run test suite
%{_bindir}/phpunit \
    --bootstrap %{buildroot}%{_datadir}/%{gh_project}/bootstrap.php \
    --verbose unit-tests/Zephir
%else
: Test suite disabled
%endif


%files
%{!?_licensedir:%global license %%doc}
%license LICENSE
%doc *.md
%doc composer.json
%{_bindir}/%{gh_project}
%{_datadir}/%{gh_project}


%changelog
* Wed May  2 2018 Remi Collet <remi@remirepo.net> - 0.10.9-1
- update to 0.10.9

* Tue Apr 17 2018 Remi Collet <remi@remirepo.net> - 0.10.8-1
- update to 0.10.8

* Fri Dec 29 2017 Remi Collet <remi@remirepo.net> - 0.10.7-1
- Update to 0.10.7

* Sun Nov 12 2017 Remi Collet <remi@remirepo.net> - 0.10.6-1
- Update to 0.10.6

* Fri Nov 10 2017 Remi Collet <remi@remirepo.net> - 0.10.5-1
- Update to 0.10.5
- raise dependency on php-zephir-parser 1.1.1

* Mon Oct 23 2017 Remi Collet <remi@remirepo.net> - 0.10.4-1
- version 0.10.4

* Fri Oct 13 2017 Remi Collet <remi@remirepo.net> - 0.10.3-2
- disable timecop which breaks zephir
  see https://github.com/phalcon/zephir/pull/1588

* Fri Oct 13 2017 Remi Collet <remi@remirepo.net> - 0.10.3-1
- version 0.10.3
- raise dependency on php-zephir-parser 1.1.0

* Wed Oct 11 2017 Remi Collet <remi@remirepo.net> - 0.10.2-1
- version 0.10.2
- drop zephir-parser sub-package
- add dependency on php-zephir-parser

* Fri Aug  4 2017 Remi Collet <remi@remirepo.net> - 0.9.11-1
- version 0.9.11

* Tue Aug  1 2017 Remi Collet <remi@remirepo.net> - 0.9.10-1
- version 0.9.10

* Tue Jul 18 2017 Remi Collet <remi@remirepo.net> - 0.9.9-2
- rebuild for PHP 7.2.0beta1 new API

* Wed Jun 21 2017 Remi Collet <remi@remirepo.net> - 0.9.9-1
- version 0.9.9

* Mon May 22 2017 Remi Collet <remi@remirepo.net> - 0.9.8-1
- version 0.9.8

* Wed Apr  5 2017 Remi Collet <remi@fedoraproject.org> - 0.9.7-1
- version 0.9.7

* Tue Feb 21 2017 Remi Collet <remi@fedoraproject.org> - 0.9.6-1
- version 0.9.6

* Sun Nov 27 2016 Remi Collet <remi@fedoraproject.org> - 0.9.5-1
- version 0.9.5

* Fri Oct 14 2016 Remi Collet <remi@fedoraproject.org> - 0.9.4-2.20161014git23856e1
- new snapshot to fix PHP 7.1 compatibility of generated code

* Mon Oct 10 2016 Remi Collet <remi@fedoraproject.org> - 0.9.4-1.20160929git22f6632
- new snapshot to fix PHP 7.1 compatibility of generated code

* Wed Sep 14 2016 Remi Collet <remi@fedoraproject.org> - 0.9.3-2.20160728gite716dbe
- rebuild for PHP 7.1 new API version

* Sat Jul 30 2016 Remi Collet <remi@fedoraproject.org> - 0.9.0-1.20160728gite716dbe
- Initial package