]> TLD Linux GIT Repositories - packages/php-pear-PEAR.git/blob - php-pear-PEAR.spec
- from PLD
[packages/php-pear-PEAR.git] / php-pear-PEAR.spec
1 # TODO
2 # - bootstrap fails if /usr/share/pear/.lock doesn't exist (just create it as 644)
3 # - should understand as php extension (php-pear-Auth):
4 #   pear/Auth can optionally use package "pecl/vpopmail" (version >= 0.2)
5 #   pear/Auth can optionally use package "pecl/kadm5" (version >= 0.2.3)
6 #
7 %define         _pearname       PEAR
8 %define         _status         stable
9 %define         php_name        php%{?php_suffix}
10 %define         php_min_version 5.4.0
11 %include        /usr/lib/rpm/macros.php
12 Summary:        PEAR Base System
13 Summary(pl.UTF-8):      Podstawowy system PEAR
14 Name:           php-pear-%{_pearname}
15 Version:        1.10.1
16 Release:        2
17 Epoch:          1
18 License:        New BSD License
19 Group:          Development/Languages/PHP
20 Source0:        http://pear.php.net/get/%{_pearname}-%{version}.tgz
21 # Source0-md5:  da3f4d00c7415d39cb57848742e09894
22 Source1:        http://pear.php.net/get/Console_Getopt-1.4.1.tgz
23 # Source1-md5:  a95c86528f910562772274eefb90ca2c
24 Source2:        http://pear.php.net/get/Structures_Graph-1.1.1.tgz
25 # Source2-md5:  f1be7827074c4f51eb1af245f0f7c5c4
26 Patch0:         %{name}-sysconfdir.patch
27 Patch1:         ext-check.patch
28 Patch2:         %{name}-FHS.patch
29 URL:            http://pear.php.net/package/PEAR
30 BuildRequires:  %{php_name}-pcre
31 BuildRequires:  %{php_name}-xml
32 BuildRequires:  /usr/bin/php
33 BuildRequires:  rpm-php-pearprov >= 4.4.2-30.1
34 BuildRequires:  rpmbuild(macros) >= 1.654
35 Requires:       %{name}-core = %{epoch}:%{version}-%{release}
36 Requires:       /usr/bin/php
37 Requires:       php(core) >= %{php_min_version}
38 Requires:       php(pcre)
39 Requires:       php(xml)
40 Requires:       php(zlib)
41 Requires:       php-pear >= 4:1.2-1
42 Requires:       php-pear-Archive_Tar >= 1.3.11
43 Requires:       php-pear-Console_Getopt >= 1.2.3
44 Requires:       php-pear-Structures_Graph >= 1.0.4
45 Requires:       php-pear-XML_Util >= 1.2.3
46 Requires:       rpm-whiteout
47 Suggests:       php-pear-Net_FTP
48 Obsoletes:      php-pear-PEAR-Command
49 Obsoletes:      php-pear-PEAR-Frontend_CLI
50 Obsoletes:      php-pear-PEAR-OS
51 Conflicts:      php-pear-PEAR_Frontend_Gtk < 0.4.0
52 Conflicts:      php-pear-PEAR_Frontend_Web < 0.5.0
53 Conflicts:      rpm-whiteout < 1.1
54 Conflicts:      rpmbuild(macros) < 1.563
55 BuildArch:      noarch
56 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
57
58 # PEAR_Command_Packaging is separate package
59 # PEAR_FTP is optional
60 %define         _noautoreq_pear PEAR/FTP.php Net/FTP.php XML/RPC.* PEAR/Command/Packaging.php
61
62 %description
63 The PEAR package contains:
64 - the PEAR installer, for creating, distributing and installing
65   packages
66 - the alpha-quality PEAR_Exception PHP5 error handling mechanism
67 - the beta-quality PEAR_ErrorStack advanced error handling mechanism
68 - the PEAR_Error error handling mechanism
69 - the OS_Guess class for retrieving info about the OS where PHP is
70   running on
71 - the System class for quick handling of common operations with files
72   and directories
73 - the PEAR base class packages
74
75 In PEAR status of this package is: %{_status}.
76
77 %description -l pl.UTF-8
78 Pakiet PEAR zawiara:
79 - PEAR installer do tworzenia, dystrybucji i instalowania pakietów,
80 - mechanizm PEAR_Exception (w fazie alpha) do obsługi błędów PHP5,
81 - zaawansowany mechanizm PEAR_ErrorStack (w fazie beta) do obsługi
82   błędów,
83 - mechanizm obsługi błędów PEAR_Error,
84 - klasę OS_Guess do pozyskiwania informacji na temat systemu
85   operacyjnego,
86 - klasę System do szybkiej obsługi typowych operacji na plikach i
87   katalogach,
88 - podstawową klasy PEAR.
89
90 Ta klasa ma w PEAR status: %{_status}.
91
92 %package core
93 Summary:        PEAR core classes
94 Summary(pl.UTF-8):      Główne klasy PEAR-a
95 Group:          Development/Languages/PHP
96 Requires:       php(core) >= %{php_min_version}
97
98 %description core
99 This package includes PEAR core classes:
100 - PEAR class and PEAR_Error
101 - System
102 - OS_Guess
103 and classes for PHP 5:
104 - PEAR_ErrorStack and PEAR_Exception
105
106 %description core -l pl.UTF-8
107 Ten pakiet zawiera główne klasy PEAR-a:
108 - klasę PEAR i PEAR_Error
109 - System
110 - OS_Gueass
111 oraz klasy dla PHP 5:
112 - PEAR_ErrorStack i PEAR_Exception
113
114 %prep
115 %define __build_dir %{_builddir}/%{_pearname}-%{version}%{?_rc}
116 %define __php_include_path %{__build_dir}/%{_pearname}-%{version}%{?_rc}:%{__build_dir}/%(basename %{SOURCE1} .tgz):%{__build_dir}/%(basename %{SOURCE2} .tgz)
117 %define __pear php -dmemory_limit=-1 -doutput_buffering=1 -dinclude_path="%__php_include_path" %{__build_dir}/%{_pearname}-%{version}%{?_rc}/scripts/pearcmd.php
118
119 %setup -q -c -n %{_pearname}-%{version} -a1 -a2
120 %pear_package_setup -z -D -n %{_pearname}-%{version}%{?_rc}
121
122 %patch0 -p1
123 %patch1 -p1
124 %{?with_FHS:%patch2 -p1}
125
126 find '(' -name '*~' -o -name '*.orig' ')' | xargs -r rm -v
127
128 %build
129 D=$(pwd)
130 pearcmd() {
131         %{__pear} -c ${D}/pearrc "$@"
132 }
133 pearcmd config-set doc_dir %{_docdir}
134 pearcmd config-set data_dir %{php_pear_dir}/data
135 pearcmd config-set php_dir %{php_pear_dir}
136 pearcmd config-set test_dir %{php_pear_dir}/tests
137 pearcmd config-set sig_bin %{_bindir}/gpg
138 pearcmd config-set cfg_dir %{_sysconfdir}/pear
139
140 %install
141 rm -rf $RPM_BUILD_ROOT
142 install -d $RPM_BUILD_ROOT{%{_sysconfdir}/pear,%{php_pear_dir},%{_bindir}}
143 %pear_package_install
144 cp -a pearrc $RPM_BUILD_ROOT%{_sysconfdir}/pear.conf
145
146 # -C and -q options were for php-cgi, in php-cli they're enabled by default.
147 %define php_exec exec /usr/bin/php -dinclude_path=%{php_pear_dir} -doutput_buffering=1
148 cat > $RPM_BUILD_ROOT%{_bindir}/pear <<'EOF'
149 #!/bin/sh
150 %php_exec -dopen_basedir="" -dmemory_limit=128M %{php_pear_dir}/pearcmd.php "$@"
151 EOF
152 cat > $RPM_BUILD_ROOT%{_bindir}/peardev <<'EOF'
153 #!/bin/sh
154 %php_exec -dopen_basedir="" -dmemory_limit=-1 %{php_pear_dir}/pearcmd.php "$@"
155 EOF
156 # This -dextension=pcre.so works with php-5.1, and patched php-cli >= 4:5.0.5-18.1, php4-cli >= 3:4.4.1-6.1
157 # -n is there because devs on #pear said this avoids locking problems when replacing in use libraries.
158 cat > $RPM_BUILD_ROOT%{_bindir}/pecl <<'EOF'
159 #!/bin/sh
160 %php_exec -dmemory_limit=64M -dsafe_mode=0 -n -dextension=xml.so %{php_pear_dir}/peclcmd.php "$@"
161 EOF
162 # for rpm to find interpreter
163 chmod +x $RPM_BUILD_ROOT%{_bindir}/*
164
165 %post
166 if [ -f %{_docdir}/%{name}-%{version}/optional-packages.txt ]; then
167         cat %{_docdir}/%{name}-%{version}/optional-packages.txt
168 fi
169
170 # need to bootstrap for non-root user
171 if [ ! -f %{php_pear_dir}/.lock ]; then
172         umask 2
173         %{_bindir}/pear list > /dev/null
174 fi
175
176 %clean
177 rm -rf $RPM_BUILD_ROOT
178
179 %files
180 %defattr(644,root,root,755)
181 %doc install.log optional-packages.txt
182 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/pear.conf
183 %dir %{_sysconfdir}/pear
184 %attr(755,root,root) %{_bindir}/pear
185 %attr(755,root,root) %{_bindir}/peardev
186 %attr(755,root,root) %{_bindir}/pecl
187 %{php_pear_dir}/.registry/pear.reg
188 %{php_pear_dir}/pearcmd.php
189 %{php_pear_dir}/peclcmd.php
190 %{php_pear_dir}/PEAR/*
191
192 # in -core subpackage
193 %exclude %{php_pear_dir}/PEAR/ErrorStack.php
194 %exclude %{php_pear_dir}/PEAR/Exception.php
195
196 %{php_pear_dir}/data/*
197
198 %files core
199 %defattr(644,root,root,755)
200 %{php_pear_dir}/PEAR.php
201 %{php_pear_dir}/System.php
202 %{php_pear_dir}/OS
203 %dir %{php_pear_dir}/PEAR
204 %{php_pear_dir}/PEAR/ErrorStack.php
205 %{php_pear_dir}/PEAR/Exception.php