]>
Commit | Line | Data |
---|---|---|
1e67d643 ER |
1 | # |
2 | # Conditional build: | |
3 | %bcond_without tests # build without tests | |
4 | ||
382d2064 | 5 | %define php_name php%{?php_suffix} |
fba179d7 | 6 | %define modname translit |
99d98d5e ER |
7 | Summary: %{modname} - transliterates non-latin character sets to latin |
8 | Summary(pl.UTF-8): %{modname} - translitacja alfabetów niełacińskich do łacińskiego | |
382d2064 | 9 | Name: %{php_name}-pecl-%{modname} |
981945b5 ER |
10 | Version: 0.6.3 |
11 | Release: 1 | |
0a20db7b | 12 | License: BSD |
0b399c4b | 13 | Group: Development/Languages/PHP |
981945b5 ER |
14 | Source0: https://pecl.php.net/get/%{modname}-%{version}.tgz |
15 | # Source0-md5: 4816be2da4bd063132f14cef9e1b51be | |
3a9bf2c3 | 16 | URL: https://github.com/derickr/pecl-translit |
1e67d643 | 17 | BuildRequires: %{php_name}-cli |
981945b5 | 18 | BuildRequires: %{php_name}-devel >= 3:5.1.0 |
1e67d643 | 19 | BuildRequires: %{php_name}-iconv |
7e6a512a ER |
20 | BuildRequires: libtool |
21 | BuildRequires: rpmbuild(macros) >= 1.666 | |
22 | %if %{with tests} | |
afbd2dee | 23 | BuildRequires: %{php_name}-pcre |
1e67d643 | 24 | %endif |
f03978c1 | 25 | %{?requires_php_extension} |
382d2064 | 26 | Requires: %{php_name}-iconv |
3831f6a4 | 27 | Provides: php(%{modname}) = %{version} |
6aaad9c6 | 28 | Obsoletes: php-pecl-translit < 0.6.1-8 |
0b399c4b AG |
29 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
30 | ||
0b399c4b AG |
31 | %description |
32 | This extension allows you to transliterate text in non-latin | |
33 | characters (such as Chinese, Cyrillic, Greek etc) to latin characters. | |
34 | Besides the transliteration the extension also contains filters to | |
35 | upper- and lowercase latin, cyrillic and greek, and perform special | |
36 | forms of transliteration such as converting ligatures such as the | |
76d977d1 JB |
37 | Norwegian "ae" ligature to separate "ae" characters and normalizing |
38 | punctuation and spacing. | |
0b399c4b | 39 | |
39336f6a JR |
40 | %description -l pl.UTF-8 |
41 | To rozszerzenie umożliwia transliterację tekstu ze znaków | |
42 | niełacińskich (takich jak chińskie, cyrilica, greckie) na znaki | |
43 | łacińskie. Oprócz transliteracji rozszerzenie zawiera także filtry na | |
44 | wielkie i małe litery łacińskie, cyrylicę i greckie oraz wykonuje | |
76d977d1 JB |
45 | specjalne formy transliteracji, takie jak konwersja ligatur takich jak |
46 | norweska ligatura "ae" na oddzielne znaki "ae" oraz normalizacja | |
39336f6a | 47 | znaków przestankowych i odstępów. |
76d977d1 | 48 | |
0b399c4b | 49 | %prep |
99d98d5e | 50 | %setup -qc |
981945b5 | 51 | mv %{modname}-%{version}/* . |
0b399c4b | 52 | |
7e6a512a ER |
53 | cat <<'EOF' > run-tests.sh |
54 | #!/bin/sh | |
55 | export NO_INTERACTION=1 REPORT_EXIT_STATUS=1 MALLOC_CHECK_=2 | |
56 | exec %{__make} test \ | |
57 | PHP_EXECUTABLE=%{__php} \ | |
58 | PHP_TEST_SHARED_SYSTEM_EXTENSIONS="iconv" \ | |
59 | RUN_TESTS_SETTINGS="-q $*" | |
60 | EOF | |
61 | chmod +x run-tests.sh | |
62 | ||
0b399c4b | 63 | %build |
0b399c4b AG |
64 | phpize |
65 | %configure | |
66 | %{__make} | |
67 | ||
1e67d643 ER |
68 | # simple module load test |
69 | %{__php} -n -q \ | |
70 | -d extension_dir=modules \ | |
71 | -d extension=%{php_extensiondir}/iconv.so \ | |
72 | -d extension=%{modname}.so \ | |
73 | -m > modules.log | |
74 | grep %{modname} modules.log | |
75 | ||
7e6a512a ER |
76 | %if %{with tests} |
77 | ./run-tests.sh --show-diff | |
1e67d643 ER |
78 | %endif |
79 | ||
0b399c4b AG |
80 | %install |
81 | rm -rf $RPM_BUILD_ROOT | |
2623f792 | 82 | install -d $RPM_BUILD_ROOT{%{php_sysconfdir}/conf.d,%{php_extensiondir}} |
0b399c4b | 83 | |
99d98d5e | 84 | install -p modules/%{modname}.so $RPM_BUILD_ROOT%{php_extensiondir} |
794992b0 ER |
85 | %if "%php_major_version.%php_minor_version" >= "7.4" |
86 | # order after ext-iconv | |
87 | cat <<'EOF' > $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d/01_%{modname}.ini | |
88 | %else | |
99d98d5e | 89 | cat <<'EOF' > $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d/%{modname}.ini |
794992b0 | 90 | %endif |
99d98d5e ER |
91 | ; Enable %{modname} extension module |
92 | extension=%{modname}.so | |
f03978c1 | 93 | EOF |
0b399c4b AG |
94 | |
95 | %clean | |
96 | rm -rf $RPM_BUILD_ROOT | |
97 | ||
98 | %post | |
2623f792 | 99 | %php_webserver_restart |
0b399c4b | 100 | |
f03978c1 ER |
101 | %postun |
102 | if [ "$1" = 0 ]; then | |
2623f792 | 103 | %php_webserver_restart |
0b399c4b AG |
104 | fi |
105 | ||
106 | %files | |
107 | %defattr(644,root,root,755) | |
794992b0 | 108 | %config(noreplace) %verify(not md5 mtime size) %{php_sysconfdir}/conf.d/*%{modname}.ini |
99d98d5e | 109 | %attr(755,root,root) %{php_extensiondir}/%{modname}.so |