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

%global gh_commit    b6ae5f6177f6e51c5fc3514800e1c3fb076ec4be
%global gh_short     %(c=%{gh_commit}; echo ${c:0:7})
%global gh_owner     zetacomponents
%global gh_project   Base
%global cname        base
%global ezcdir       %{_datadir}/php/ezc

%if 0%{?fedora}
%bcond_without  tests
%bcond_without  phpab
%else
%bcond_with     tests
%bcond_with     phpab
%endif

Name:           php-%{gh_owner}-%{cname}
Version:        1.9.4
Release:        1%{?dist}
Summary:        Zeta Base Component

Group:          Development/Libraries
License:        ASL 2.0
URL:            http://zetacomponents.org/
Source0:        https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{name}-%{version}-%{gh_short}.tar.gz
Source1:        autoloader.php

# Use old PEAR layout
Patch0:         %{name}-layout.patch

BuildArch:      noarch
%if %{with phpab}
BuildRequires:  %{_bindir}/phpab
%endif
%if %{with tests}
BuildRequires:  phpunit9
BuildRequires:  %{_bindir}/convert
BuildRequires:  php-composer(%{gh_owner}/unit-test) >= 1.2.3
BuildRequires:  php-posix
%endif

# From phpcompatinfo report for 1.9
Requires:       php(language) > 5.3
Requires:       php-pcre
Requires:       php-posix
Requires:       php-simplexml
Requires:       php-spl

Provides:       php-composer(%{gh_owner}/%{cname}) = %{version}


%description
This is the base package of the Zeta components, offering the basic
support that all Components need. In the first version this will be the
autoload support.


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

%patch0 -p0


%build
%if %{with phpab}
: Generate a simple autoloader
%{_bindir}/phpab \
   --output src/autoloader.php \
   src
%else
cp %{SOURCE1} src/autoloader.php
%endif


%install
mkdir -p %{buildroot}%{ezcdir}/autoload

: The library
cp -pr src \
       %{buildroot}%{ezcdir}/%{gh_project}
: For ezcBase autoloader
cp -pr src/*_autoload.php \
       %{buildroot}%{ezcdir}/autoload


%check
%if %{with tests}
: Ignore test relying on composer layout
rm tests/file_find_recursive_test.php

: Create test autoloader
mkdir vendor
cat <<EOF | tee vendor/autoload.php
<?php
require '%{ezcdir}/UnitTest/autoloader.php';
require '$PWD/src/autoloader.php';
EOF

: Run test test suite
ret=0
for cmd in php php80 php81 php82; do
  if which $cmd; then
    $cmd %{_bindir}/phpunit9 || ret=1
  fi
done
exit $ret
%else
: Test suite disabled
%endif


%files
%{!?_licensedir:%global license %%doc}
%license LICENSE* CREDITS
%doc ChangeLog
%doc composer.json
%doc docs design
%dir %{ezcdir}
%dir %{ezcdir}/autoload
     %{ezcdir}/autoload/*_autoload.php
     %{ezcdir}/%{gh_project}


%changelog
* Thu Dec  1 2022 Remi Collet <remi@remirepo.net> - 1.9.4-1
- update to 1.9.4

* Tue Jul 19 2022 Remi Collet <remi@remirepo.net> - 1.9.3-4
- switch to phpunit9

* Mon Dec  6 2021 Remi Collet <remi@remirepo.net> - 1.9.3-2
- disable test suite on EL
- add autoloader from sources on EL

* Mon Jul 26 2021 Remi Collet <remi@remirepo.net> - 1.9.3-1
- update to 1.9.3

* Wed Nov 29 2017 Remi Collet <remi@remirepo.net> - 1.9.1-1
- Update to 1.9.1

* Mon Oct 30 2017 Remi Collet <remi@fedoraproject.org> - 1.9-6
- fix FTBFS from Koschei, add patch for tests from
  https://github.com/zetacomponents/Base/pull/8

* Thu Jun  4 2015 Remi Collet <remi@fedoraproject.org> - 1.9-2
- add upstream patch for LICENSE file

* Wed Jun  3 2015 Remi Collet <remi@fedoraproject.org> - 1.9-1
- initial package
- open https://github.com/zetacomponents/UnitTest/issues/4 License