summaryrefslogtreecommitdiffstats
path: root/php-gettext-gettext.spec
blob: db7deb8942f4564550fa909af4ff8c713119e981 (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
# remirepo spec file for php-gettext-gettext, from
#
# Fedora spec file for php-gettext-gettext
#
# License: MIT
# http://opensource.org/licenses/MIT
#
# Please preserve changelog entries
#

%global gh_owner     oscarotero
%global gh_project   Gettext


Name:       php-gettext-gettext
Version:    5.5.2
Release:    1%{?dist}
BuildArch:  noarch

License:    MIT
Summary:    PHP gettext manager
URL:        https://github.com/%{gh_owner}/%{gh_project}
Source0:    %{url}/archive/v%{version}.tar.gz
# Upstream strips the tests from the tarball, so we have to generate it manually.
# dltests.sh is used to do this, and is included in this repository.
Source1:    tests-v%{version}.tar.bz2

BuildRequires: dos2unix
%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8
BuildRequires: (php-composer(gettext/languages) >= 2.3.0 with php-composer(gettext/languages) < 3)
%else
BuildRequires: php-gettext-languages >= 2.3.0
%endif
BuildRequires: phpunit

Requires:   php(language) >= 5.4.0
Requires:   php-date
Requires:   php-dom
Requires:   php-gettext
Requires:   php-json
Requires:   php-pcre
Requires:   php-simplexml
Requires:   php-spl
Requires:   php-tokenizer

%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8
Requires:  (php-composer(gettext/languages) >= 2.3.0 with php-composer(gettext/languages) < 3)
%else
Requires:   php-gettext-languages >= 2.3.0
%endif

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


%description
Gettext is a PHP (5.3) library to import/export/edit gettext from PO,
MO, PHP, JS files, etc.

Autoloader: %{_datadir}/php/Gettext/autoload.php


%prep
%setup -a1 -n Gettext-%{version}

# The documentation has the wrong newline codes
dos2unix *.md


%build
: Create autoloader
cat <<'AUTOLOAD' | tee src/autoload.php
<?php
/**
 * Autoloader for %{name} and its' dependencies
 * (created by %{name}-%{version}-%{release}).
 */
require_once '%{_datadir}/php/Fedora/Autoloader/autoload.php';

\Fedora\Autoloader\Autoload::addPsr4('Gettext\\', __DIR__);

\Fedora\Autoloader\Dependencies::required(array(
    '%{_datadir}/php/Gettext/Languages/autoloader.php'
));

AUTOLOAD


%install
install -d -p -m 0755 %{buildroot}/%{_datadir}/php
install -d -p -m 0755 %{buildroot}/%{_datadir}/php/Gettext

cp -ar src/* %{buildroot}/%{_datadir}/php/Gettext/


%check
# Upstream no longer contains tests/bootstrap.php file
#sed -i "s:include_once.*:\ninclude_once '%{buildroot}/%{_datadir}/php/Gettext/autoload.php';:" tests/bootstrap.php

# gettext has some optional dependencies that we are not integrating with at this time (we can later
# if desired). Thus, we need to skip the tests on these integration points since they will fail
# without the dependencies. There is an upstream issue about compatibility issues with Twig:
# https://github.com/oscarotero/Gettext/issues/137

: run upstream test suite with all installed PHP versions
ret=0
for cmd in php php71 php72 php73 php74 php80; do
  if which $cmd; then
    $cmd %{_bindir}/phpunit --bootstrap %{buildroot}/%{_datadir}/php/Gettext/autoload.php tests
  fi
done
exit $ret


%files
%{!?_licensedir:%global license %%doc}
%license LICENSE
%doc CHANGELOG.md
%doc composer.json
%doc CONTRIBUTING.md
%doc README.md
%{_datadir}/php/Gettext/*


%changelog
* Wed Nov 18 2020 Sundeep Anand <suanand@fedoraproject.org> - 5.5.2-1
- update to 5.5.2 (#1898773)

* Fri Jul 24 2020 Sundeep Anand <suanand@fedoraproject.org> - 5.5.1-1
- update to 5.5.1 (#1768669)

* Thu Oct 10 2019 Remi Collet <remi@remirepo.net> - 4.7.0-2
- update to 4.7.0
- use range dependencies
- add patch for PHP 7.4 from
  https://github.com/oscarotero/Gettext/pull/230

* Thu Oct 10 2019 Sundeep Anand <suanand@fedoraproject.org> - 4.7.0-1
- Update to 4.7.0 (#1759099).
- https://github.com/oscarotero/Gettext/blob/v4.7.0/CHANGELOG.md

* Wed Sep 11 2019 Sundeep Anand <suanand@fedoraproject.org> - 4.6.3-2
- Fix dependencies.

* Tue Sep 10 2019 Sundeep Anand <suanand@fedoraproject.org> - 4.6.3-1
- Update to 4.6.3 (#1742047).
- https://github.com/oscarotero/Gettext/blob/v4.6.3/CHANGELOG.md

* Sun Jul 29 2018 Randy Barlow <bowlofeggs@fedoraproject.org> - 4.6.0-1
- Update to 4.6.0 (#1595474).
- https://github.com/oscarotero/Gettext/blob/v4.6.0/CHANGELOG.md

* Sun May 20 2018 Randy Barlow <bowlofeggs@fedoraproject.org> - 4.5.0-1
- Update to 4.5.0 (#1571010).
- https://github.com/oscarotero/Gettext/blob/v4.5.0/CHANGELOG.md

* Sun Feb 25 2018 Randy Barlow <bowlofeggs@fedoraproject.org> - 4.4.4-1
- Update to 4.4.4 (#1548216).
- https://github.com/oscarotero/Gettext/blob/v4.4.4/CHANGELOG.md

* Sun Dec 17 2017 Randy Barlow <bowlofeggs@fedoraproject.org> - 4.4.3-1
- Update to 4.4.3 (#1450031).
- https://github.com/oscarotero/Gettext/blob/v4.4.3/CHANGELOG.md

* Tue Oct 31 2017 Remi Collet <remi@remirepo.net> - 3.5.9-7
- fix FTBFS from Koschei
- add upstream patch for PHP 7.2
- add patch for bigendian from https://github.com/oscarotero/Gettext/pull/159

* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.5.9-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Sun Apr 02 2017 Randy Barlow <bowlofeggs@fedoraproject.org> - 3.5.9-5
- Depend on php-dom and php-simplexml.
- Don't provide /usr/share/php/Gettext.

* Wed Feb 01 2017 Randy Barlow <bowlofeggs@fedoraproject.org> - 3.5.9-4
- Remove dependency on twig/twig.

* Wed Feb 01 2017 Randy Barlow <bowlofeggs@fedoraproject.org> - 3.5.9-3
- Create a Fedora autoloader.
- Depend on twig/twig.
- Install to /usr/share/php/Gettext instead of the Gettext subdir of that path.

* Sun Jan 22 2017 Randy Barlow <bowlofeggs@fedoraproject.org> - 3.5.9-2
- Use a git snapshot instead of a GitHub URL so that we can run the
  tests (except for two that need optional dependencies).
- require_once Gettext/Languages inside the autoloader.

* Tue Jan 17 2017 Randy Barlow <bowlofeggs@fedoraproject.org> - 3.5.9-1
- Initial release.