1 | # $Id: Portfile,v 1.31 2006/08/27 06:33:34 markd Exp $ |
---|
2 | |
---|
3 | PortSystem 1.0 |
---|
4 | |
---|
5 | name php5 |
---|
6 | version 5.1.6 |
---|
7 | revision 0 |
---|
8 | categories lang php www |
---|
9 | maintainers macports-2006@ryandesign.com, jwa@macports.org |
---|
10 | |
---|
11 | description PHP: Hypertext Preprocessor |
---|
12 | long_description PHP is a widely-used general-purpose scripting language \ |
---|
13 | that is especially suited for Web development and can be \ |
---|
14 | embedded into HTML. |
---|
15 | platforms darwin freebsd |
---|
16 | |
---|
17 | master_sites http://www.php.net/distributions/:release \ |
---|
18 | http://it.php.net/distributions/:release \ |
---|
19 | http://fi.php.net/distributions/:release \ |
---|
20 | http://de.php.net/distributions/:release \ |
---|
21 | http://gr.php.net/distributions/:release \ |
---|
22 | http://fr.php.net/distributions/:release \ |
---|
23 | http://es.php.net/distributions/:release \ |
---|
24 | http://se.php.net/distributions/:release \ |
---|
25 | http://downloads.php.net/ilia/:rc \ |
---|
26 | http://downloads.php.net/jani/:rc |
---|
27 | |
---|
28 | distfiles php-${version}.tar.bz2:release |
---|
29 | worksrcdir php-${version} |
---|
30 | checksums md5 08e423aa314369d4392a36b3f7246afc \ |
---|
31 | sha1 a20b946f1de0a8a35a8a6bf437adbba4e5448d27 |
---|
32 | use_bzip2 yes |
---|
33 | |
---|
34 | depends_lib port:libxml2 \ |
---|
35 | port:libxslt \ |
---|
36 | port:openssl \ |
---|
37 | port:tidy \ |
---|
38 | port:zlib \ |
---|
39 | port:libiconv \ |
---|
40 | lib:libexpat.0.4:expat \ |
---|
41 | lib:libintl.3:gettext \ |
---|
42 | lib:libtiff.3:tiff \ |
---|
43 | lib:libmhash:mhash \ |
---|
44 | port:libmcrypt \ |
---|
45 | lib:c-client:cclient \ |
---|
46 | port:curl \ |
---|
47 | port:jpeg \ |
---|
48 | port:libpng \ |
---|
49 | port:freetype |
---|
50 | |
---|
51 | configure.args \ |
---|
52 | --mandir=${prefix}/share/man \ |
---|
53 | --infodir=${prefix}/share/info \ |
---|
54 | --with-config-file-path=${prefix}/etc \ |
---|
55 | --enable-calendar \ |
---|
56 | --with-iconv=${prefix} \ |
---|
57 | --enable-exif \ |
---|
58 | --enable-ftp \ |
---|
59 | --enable-wddx\ |
---|
60 | --with-zlib=${prefix} \ |
---|
61 | --without-mysql \ |
---|
62 | --with-libxml-dir=${prefix} \ |
---|
63 | --with-gettext=${prefix} \ |
---|
64 | --with-libxml-dir=${prefix} \ |
---|
65 | --with-xml \ |
---|
66 | --with-expat-dir=${prefix} \ |
---|
67 | --with-xmlrpc \ |
---|
68 | --enable-filepro \ |
---|
69 | --enable-bcmath \ |
---|
70 | --enable-trans-sid \ |
---|
71 | --enable-mbstring \ |
---|
72 | --enable-dbx \ |
---|
73 | --with-openssl=${prefix} \ |
---|
74 | --with-mhash=${prefix} \ |
---|
75 | --with-mcrypt=${prefix} \ |
---|
76 | --with-tidy=${prefix} \ |
---|
77 | --with-xsl=${prefix} \ |
---|
78 | --with-imap=${prefix} \ |
---|
79 | --with-imap-ssl=${prefix} \ |
---|
80 | --with-curl=${prefix} \ |
---|
81 | --with-gd \ |
---|
82 | --with-jpeg-dir=${prefix} \ |
---|
83 | --with-png-dir=${prefix} \ |
---|
84 | --enable-gd-native-ttf \ |
---|
85 | --with-freetype-dir=${prefix} |
---|
86 | |
---|
87 | configure.env CFLAGS=-I${prefix}/include/c-client |
---|
88 | |
---|
89 | platform darwin 6 { |
---|
90 | depends_lib-append lib:libdl:dlcompat |
---|
91 | configure.env-append LDFLAGS=-L${prefix}/lib \ |
---|
92 | CPPFLAGS="-I${prefix}/include -no-cpp-precomp -DBIND_8_COMPAT" \ |
---|
93 | LIBS=-ldl |
---|
94 | configure.args-append --enable-sqlite-utf8 |
---|
95 | } |
---|
96 | |
---|
97 | platform darwin 7 { |
---|
98 | configure.env-append LDFLAGS="-L${prefix}/lib" \ |
---|
99 | CPPFLAGS="-I${prefix}/include -no-cpp-precomp" \ |
---|
100 | LIBS=-ldl |
---|
101 | configure.args-append --enable-sqlite-utf8 |
---|
102 | } |
---|
103 | |
---|
104 | platform darwin 8 { |
---|
105 | configure.env-append CC=/usr/bin/gcc-4.0 CPP=/usr/bin/cpp-4.0 CXX=/usr/bin/g++-4.0 |
---|
106 | configure.args-append --enable-sqlite-utf8 |
---|
107 | } |
---|
108 | |
---|
109 | platform freebsd { |
---|
110 | configure.env-append LDFLAGS=-L${prefix}/lib \ |
---|
111 | CPPFLAGS="-I${prefix}/include |
---|
112 | } |
---|
113 | |
---|
114 | variant macosx { |
---|
115 | configure.args-append --with-kerberos=/usr --with-iodbc=/usr |
---|
116 | } |
---|
117 | |
---|
118 | variant apache conflicts apache2 fastcgi { |
---|
119 | if { ! [variant_isset macosx] } { |
---|
120 | depends_lib-append path:${prefix}/sbin/apxs:apache |
---|
121 | configure.args-append --with-apxs=${prefix}/sbin/apxs |
---|
122 | } else { |
---|
123 | configure.args-append --with-apxs=/usr/sbin/apxs |
---|
124 | } |
---|
125 | } |
---|
126 | |
---|
127 | variant apache2 conflicts apache fastcgi { |
---|
128 | depends_lib-append path:${prefix}/apache2/bin/apxs:apache2 |
---|
129 | configure.args-append --with-apxs2=${prefix}/apache2/bin/apxs |
---|
130 | } |
---|
131 | |
---|
132 | variant fastcgi conflicts apache apache2 { |
---|
133 | configure.args-append --enable-fastcgi \ |
---|
134 | --enable-force-cgi-redirect \ |
---|
135 | --enable-memory-limit |
---|
136 | } |
---|
137 | |
---|
138 | variant snmp conflicts macports_snmp { |
---|
139 | # This compiles PHP5 with SNMP linked against Apple's included NET-SNMP. |
---|
140 | configure.args-append --with-snmp=/usr |
---|
141 | } |
---|
142 | |
---|
143 | variant macports_snmp conflicts snmp { |
---|
144 | # This compiles PHP with SNMP linked against MacPorts' NET-SNMP. |
---|
145 | depends_lib-append port:net-snmp |
---|
146 | configure.args-append --with-snmp=${prefix} |
---|
147 | } |
---|
148 | |
---|
149 | variant mysql3 conflicts mysql4 mysql5 { |
---|
150 | depends_lib-append port:mysql |
---|
151 | configure.args-delete --without-mysql |
---|
152 | configure.args-append --with-mysql=${prefix} \ |
---|
153 | --with-pdo-mysql=${prefix} |
---|
154 | } |
---|
155 | |
---|
156 | variant mysql4 conflicts mysql3 mysql5 { |
---|
157 | depends_lib-append port:mysql4 |
---|
158 | configure.args-delete --without-mysql |
---|
159 | configure.args-append --with-mysql=${prefix} \ |
---|
160 | --with-pdo-mysql=${prefix} |
---|
161 | } |
---|
162 | |
---|
163 | variant mysql5 conflicts mysql3 mysql4 { |
---|
164 | depends_lib-append port:mysql5 |
---|
165 | configure.args-delete --without-mysql |
---|
166 | configure.args-append --with-mysql=${workpath}/mysql5 \ |
---|
167 | --with-pdo-mysql=${prefix}/bin/mysql_config5 \ |
---|
168 | --with-mysql-sock=${prefix}/var/run/mysql5/mysqld.sock \ |
---|
169 | --with-mysqli=${prefix}/bin/mysql_config5 |
---|
170 | post-extract { |
---|
171 | file mkdir "${workpath}/mysql5" |
---|
172 | file link -symbolic "${workpath}/mysql5/lib" "${prefix}/lib/mysql5" |
---|
173 | file link -symbolic "${workpath}/mysql5/include" "${prefix}/include/mysql5" |
---|
174 | } |
---|
175 | } |
---|
176 | |
---|
177 | variant postgresql { |
---|
178 | depends_lib-append port:postgresql81 |
---|
179 | configure.args-append --with-pgsql=${prefix}/lib/postgresql81/bin \ |
---|
180 | --with-pdo-pgsql=${prefix}/lib/postgresql81/bin |
---|
181 | } |
---|
182 | |
---|
183 | # if no apache/apache2/fastcgi variant is set, we set it (need better default variant management) |
---|
184 | if { ![variant_isset apache] && ![variant_isset apache2] && ![variant_isset fastcgi] } { |
---|
185 | if { ! [variant_isset macosx] } { |
---|
186 | depends_lib-append path:${prefix}/sbin/apxs:apache |
---|
187 | configure.args-append --with-apxs=${prefix}/sbin/apxs |
---|
188 | } else { |
---|
189 | configure.args-append --with-apxs=/usr/sbin/apxs |
---|
190 | } |
---|
191 | } |
---|
192 | |
---|
193 | destroot.args INSTALL_ROOT=${destroot} PHP_PEAR_INSTALL_DIR=${prefix}/lib/php |
---|
194 | |
---|
195 | destroot.target install-cli install-build install-headers install-programs |
---|
196 | |
---|
197 | post-destroot { |
---|
198 | # copy fastcgi php binary to the bin dir under a new name so it doesn't overwrite cli version |
---|
199 | if { [variant_isset fastcgi] } { |
---|
200 | xinstall -m 755 ${worksrcpath}/sapi/cgi/php ${destroot}${prefix}/bin/php-fcgi |
---|
201 | } |
---|
202 | |
---|
203 | #copy module |
---|
204 | if { [variant_isset apache] } { |
---|
205 | |
---|
206 | xinstall -m 755 -d ${destroot}${prefix}/libexec/apache \ |
---|
207 | ${destroot}${prefix}/etc/apache/extras-conf |
---|
208 | xinstall -m 755 ${worksrcpath}/libs/libphp5.so ${destroot}${prefix}/libexec/apache/ |
---|
209 | xinstall -m 755 -c ${filespath}/mod_php.conf ${destroot}$prefix/etc/apache/extras-conf |
---|
210 | } |
---|
211 | |
---|
212 | if { [variant_isset apache2] } { |
---|
213 | xinstall -m 755 -d ${destroot}${prefix}/apache2/modules \ |
---|
214 | ${destroot}${prefix}/apache2/conf/extras-conf |
---|
215 | xinstall -m 755 ${worksrcpath}/libs/libphp5.so ${destroot}${prefix}/apache2/modules/ |
---|
216 | xinstall -m 755 -c ${filespath}/mod_php.conf ${destroot}${prefix}/apache2/conf/extras-conf |
---|
217 | } |
---|
218 | |
---|
219 | # file rename ${destroot}${prefix}/etc/pear.conf ${destroot}${prefix}/etc/pear.conf.sample |
---|
220 | |
---|
221 | #copy php.ini |
---|
222 | xinstall -m 755 -d ${destroot}${prefix}/etc |
---|
223 | xinstall -m 755 ${workpath}/${worksrcdir}/php.ini-dist ${destroot}${prefix}/etc/php.ini-dist |
---|
224 | xinstall -m 755 ${workpath}/${worksrcdir}/php.ini-recommended ${destroot}${prefix}/etc/php.ini-recommended |
---|
225 | |
---|
226 | #nuke pear-stuff in ${destroot} |
---|
227 | system "cd ${destroot} && rm -rf .channels .depdb .depdblock .filemap .lock" |
---|
228 | } |
---|
229 | |
---|
230 | post-install { |
---|
231 | ui_msg "\nIf this is your first install, you might want" |
---|
232 | |
---|
233 | if { [variant_isset apache] } { |
---|
234 | ui_msg " * enable php in apache :\n" |
---|
235 | |
---|
236 | ui_msg "cd ${prefix}/libexec/apache" |
---|
237 | ui_msg "${prefix}/apache/bin/apxs -a -e -n \"php5\" libphp5.so\n" |
---|
238 | ui_msg "* copy ${prefix}/etc/php.ini-dist to ${prefix}/etc/php.ini" |
---|
239 | } |
---|
240 | |
---|
241 | if { [variant_isset apache2] } { |
---|
242 | ui_msg "cd ${prefix}/apache2/modules" |
---|
243 | ui_msg "${prefix}/apache2/bin/apxs -a -e -n \"php5\" libphp5.so\n" |
---|
244 | ui_msg "* copy ${prefix}/etc/php.ini-dist to ${prefix}/etc/php.ini" |
---|
245 | } |
---|
246 | |
---|
247 | # ui_msg "* copy ${prefix}/etc/pear.conf.sample to ${prefix}/etc/pear.conf" |
---|
248 | } |
---|
249 | |
---|