Ticket #8164: Portfile

File Portfile, 10.5 KB (added by joe@…, 18 years ago)

Ehancement to the php5 portfile

Line 
1# $Id: Portfile,v 1.21 2006/03/02 21:18:43 mww Exp $
2
3# TODO:
4#               - freetds is not quite there, i think it just needs -ltds added, but configure should be doing that?
5#               - sqlite is wierd... PDO uses the port of v3, but we are forced to use v1 for the main sqlite?
6#               - can't turn on an apxs AND do fcgi. which is kind of lame, but not sure what to do about it
7#               - +recode fails if mysql is also on due to namespace collision, not sure what can be done about that
8#               - kerberos is still linking to apple provided libs instead of the port.  not sure why
9#               - no idea why tidy insists on linking to the apple provided binaries (tidy was broke)
10#               - come up with a +builtins variant, to replace the 'macos' for people who want to link to the apple stuff
11#               - tidy should be a variant
12#               - do we really need tiff?
13
14PortSystem 1.0
15
16name                    php5
17version                 5.1.2
18revision        1
19
20categories      lang php www
21maintainers     darwinports@opendarwin.org
22
23description     PHP: Hypertext Preprocessor
24long_description        PHP is a widely-used general-purpose scripting language \
25                        that is especially suited for Web development and can be \
26                        embedded into HTML.
27platforms       darwin freebsd
28
29master_sites    http://www.php.net/distributions/:release \
30                http://it.php.net/distributions/:release \
31                http://fi.php.net/distributions/:release \
32                http://de.php.net/distributions/:release \
33                http://gr.php.net/distributions/:release \
34                http://fr.php.net/distributions/:release \
35                http://es.php.net/distributions/:release \
36                http://se.php.net/distributions/:release \
37                http://downloads.php.net/ilia/:rc \
38                http://downloads.php.net/jani/:rc
39               
40distfiles       php-${version}.tar.bz2:release
41worksrcdir      php-${version}
42checksums       sha1 f6acc67c293345ad22065768f3049834cb8a912e
43use_bzip2       yes
44
45depends_lib     port:openssl \
46                port:zlib \
47                port:tidy \
48                port:kerberos5 \
49                port:libiconv \
50                lib:libintl.3:gettext
51
52configure.env-append    KRB5_CONFIG=${prefix}/bin/krb5-config
53configure.args  \
54                        --disable-all \
55                        --mandir=${prefix}/share/man \
56                        --infodir=${prefix}/share/info \
57                        --with-config-file-scan-dir=${prefix}/etc/php5 \
58                        --with-gettext=${prefix} \
59                        --with-iconv=${prefix} \
60                        --with-kerberos=${prefix} \
61                        --with-pcre-regex=yes \
62                        --with-openssl=${prefix} \
63                        --with-openssl-dir=${prefix} \
64                        --with-tidy=${prefix} \
65                        --with-zlib=${prefix} \
66                        --with-zlib-dir=${prefix} \
67                        --with-pear \
68                        --enable-bcmath \
69                        --enable-calendar \
70                        --enable-ctype \
71                        --enable-dbase \
72                        --enable-dbx \
73                        --enable-exif \
74                        --enable-filepro \
75                        --enable-ftp \
76                        --enable-mbstring \
77                        --enable-pcntl \
78                        --enable-posix \
79                        --enable-session \
80                        --enable-shmop \
81                        --enable-sockets \
82                        --enable-tokenizer \
83                        --enable-trans-sid  \
84                        --enable-sysvmsg \
85                        --enable-sysvsem \
86                        --enable-sysvshm \
87                        --enable-wddx\
88                        --enable-reflection \
89                        --enable-spl \
90                        --enable-zend-multibyte \
91                        --enable-memory-limit \
92                        --enable-fd-setsize \
93                       
94platform darwin 6 {
95        depends_lib-append      lib:libdl:dlcompat
96        configure.env-append    LDFLAGS=-L${prefix}/lib \
97                        CPPFLAGS="-I${prefix}/include -no-cpp-precomp -DBIND_8_COMPAT" \
98                        LIBS=-ldl
99}
100
101platform darwin 7 {
102        configure.env-append    LDFLAGS="-L${prefix}/lib" \
103                        CPPFLAGS="-I${prefix}/include -no-cpp-precomp" \
104                        LIBS=-ldl
105}
106
107platform darwin 8 {
108        configure.env-append    CC=/usr/bin/gcc-4.0 CPP=/usr/bin/cpp-4.0 CXX=/usr/bin/g++-4.0
109}
110
111platform freebsd {
112        configure.env-append    LDFLAGS=-L${prefix}/lib \
113                                        CPPFLAGS="-I${prefix}/include
114}
115
116#variant macosx {
117#       configure.args-append   --with-kerberos=/usr --with-iodbc=/usr
118#}
119
120variant apache {
121        if { ! [variant_isset macosx] } {
122                depends_lib-append      path:${prefix}/sbin/apxs:apache
123                configure.args-append   --with-apxs=${prefix}/sbin/apxs
124        } else {
125                configure.args-append   --with-apxs=/usr/sbin/apxs
126        }
127}
128
129variant apache2 {
130        depends_lib-append      path:${prefix}/apache2/bin/apxs:apache2
131        configure.args-append   --with-apxs2=${prefix}/apache2/bin/apxs
132}
133
134variant fastcgi {
135        configure.args-append --enable-cgi \
136                                        --enable-fastcgi \
137                                        --enable-force-cgi-redirect
138}
139
140variant pth {
141        depends_lib-append      port:pth
142        configure.args-append   --with-tsrm-pth=${prefix}/bin/pth-config
143}
144
145variant mysql3 {
146        depends_lib-append      port:mysql3
147        configure.args-append   --with-mysql=${prefix}
148}
149
150variant mysql4 {
151        depends_lib-append      port:mysql4
152        configure.args-append   --with-mysql=${prefix} \
153                                --enable-pdo \
154                                --with-pdo-mysql=${prefix} \
155                                --with-mysqli=${prefix}/bin/mysql_config
156}
157
158variant mysql5 {
159        depends_lib-append      port:mysql5
160        configure.args-append   --with-mysql=${workpath}/mysql5 \
161                                --enable-pdo \
162                                --with-pdo-mysql=${workpath}/mysql5 \
163                                --with-mysqli=${prefix}/bin/mysql_config5
164        post-extract {
165                file mkdir "${workpath}/mysql5"
166                file link -symbolic "${workpath}/mysql5/lib" "${prefix}/lib/mysql5"
167                file link -symbolic "${workpath}/mysql5/include" "${prefix}/include/mysql5"
168        }       
169}
170
171variant unixodbc {
172        depends_lib-append      port:unixODBC
173        configure.args-append   --with-unixODBC=${prefix} \
174                                --enable-pdo \
175                                --with-pdo-odbc=unixODBC,${prefix}
176}
177
178variant postgresql8 {
179        depends_lib-append      port:postgresql8
180        configure.args-append   --with-pgsql=${prefix}/lib/pgsql8/bin/ \
181                                --enable-pdo \
182                                --with-pdo-pgsql=${prefix}/lib/pgsql8/bin/
183}
184
185variant freetds {
186        depends_lib-append      port:freetds
187        configure.args-append   --with-sybase-ct=${workpath}/freetds \
188                                --with-mssql=${workpath}/freetds \
189                                --enable-pdo \
190                                --with-pdo-dblib=${workpath}/freetds
191        post-extract {
192                file mkdir "${workpath}/freetds"
193                file link -symbolic "${workpath}/freetds/lib" "${prefix}/lib"
194                file link -symbolic "${workpath}/freetds/include" "${prefix}/include/freetds"
195        }       
196}
197
198variant sqlite {
199        depends_lib-append      port:sqlite3
200        configure.args-append   --enable-sqlite \
201                                --enable-sqlite-utf8 \
202                                --enable-pdo \
203                                --with-pdo-sqlite=${prefix}
204}
205
206# should some of these use ports over others? (IE: cdb)
207# we're missing some backends too (gdbm/qdbm/ndbm)
208variant dba {
209        depends_lib-append      port:db4
210        configure.args-append   --enable-dba \
211                                --with-db4=${prefix} \
212                                --with-flatfile \
213                                --with-inifile \
214                                --with-cdb
215}
216
217variant ldap {
218        depends_lib-append      port:openldap
219        configure.args-append   --with-ldap=${prefix} \
220                                --with-ldap-sasl=${prefix}
221}
222
223variant curl {
224        depends_lib-append      port:curl
225        configure.args-append   --with-curl=${prefix} \
226                                --with-curlwrappers
227}
228
229variant mcrypt {
230        depends_lib-append      port:libmcrypt
231        configure.args-append   --with-mcrypt=${prefix}
232}       
233
234variant mhash {
235        depends_lib-append      port:mhash
236        configure.args-append   --with-mhash=${prefix}
237}
238
239variant readline {
240        depends_lib-append      port:readline
241        configure.args-append   --with-readline=${prefix}
242}
243
244variant ncurses {
245        depends_lib-append      port:ncurses
246        configure.args-append   --with-ncurses=${prefix}
247}
248
249variant gd {
250        depends_lib-append      port:jpeg port:libpng port:freetype port:t1lib lib:libtiff.3:tiff
251       
252        configure.args-append   --with-gd \
253                                --with-jpeg-dir=${prefix} \
254                                --with-png-dir=${prefix} \
255                                --with-freetype-dir=${prefix} \
256                                --with-t1lib=${prefix} \
257                                --enable-gd-native-ttf \
258                                --enable-gd-jis-conv
259}
260
261variant imap {
262        depends_lib-append              port:cclient
263        configure.env-append     CFLAGS=-I${prefix}/include/c-client
264        configure.args-append   --with-imap=${prefix} --with-imap-ssl=${prefix}
265}
266
267variant pspell {
268        depends_lib-append      port:aspell
269        configure.args-append --with-pspell=${prefix}
270}
271
272variant gmp {
273        depends_lib-append      port:gmp
274        configure.args-append --with-gmp=${prefix}
275}
276
277variant recode {
278        depends_lib-append      port:recode
279        configure.args-append --with-recode=${prefix}
280}
281
282variant bz2 {
283        depends_lib-append      port:bzip2
284        configure.args-append --with-bz2=${prefix}
285}
286
287variant xml {
288        depends_lib-append      port:libxml2 \
289                                lib:libexpat.0.4:expat  \
290                                port:libxslt
291
292        configure.args-append   --with-libxml-dir=${prefix} \
293                                --with-expat-dir=${prefix} \
294                                --with-xsl=${prefix} \
295                                --enable-simplexml \
296                                --enable-libxml \
297                                --enable-xml \
298                                --enable-soap \
299                                --enable-dom \
300                                --enable-xmlwriter \
301                                --enable-xmlreader \
302                                --with-xmlrpc
303
304}
305
306
307# if no apache/apache2/fastcgi variant is set, we set it (need better default variant management)
308if { ![variant_isset apache] && ![variant_isset apache2] && ![variant_isset fastcgi] } {
309        if { ! [variant_isset macosx] } {
310                depends_lib-append      path:${prefix}/sbin/apxs:apache
311                configure.args-append   --with-apxs=${prefix}/sbin/apxs
312        } else {
313                configure.args-append   --with-apxs=/usr/sbin/apxs
314        }
315}
316
317destroot.args   INSTALL_ROOT=${destroot} PHP_PEAR_INSTALL_DIR=${prefix}/lib/php
318
319destroot.target install-cli install-pear install-build install-headers install-programs
320
321post-destroot   {
322        # copy fastcgi php binary to the bin dir under a new name so it doesn't overwrite cli version
323        if { [variant_isset fastcgi] } {
324                xinstall -m 755 ${worksrcpath}/sapi/cgi/php ${destroot}${prefix}/bin/php-fcgi
325        }
326
327        #copy module
328        if { [variant_isset apache] } {
329
330                xinstall -m 755 -d ${destroot}${prefix}/libexec/apache \
331                        ${destroot}${prefix}/etc/apache/extras-conf
332                xinstall -m 755 ${worksrcpath}/libs/libphp5.so ${destroot}${prefix}/libexec/apache/
333                xinstall -m 755 -c ${filespath}/mod_php.conf ${destroot}$prefix/etc/apache/extras-conf
334        }
335       
336        if { [variant_isset apache2] } {
337                xinstall -m 755 -d ${destroot}${prefix}/apache2/modules \
338                        ${destroot}${prefix}/apache2/conf/extras-conf
339                xinstall -m 755 ${worksrcpath}/libs/libphp5.so ${destroot}${prefix}/apache2/modules/
340                xinstall -m 755 -c ${filespath}/mod_php.conf ${destroot}${prefix}/apache2/conf/extras-conf
341        }
342
343        file rename ${destroot}${prefix}/etc/pear.conf ${destroot}${prefix}/etc/pear.conf.sample
344
345        #copy php.ini
346        xinstall -m 755 -d ${destroot}${prefix}/etc/php5
347        xinstall -m 755 ${workpath}/${worksrcdir}/php.ini-dist ${destroot}${prefix}/etc/php5/php.ini-dist
348        xinstall -m 755 ${workpath}/${worksrcdir}/php.ini-recommended ${destroot}${prefix}/etc/php5/php.ini-recommended
349
350        #nuke pear-stuff in ${destroot}
351        system "cd ${destroot} && rm -rf .channels .depdb .depdblock .filemap .lock"
352}
353
354post-install {
355        ui_msg "\nIf this is your first install, you might want"
356
357        if { [variant_isset apache] } {
358                ui_msg " * enable php in apache :\n"
359
360                ui_msg "cd ${prefix}/libexec/apache"
361                ui_msg "${prefix}/apache/bin/apxs -a -e -n \"php5\" libphp5.so\n"
362                ui_msg "* copy  ${prefix}/etc/php5/php.ini-dist to  ${prefix}/etc/php5/php.ini"
363        }
364
365        if { [variant_isset apache2] } {
366                ui_msg "cd ${prefix}/apache2/modules"
367                ui_msg "${prefix}/apache2/bin/apxs -a -e -n \"php5\" libphp5.so\n"
368                ui_msg "* copy  ${prefix}/etc/php5/php.ini-dist to  ${prefix}/etc/php5/php.ini"
369        }
370
371        ui_msg "* copy  ${prefix}/etc/pear.conf.sample to  ${prefix}/etc/pear.conf"
372}
373