1 | # $Id: Portfile 26022 2007-06-09 08:43:20Z ryandesign@macports.org $ |
---|
2 | |
---|
3 | PortSystem 1.0 |
---|
4 | |
---|
5 | name php5 |
---|
6 | version 5.2.3 |
---|
7 | categories lang php www |
---|
8 | maintainers ryandesign jwa |
---|
9 | homepage http://www.php.net/ |
---|
10 | distfiles php-${version}.tar.bz2:release |
---|
11 | use_bzip2 yes |
---|
12 | worksrcdir php-${version} |
---|
13 | platforms darwin freebsd |
---|
14 | |
---|
15 | description \ |
---|
16 | PHP: Hypertext Preprocessor |
---|
17 | |
---|
18 | long_description \ |
---|
19 | PHP is a widely-used general-purpose scripting language \ |
---|
20 | that is especially suited for developing web sites, but can also \ |
---|
21 | be used for command-line scripting. |
---|
22 | |
---|
23 | master_sites \ |
---|
24 | ${homepage}distributions/:release \ |
---|
25 | http://it.php.net/distributions/:release \ |
---|
26 | http://fi.php.net/distributions/:release \ |
---|
27 | http://de.php.net/distributions/:release \ |
---|
28 | http://gr.php.net/distributions/:release \ |
---|
29 | http://fr.php.net/distributions/:release \ |
---|
30 | http://es.php.net/distributions/:release \ |
---|
31 | http://se.php.net/distributions/:release \ |
---|
32 | http://downloads.php.net/ilia/:rc \ |
---|
33 | http://downloads.php.net/jani/:rc |
---|
34 | |
---|
35 | checksums \ |
---|
36 | md5 eb50b751c8e1ced05bd012d5a0e4dec3 \ |
---|
37 | sha1 0a02e05e1c663c0d4ee0b253917c0e140e606261 \ |
---|
38 | rmd160 3c895cf7e513e5a3d7d9f742a9d56102cbb3a79b |
---|
39 | |
---|
40 | # Locally fix PHP bug 41555; remove this when updating the port to 5.2.4. |
---|
41 | # See: http://bugs.php.net/bug.php?id=41555 |
---|
42 | patchfiles patch_configure |
---|
43 | |
---|
44 | depends_lib \ |
---|
45 | port:libxml2 \ |
---|
46 | port:libxslt \ |
---|
47 | port:openssl \ |
---|
48 | port:zlib \ |
---|
49 | port:libiconv \ |
---|
50 | port:expat \ |
---|
51 | port:gettext \ |
---|
52 | port:tiff \ |
---|
53 | port:mhash \ |
---|
54 | port:libmcrypt \ |
---|
55 | port:curl \ |
---|
56 | port:pcre \ |
---|
57 | port:jpeg \ |
---|
58 | port:libpng \ |
---|
59 | port:freetype |
---|
60 | |
---|
61 | configure.args \ |
---|
62 | --mandir=${prefix}/share/man \ |
---|
63 | --infodir=${prefix}/share/info \ |
---|
64 | --with-config-file-path=${prefix}/etc \ |
---|
65 | --enable-calendar \ |
---|
66 | --with-iconv=${prefix} \ |
---|
67 | --enable-exif \ |
---|
68 | --enable-ftp \ |
---|
69 | --enable-wddx\ |
---|
70 | --with-zlib=${prefix} \ |
---|
71 | --without-mysql \ |
---|
72 | --without-sqlite \ |
---|
73 | --without-pdo-sqlite \ |
---|
74 | --with-libxml-dir=${prefix} \ |
---|
75 | --with-gettext=${prefix} \ |
---|
76 | --with-xml \ |
---|
77 | --with-expat-dir=${prefix} \ |
---|
78 | --with-xmlrpc \ |
---|
79 | --enable-soap \ |
---|
80 | --enable-filepro \ |
---|
81 | --enable-bcmath \ |
---|
82 | --enable-trans-sid \ |
---|
83 | --enable-mbstring \ |
---|
84 | --enable-dbx \ |
---|
85 | --enable-dba \ |
---|
86 | --with-openssl=${prefix} \ |
---|
87 | --with-mhash=${prefix} \ |
---|
88 | --with-mcrypt=${prefix} \ |
---|
89 | --with-xsl=${prefix} \ |
---|
90 | --with-curl=${prefix} \ |
---|
91 | --with-pcre-regex=${prefix} \ |
---|
92 | --with-gd \ |
---|
93 | --with-jpeg-dir=${prefix} \ |
---|
94 | --with-png-dir=${prefix} \ |
---|
95 | --enable-gd-native-ttf \ |
---|
96 | --without-pear \ |
---|
97 | --with-freetype-dir=${prefix} |
---|
98 | |
---|
99 | platform darwin 6 { |
---|
100 | depends_lib-append \ |
---|
101 | lib:libdl:dlcompat |
---|
102 | configure.env-append \ |
---|
103 | LIBS=-ldl |
---|
104 | configure.cppflags-append \ |
---|
105 | "-no-cpp-precomp -DBIND_8_COMPAT" |
---|
106 | } |
---|
107 | |
---|
108 | platform darwin 7 { |
---|
109 | configure.env-append \ |
---|
110 | LIBS=-ldl |
---|
111 | configure.cppflags-append \ |
---|
112 | "-no-cpp-precomp" |
---|
113 | } |
---|
114 | |
---|
115 | platform darwin 8 { |
---|
116 | configure.env-append \ |
---|
117 | CC=/usr/bin/gcc-4.0 CPP=/usr/bin/cpp-4.0 CXX=/usr/bin/g++-4.0 |
---|
118 | } |
---|
119 | |
---|
120 | variant macosx { |
---|
121 | configure.args-append \ |
---|
122 | --with-ldap=/usr \ |
---|
123 | --with-kerberos=/usr \ |
---|
124 | --with-iodbc=/usr \ |
---|
125 | --with-pdo-odbc=generic,/usr,iodbc,/usr/include |
---|
126 | } |
---|
127 | |
---|
128 | variant unixodbc { |
---|
129 | configure.args-delete \ |
---|
130 | --with-iodbc=/usr \ |
---|
131 | --with-pdo-odbc=generic,/usr,iodbc,/usr/include |
---|
132 | configure.args-append \ |
---|
133 | --with-unixODBC=${prefix} \ |
---|
134 | --with-pdo-odbc=unixODBC,${prefix} |
---|
135 | } |
---|
136 | |
---|
137 | # Build an Apache 1 module. On Mac OS X, it uses Apple's provided Apache 1 server. |
---|
138 | # On other platforms, the MacPorts apache port is used. Keep the options here |
---|
139 | # in sync with those in the relevant part of the post-destroot phase. |
---|
140 | variant apache conflicts apache2 { |
---|
141 | if { ! [variant_isset macosx] } { |
---|
142 | depends_lib-append \ |
---|
143 | path:${prefix}/sbin/apxs:apache |
---|
144 | configure.args-append \ |
---|
145 | --with-apxs=${prefix}/sbin/apxs |
---|
146 | } else { |
---|
147 | configure.args-append \ |
---|
148 | --with-apxs=/usr/sbin/apxs |
---|
149 | } |
---|
150 | } |
---|
151 | |
---|
152 | # Build an Apache 2 module. Keep the options here in sync with those in the |
---|
153 | # relevant part of the post-destroot phase. |
---|
154 | variant apache2 conflicts apache { |
---|
155 | depends_lib-append \ |
---|
156 | path:${prefix}/apache2/bin/apxs:apache2 |
---|
157 | configure.args-append \ |
---|
158 | --with-apxs2=${prefix}/apache2/bin/apxs |
---|
159 | } |
---|
160 | |
---|
161 | # Build a FastCGI binary. Keep the options here in sync with those in the |
---|
162 | # relevant part of the post-destroot phase. |
---|
163 | variant fastcgi { |
---|
164 | if { ![variant_isset apache] && ![variant_isset apache2] } { |
---|
165 | configure.args-append \ |
---|
166 | --enable-fastcgi \ |
---|
167 | --enable-force-cgi-redirect \ |
---|
168 | --enable-memory-limit |
---|
169 | } |
---|
170 | } |
---|
171 | |
---|
172 | # Add IMAP support. See: |
---|
173 | # http://www.php.net/imap |
---|
174 | variant imap { |
---|
175 | depends_lib-append \ |
---|
176 | port:cclient |
---|
177 | configure.cppflags-append \ |
---|
178 | -I${prefix}/include/c-client |
---|
179 | configure.args-append \ |
---|
180 | --with-imap=${prefix} \ |
---|
181 | --with-imap-ssl=${prefix} |
---|
182 | } |
---|
183 | |
---|
184 | # Add Tidy support. See: |
---|
185 | # http://www.php.net/tidy |
---|
186 | variant tidy { |
---|
187 | depends_lib-append \ |
---|
188 | port:tidy |
---|
189 | configure.args-append \ |
---|
190 | --with-tidy=${prefix} |
---|
191 | } |
---|
192 | |
---|
193 | variant mssql { |
---|
194 | depends_lib-append \ |
---|
195 | port:freetds |
---|
196 | configure.args-append \ |
---|
197 | --with-mssql=${prefix} |
---|
198 | } |
---|
199 | |
---|
200 | variant snmp conflicts macports_snmp { |
---|
201 | # This compiles PHP5 with SNMP linked against Apple's included NET-SNMP. |
---|
202 | configure.args-append \ |
---|
203 | --with-snmp=/usr |
---|
204 | } |
---|
205 | |
---|
206 | variant macports_snmp conflicts snmp { |
---|
207 | # This compiles PHP with SNMP linked against MacPorts' NET-SNMP. |
---|
208 | depends_lib-append \ |
---|
209 | port:net-snmp |
---|
210 | configure.args-append \ |
---|
211 | --with-snmp=${prefix} |
---|
212 | } |
---|
213 | |
---|
214 | variant mysql3 conflicts mysql4 mysql5 { |
---|
215 | depends_lib-append \ |
---|
216 | port:mysql |
---|
217 | configure.args-delete \ |
---|
218 | --without-mysql |
---|
219 | configure.args-append \ |
---|
220 | --with-mysql=${prefix} \ |
---|
221 | --with-pdo-mysql=${prefix} |
---|
222 | } |
---|
223 | |
---|
224 | variant mysql4 conflicts mysql3 mysql5 { |
---|
225 | depends_lib-append \ |
---|
226 | port:mysql4 |
---|
227 | configure.args-delete \ |
---|
228 | --without-mysql |
---|
229 | configure.args-append \ |
---|
230 | --with-mysql=${prefix} \ |
---|
231 | --with-pdo-mysql=${prefix} |
---|
232 | } |
---|
233 | |
---|
234 | variant mysql5 conflicts mysql3 mysql4 { |
---|
235 | depends_lib-append \ |
---|
236 | port:mysql5 |
---|
237 | configure.args-delete \ |
---|
238 | --without-mysql |
---|
239 | configure.args-append \ |
---|
240 | --with-mysql=${workpath}/mysql5 \ |
---|
241 | --with-pdo-mysql=${prefix}/bin/mysql_config5 \ |
---|
242 | --with-mysql-sock=${prefix}/var/run/mysql5/mysqld.sock \ |
---|
243 | --with-mysqli=${prefix}/bin/mysql_config5 |
---|
244 | post-extract { |
---|
245 | file mkdir "${workpath}/mysql5" |
---|
246 | file link -symbolic "${workpath}/mysql5/lib" "${prefix}/lib/mysql5" |
---|
247 | file link -symbolic "${workpath}/mysql5/include" "${prefix}/include/mysql5" |
---|
248 | } |
---|
249 | } |
---|
250 | |
---|
251 | variant postgresql { |
---|
252 | depends_lib-append \ |
---|
253 | port:postgresql82 |
---|
254 | configure.args-append \ |
---|
255 | --with-pgsql=${prefix}/lib/postgresql82/bin \ |
---|
256 | --with-pdo-pgsql=${prefix}/lib/postgresql82/bin |
---|
257 | } |
---|
258 | |
---|
259 | # add sqlite support |
---|
260 | # note that standard sqlite support uses the built-in sqlite2 libraries |
---|
261 | # while pdo sqlite support uses the sqlite3 libraries from the sqlite3 port |
---|
262 | variant sqlite { |
---|
263 | depends_lib-append \ |
---|
264 | port:sqlite3 |
---|
265 | configure.args-delete \ |
---|
266 | --without-sqlite \ |
---|
267 | --without-pdo-sqlite |
---|
268 | configure.args-append \ |
---|
269 | --with-sqlite \ |
---|
270 | --with-pdo-sqlite=${prefix} \ |
---|
271 | --enable-sqlite-utf8 |
---|
272 | } |
---|
273 | |
---|
274 | # add semaphore, shared memory and IPC functions; see http://www.php.net/sem |
---|
275 | variant ipc { |
---|
276 | configure.args-append \ |
---|
277 | --enable-shmop \ |
---|
278 | --enable-sysvsem \ |
---|
279 | --enable-sysvshm \ |
---|
280 | --enable-sysvmsg |
---|
281 | } |
---|
282 | |
---|
283 | # add process control functions; see http://www.php.net/pcntl |
---|
284 | variant pcntl { |
---|
285 | configure.args-append \ |
---|
286 | --enable-pcntl |
---|
287 | } |
---|
288 | |
---|
289 | # if no apache/apache2/fastcgi variant is set, we set it (need better default variant management) |
---|
290 | if { ![variant_isset apache] && ![variant_isset apache2] && ![variant_isset fastcgi] } { |
---|
291 | if { ! [variant_isset macosx] } { |
---|
292 | depends_lib-append \ |
---|
293 | path:${prefix}/sbin/apxs:apache |
---|
294 | configure.args-append \ |
---|
295 | --with-apxs=${prefix}/sbin/apxs |
---|
296 | } else { |
---|
297 | configure.args-append \ |
---|
298 | --with-apxs=/usr/sbin/apxs |
---|
299 | } |
---|
300 | } |
---|
301 | |
---|
302 | variant pear { |
---|
303 | configure.args-delete \ |
---|
304 | --without-pear |
---|
305 | configure.args-append \ |
---|
306 | --with-pear=${prefix}/lib/php |
---|
307 | destroot.target-append \ |
---|
308 | install-pear |
---|
309 | destroot.args-append \ |
---|
310 | PHP_PEAR_INSTALL_DIR=${prefix}/lib/php |
---|
311 | post-destroot { |
---|
312 | #nuke pear-stuff in ${destroot} |
---|
313 | system "cd ${destroot} && rm -rf .channels .depdb .depdblock .filemap .lock" |
---|
314 | |
---|
315 | system "if \[ -f ${prefix}/lib/php/.depdblock \]; then rm -f ${destroot}${prefix}/lib/php/.depdblock; fi" |
---|
316 | system "if \[ -f ${prefix}/lib/php/.depdb \]; then rm -f ${destroot}${prefix}/lib/php/.depdb; fi" |
---|
317 | system "if \[ -f ${prefix}/lib/php/.filemap \]; then rm -f ${destroot}${prefix}/lib/php/.filemap; fi" |
---|
318 | system "if \[ -f ${prefix}/lib/php/.lock \]; then rm -f ${destroot}${prefix}/lib/php/.lock; fi" |
---|
319 | system "if \[ -d ${prefix}/lib/php/.channels \]; then rm -rf ${destroot}${prefix}/lib/php/.channels; fi" |
---|
320 | } |
---|
321 | } |
---|
322 | |
---|
323 | destroot.args \ |
---|
324 | INSTALL_ROOT=${destroot} |
---|
325 | |
---|
326 | destroot.target \ |
---|
327 | install-cli install-build install-headers install-programs |
---|
328 | |
---|
329 | post-destroot { |
---|
330 | # Copy the Apache 1 module. |
---|
331 | if { [variant_isset apache] } { |
---|
332 | xinstall -m 755 -d ${destroot}${prefix}/libexec/apache \ |
---|
333 | ${destroot}${prefix}/etc/apache/extras-conf |
---|
334 | xinstall -m 755 ${worksrcpath}/libs/libphp5.so ${destroot}${prefix}/libexec/apache/ |
---|
335 | xinstall -m 755 -c ${filespath}/mod_php.conf ${destroot}$prefix/etc/apache/extras-conf |
---|
336 | } |
---|
337 | |
---|
338 | # Copy the Apache 2 module. |
---|
339 | if { [variant_isset apache2] } { |
---|
340 | xinstall -m 755 -d ${destroot}${prefix}/apache2/modules \ |
---|
341 | ${destroot}${prefix}/apache2/conf/extras-conf |
---|
342 | xinstall -m 755 ${worksrcpath}/libs/libphp5.so ${destroot}${prefix}/apache2/modules/ |
---|
343 | xinstall -m 755 -c ${filespath}/mod_php.conf ${destroot}${prefix}/apache2/conf/extras-conf |
---|
344 | } |
---|
345 | |
---|
346 | if { [variant_isset fastcgi] } { |
---|
347 | # If we've built an Apache module (any version) then the FastCGI binary |
---|
348 | # will not have been built, so we need to run through the whole process |
---|
349 | # again and build just the FastCGI binary. Keep the options here in sync |
---|
350 | # with the options specified in the apache and apache2 variants. |
---|
351 | if { [variant_isset apache] } { |
---|
352 | if { ![variant_isset macosx] } { |
---|
353 | configure.args-delete \ |
---|
354 | --with-apxs=${prefix}/sbin/apxs |
---|
355 | } else { |
---|
356 | configure.args-delete \ |
---|
357 | --with-apxs=/usr/sbin/apxs |
---|
358 | } |
---|
359 | } |
---|
360 | if { [variant_isset apache2] } { |
---|
361 | configure.args-delete \ |
---|
362 | --with-apxs2=${prefix}/apache2/bin/apxs |
---|
363 | } |
---|
364 | |
---|
365 | # Run the build again to get the FastCGI binary. Keep the options here |
---|
366 | # in sync with those in the fastcgi variant. |
---|
367 | if { [variant_isset apache] || [variant_isset apache2] } { |
---|
368 | configure.args-append \ |
---|
369 | --enable-fastcgi \ |
---|
370 | --enable-force-cgi-redirect \ |
---|
371 | --enable-memory-limit |
---|
372 | ui_msg "$UI_PREFIX Configuring ${name} again for fastcgi" |
---|
373 | command_exec configure |
---|
374 | ui_msg "$UI_PREFIX Building ${name} again for fastcgi" |
---|
375 | command_exec build |
---|
376 | ui_msg "$UI_PREFIX Staging ${name} fastcgi into destroot" |
---|
377 | } |
---|
378 | |
---|
379 | # Copy the FastCGI binary to the bin dir under a new name so it doesn't |
---|
380 | # conflict with the cli version. |
---|
381 | xinstall -m 755 ${worksrcpath}/sapi/cgi/php-cgi ${destroot}${prefix}/bin |
---|
382 | } |
---|
383 | |
---|
384 | # file rename ${destroot}${prefix}/etc/pear.conf ${destroot}${prefix}/etc/pear.conf.sample |
---|
385 | |
---|
386 | # Copy the default php.ini files. |
---|
387 | xinstall -m 755 -d ${destroot}${prefix}/etc |
---|
388 | xinstall -m 755 ${workpath}/${worksrcdir}/php.ini-dist ${destroot}${prefix}/etc/php.ini-dist |
---|
389 | xinstall -m 755 ${workpath}/${worksrcdir}/php.ini-recommended ${destroot}${prefix}/etc/php.ini-recommended |
---|
390 | } |
---|
391 | |
---|
392 | post-install { |
---|
393 | ui_msg "\nIf this is your first install, you might want" |
---|
394 | |
---|
395 | if { [variant_isset apache] } { |
---|
396 | ui_msg " * enable php in apache :\n" |
---|
397 | |
---|
398 | ui_msg "cd ${prefix}/libexec/apache" |
---|
399 | ui_msg "${prefix}/apache/bin/apxs -a -e -n \"php5\" libphp5.so\n" |
---|
400 | ui_msg "* copy ${prefix}/etc/php.ini-dist to ${prefix}/etc/php.ini" |
---|
401 | } |
---|
402 | |
---|
403 | if { [variant_isset apache2] } { |
---|
404 | ui_msg "cd ${prefix}/apache2/modules" |
---|
405 | ui_msg "${prefix}/apache2/bin/apxs -a -e -n \"php5\" libphp5.so\n" |
---|
406 | ui_msg "* copy ${prefix}/etc/php.ini-dist to ${prefix}/etc/php.ini" |
---|
407 | } |
---|
408 | |
---|
409 | # ui_msg "* copy ${prefix}/etc/pear.conf.sample to ${prefix}/etc/pear.conf" |
---|
410 | } |
---|
411 | |
---|
412 | livecheck.check regex |
---|
413 | livecheck.url ${homepage}downloads.php |
---|
414 | livecheck.regex get/php-(5\.\[0-9\.\]+)\.tar |
---|