summaryrefslogtreecommitdiff
path: root/lang/php53/Makefile
blob: f4bbd0450363b6a7caa10c34c654640179b3bea7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
# New ports collection makefile for:	php4
# Date created:				Tue Feb 18 11:17:13 CET 2003
# Whom:					Alex Dupre <sysadmin@alexdupre.com>
#
# $FreeBSD$
#
# There are many ways to select which extensions you want to enable, either
# in interactive mode or in batch mode.
#
# By default, the enabled extensions are: CTYPE, MYSQL, PCRE, POSIX, SESSION,
# TOKENIZER, XML and ZLIB. This behaviour can be changed overriding the
# PHP_OPTIONS variable (e.g. PHP_OPTIONS="EXT1 EXT2 EXT3").
#
# Another way is to use the WITH_<EXT> and WITHOUT_<EXT> knobs, for additional
# and default extensions respectively (implies batch mode).
#
# The last way reads an "extension" file, located in ~/php_options (the
# location is overridable by the OPTION_FILE variable). You may find an
# example in scripts/php_options (interactive mode only).
#

PORTNAME=	php4
PORTVERSION=	4.3.2.r4
CATEGORIES?=	lang devel www
MASTER_SITES=	http://downloads.php.net/jani/ \
		http://www.gufi.org/~alex/php/
.if defined(WITHOUT_CLI)
PKGNAMEPREFIX=	mod_
.endif
.if defined(WITHOUT_APACHE)
PKGNAMESUFFIX=	-cli
.endif
DISTNAME=	php-${PORTVERSION:S/.r/RC/}

MAINTAINER?=	sysadmin@alexdupre.com
COMMENT=	PHP Scripting Language (Apache Module and CLI)
.if defined(WITHOUT_APACHE)
COMMENT=	PHP Command Line Interpreter
.endif
.if defined(WITHOUT_CLI)
COMMENT=	PHP Apache Module
.endif

USE_BZIP2=	yes
USE_SUBMAKE=	yes
GNU_CONFIGURE=	yes
USE_BISON=	yes
USE_LIBTOOL=	yes

CONFIGURE_ARGS=	--enable-versioning \
		--enable-memory-limit \
		--with-layout=GNU \
		--with-zlib-dir=/usr \
		--disable-all

EXT_DIR=	20020429
SAPI_FILE=	""

.if defined(WITHOUT_APACHE)
CONFLICTS=	php4-4* mod_php4-4*
.endif

.if defined(WITHOUT_CLI)
CONFLICTS=	php4-4* php4-cli-4*
CONFIGURE_ARGS+=--disable-cli
PLIST_SUB+=	CLI="@comment "
.else
MAN1=		php.1
PLIST_SUB+=	CLI=""
.endif

CONFLICTS?=	php4-cli-4* mod_php4-4*

ALL_OPTIONS=	BCMATH BZIP2 CALENDAR CRACK CTYPE CURL DBASE DBX DOMXML \
		DOMXSLT EXIF FILEPRO FTP GD GDBM GETTEXT GMP HYPERWAVE ICONV \
		IMAP INTERBASE MBSTRING MCAL MCVE MCRYPT MHASH MIME MING MYSQL \
		NCURSES OPENLDAP OPENSSL PCNTL PCRE PDFLIB POSIX POSTGRESQL \
		PSPELL READLINE RECODE SESSION SHMOP SNMP SOCKETS SYBASEDB \
		SYBASECT SYSVSEM SYSVSHM TOKENIZER UNIXODBC WDDX XML XMLRPC \
		XSLT YAZ YP ZIP ZLIB

.for opt in ${ALL_OPTIONS}
.if defined(WITH_${opt}) || defined(WITHOUT_${opt})
BATCH=		yes
.endif
.endfor

.if !defined(BATCH) && !defined(PACKAGE_BUILDING)
IS_INTERACTIVE=	yes
.endif

PBDIR=		${PREFIX}/share/pear/boot

.include <bsd.port.pre.mk>

.if ${OSVERSION} < 400014
CONFIGURE_ARGS+=--disable-ipv6
.endif

.if !defined(WITHOUT_APACHE)
.if exists(${LOCALBASE}/include/apache2/apr.h)
WITH_APACHE2=	yes
.endif

APXS?=		${LOCALBASE}/sbin/apxs

.if defined(WITH_APACHE2)
APACHE_PORT?=	${PORTSDIR}/www/apache2
CONFIGURE_ARGS+=--with-apxs2=${APXS}
SAPI_FILE=	libexec/apache2/libphp4.so
.else
APACHE_PORT?=	${PORTSDIR}/www/apache13
CONFIGURE_ARGS+=--with-apxs=${APXS}
SAPI_FILE=	libexec/apache/libphp4.so
.endif

BUILD_DEPENDS+=	${APXS}:${APACHE_PORT}
RUN_DEPENDS+=	${APXS}:${APACHE_PORT}

PLIST_SUB+=	APACHE=""
.else
PLIST_SUB+=	APACHE="@comment "
.endif

PLIST_SUB+=	SAPI_FILE=${SAPI_FILE} \
		EXT_DIR=${EXT_DIR}

WRKDIR?=	${WRKDIRPREFIX}${.CURDIR}/work
OPTION_FILE?=	${HOME}/php_options

PHP_OPTIONS?=	CTYPE MYSQL PCRE POSIX SESSION TOKENIZER XML ZLIB

.for opt in ${ALL_OPTIONS}
.if defined(WITH_${opt})
SEL_OPTIONS+=	${opt}
.endif
.endfor
.for opt in ${PHP_OPTIONS}
.if !defined(WITHOUT_${opt})
SEL_OPTIONS+=	${opt}
.endif
SCRIPTS_ENV+=	WITH_${opt}=ON
.endfor

SCRIPTS_ENV+=	SEL_OPTIONS="${SEL_OPTIONS}" \
		OPTION_FILE="${OPTION_FILE}" \
		WRKDIR="${WRKDIR}" \
		CAT="${CAT}" \
		SED="${SED}"

.ifmake describe
WITH_MYSQL=	yes
WITH_XML=	yes
.endif

.if exists(${WRKDIR}/Makefile.inc)
.include "${WRKDIR}/Makefile.inc"
.endif

.if defined(WITH_DOMXSLT)
WITH_DOMXML=	yes
.endif

.if defined(WITH_XMLRPC) || defined(WITH_XSLT)
WITH_ICONV_DEP=	yes
.endif

.if defined(WITH_SNMP) || defined(WITH_POSTGRESQL)
WITH_OPENSSL_DEP=	yes
.endif

.if defined(WITH_WDDX) || defined(WITH_XMLRPC) || defined(WITH_XSLT)
WITH_XML_DEP=	yes
.endif

.if defined(WITH_BCMATH)
CONFIGURE_ARGS+=--enable-bcmath
.endif

.if defined(WITH_BZIP2)
.if exists(/usr/bin/bzip2)
BZIP2BASE=	/usr
.else
BZIP2BASE=	${LOCALBASE}
LIB_DEPENDS+=	bz2.1:${PORTSDIR}/archivers/bzip2
.endif
CONFIGURE_ARGS+=--with-bz2=${BZIP2BASE}
.endif

.if defined(WITH_CALENDAR)
CONFIGURE_ARGS+=--enable-calendar
.endif

.if defined(WITH_CRACK)
BUILD_DEPENDS+=	${LOCALBASE}/lib/libcrack.a:${PORTSDIR}/security/cracklib
CONFIGURE_ARGS+=--with-crack=${LOCALBASE}
.endif

.if defined(WITH_CTYPE)
CONFIGURE_ARGS+=--enable-ctype
.endif

.if defined(WITH_CURL)
LIB_DEPENDS+=	curl.2:${PORTSDIR}/ftp/curl
CONFIGURE_ARGS+=--with-curl=${LOCALBASE}
.endif

.if defined(WITH_DBASE)
CONFIGURE_ARGS+=--enable-dbase
.endif

.if defined(WITH_DBX)
CONFIGURE_ARGS+=--enable-dbx
.endif

.if defined(WITH_DOMXML)
LIB_DEPENDS+=	xml2.5:${PORTSDIR}/textproc/libxml2
CONFIGURE_ARGS+=--with-dom=${LOCALBASE}
.endif

.if defined(WITH_DOMXSLT)
LIB_DEPENDS+=	xslt.1:${PORTSDIR}/textproc/libxslt
CONFIGURE_ARGS+=--with-dom-xslt=${LOCALBASE} --with-dom-exslt=${LOCALBASE}
.endif

.if defined(WITH_EXIF)
CONFIGURE_ARGS+=--enable-exif
.endif

.if defined(WITH_FILEPRO)
CONFIGURE_ARGS+=--enable-filepro
.endif

.if defined(WITH_FTP)
CONFIGURE_ARGS+=--enable-ftp
.endif

.if defined(WITH_GD)
LIB_DEPENDS+=	freetype.9:${PORTSDIR}/print/freetype2
LIB_DEPENDS+=	png.5:${PORTSDIR}/graphics/png
LIB_DEPENDS+=	jpeg.9:${PORTSDIR}/graphics/jpeg
CONFIGURE_ARGS+=--with-gd \
		--enable-gd-native-ttf \
		--with-freetype-dir=${LOCALBASE} \
		--with-jpeg-dir=${LOCALBASE} \
		--with-png-dir=${LOCALBASE}
.if !defined(WITHOUT_X11)
LIB_DEPENDS+=	Xpm.4:${PORTSDIR}/x11/XFree86-4-libraries
CONFIGURE_ARGS+=--with-xpm-dir=${LOCALBASE}
.endif
.endif

.if defined(WITH_GDBM)
LIB_DEPENDS+=	gdbm.3:${PORTSDIR}/databases/gdbm
CONFIGURE_ARGS+=--enable-dba --with-gdbm=${LOCALBASE}
.endif

.if defined(WITH_GETTEXT)
LIB_DEPENDS+=	intl.4:${PORTSDIR}/devel/gettext
CONFIGURE_ARGS+=--with-gettext=${LOCALBASE}
.endif

.if defined(WITH_GMP)
LIB_DEPENDS+=	gmp.6:${PORTSDIR}/math/libgmp4
CONFIGURE_ARGS+=--with-gmp=${LOCALBASE}
.endif

.if defined(WITH_HYPERWAVE)
CONFIGURE_ARGS+=--with-hyperwave
.endif

.if defined(WITH_ICONV) || defined(WITH_ICONV_DEP)
LIB_DEPENDS+=	iconv.3:${PORTSDIR}/converters/libiconv
.endif

.if defined(WITH_ICONV)
CONFIGURE_ARGS+=--with-iconv=${LOCALBASE}
.endif

.if defined(WITH_IMAP)
LIB_DEPENDS+=	c-client4.8:${PORTSDIR}/mail/cclient
CONFIGURE_ARGS+=--with-imap=${LOCALBASE} --with-imap-ssl=${LOCALBASE}
.endif

.if defined(WITH_INTERBASE)
LIB_DEPENDS+=	gds.1:${PORTSDIR}/databases/firebird
CONFIGURE_ARGS+=--with-interbase=${LOCALBASE}/firebird
.endif

.if defined(WITH_MBSTRING)
CONFIGURE_ARGS+=--enable-mbstring --enable-mbregex
.endif

.if defined(WITH_MCAL)
LIB_DEPENDS+=	mcal.0:${PORTSDIR}/misc/libmcal
CONFIGURE_ARGS+=--with-mcal=${LOCALBASE}
.endif

.if defined(WITH_MCVE)
LIB_DEPENDS+=	mcve.3:${PORTSDIR}/devel/libmcve
CONFIGURE_ARGS+=--with-mcve=${LOCALBASE}
.endif

.if defined(WITH_MCRYPT)
LIB_DEPENDS+=	mcrypt.8:${PORTSDIR}/security/libmcrypt
CONFIGURE_ARGS+=--with-mcrypt=${LOCALBASE}
.endif

.if defined(WITH_MHASH)
LIB_DEPENDS+=	mhash.2:${PORTSDIR}/security/mhash
CONFIGURE_ARGS+=--with-mhash=${LOCALBASE}
.endif

.if defined(WITH_MIME)
CONFIGURE_ARGS+=--with-mime-magic=/usr/share/misc/magic.mime
.endif

.if defined(WITH_MING)
LIB_DEPENDS+=	ming.3:${PORTSDIR}/graphics/ming
CONFIGURE_ARGS+=--with-ming=${LOCALBASE}
.endif

.if defined(WITH_MYSQL)
.if exists(${LOCALBASE}/lib/mysql/libmysqlclient.so.10)
LIB_DEPENDS+=	mysqlclient.10:${PORTSDIR}/databases/mysql323-client
.else
.if exists(${LOCALBASE}/lib/mysql/libmysqlclient.so.14)
LIB_DEPENDS+=	mysqlclient.14:${PORTSDIR}/databases/mysql41-client
.else
LIB_DEPENDS+=	mysqlclient.12:${PORTSDIR}/databases/mysql40-client
.endif
.endif
CONFIGURE_ARGS+=--with-mysql=${LOCALBASE}
.endif

.if defined(WITH_NCURSES)
.if ${OSVERSION} < 400000
NCURSESBASE=	${LOCALBASE}
LIB_DEPENDS+=	ncurses.5:${PORTSDIR}/devel/ncurses
.else
NCURSESBASE=	/usr
.endif
CONFIGURE_ARGS+=--with-ncurses=${NCURSESBASE}
.endif

.if defined(WITH_OPENLDAP)
.if exists(${LOCALBASE}/lib/libldap.so.1)
LIB_DEPENDS+=	ldap.1:${PORTSDIR}/net/openldap12
.else
LIB_DEPENDS+=	ldap.2:${PORTSDIR}/net/openldap21
.endif
CONFIGURE_ARGS+=--with-ldap=${LOCALBASE}
.endif

.if defined(WITH_OPENSSL) || defined(WITH_OPENSSL_DEP)
.if exists(${LOCALBASE}/lib/libcrypto.so.3)
OPENSSLBASE=	${LOCALBASE}
LIB_DEPENDS+=	crypto.3:${PORTSDIR}/security/openssl
.else
OPENSSLBASE=	/usr
.endif
.endif

.if defined(WITH_OPENSSL)
CONFIGURE_ARGS+=--with-openssl=${OPENSSLBASE}
.endif

.if defined(WITH_PCNTL)
CONFIGURE_ARGS+=--enable-pcntl
.endif

.if defined(WITH_PCRE)
CONFIGURE_ARGS+=--with-pcre-regex=yes
.endif

.if defined(WITH_PDFLIB)
LIB_DEPENDS+=	pdf.5:${PORTSDIR}/print/pdflib
CONFIGURE_ARGS+=--with-pdflib=${LOCALBASE}
.endif

.if defined(WITH_POSIX)
CONFIGURE_ARGS+=--enable-posix
.endif

.if defined(WITH_POSTGRESQL)
LIB_DEPENDS+=	pq.3:${PORTSDIR}/databases/postgresql7
CONFIGURE_ARGS+=--with-pgsql=${LOCALBASE}
.endif

.if defined(WITH_PSPELL)
LIB_DEPENDS+=	aspell.15:${PORTSDIR}/textproc/aspell
CONFIGURE_ARGS+=--with-pspell=${LOCALBASE}
.endif

.if defined(WITH_READLINE)
CONFIGURE_ARGS+=--with-readline
.endif

.if defined(WITH_RECODE)
LIB_DEPENDS+=	recode.3:${PORTSDIR}/converters/recode
CONFIGURE_ARGS+=--with-recode=${LOCALBASE}
.endif

.if defined(WITH_SESSION)
CONFIGURE_ARGS+=--enable-session
.endif

.if defined(WITH_SHMOP)
CONFIGURE_ARGS+=--enable-shmop
.endif

.if defined(WITH_SNMP)
LIB_DEPENDS+=	snmp.4:${PORTSDIR}/net/net-snmp4
CONFIGURE_ARGS+=--with-snmp=${LOCALBASE} --enable-ucd-snmp-hack
.endif

.if defined(WITH_SOCKETS)
CONFIGURE_ARGS+=--enable-sockets
.endif

.if defined(WITH_SYBASEDB)
LIB_DEPENDS+=	sybdb.3:${PORTSDIR}/databases/freetds
CONFIGURE_ARGS+=--with-sybase=${LOCALBASE}
.endif

.if defined(WITH_SYBASECT)
LIB_DEPENDS+=	ct.1:${PORTSDIR}/databases/freetds
CONFIGURE_ARGS+=--with-sybase-ct=${LOCALBASE}
.endif

.if defined(WITH_SYSVSEM)
CONFIGURE_ARGS+=--enable-sysvsem
.endif

.if defined(WITH_SYSVSHM)
CONFIGURE_ARGS+=--enable-sysvshm
.endif

.if defined(WITH_TOKENIZER)
CONFIGURE_ARGS+=--enable-tokenizer
.endif

.if defined(WITH_UNIXODBC)
LIB_DEPENDS+=	odbc.1:${PORTSDIR}/databases/unixODBC
CONFIGURE_ARGS+=--with-unixODBC=${LOCALBASE}
.endif

.if defined(WITH_WDDX)
CONFIGURE_ARGS+=--enable-wddx
.endif

.if defined(WITH_XML) || defined(WITH_XML_DEP)
LIB_DEPENDS+=	expat.4:${PORTSDIR}/textproc/expat2
.endif

.if defined(WITH_XML)
CONFIGURE_ARGS+=--enable-xml --with-expat-dir=${LOCALBASE}
.endif

.if defined(WITH_XMLRPC)
CONFIGURE_ARGS+=--with-xmlrpc
.endif

.if defined(WITH_XSLT)
LIB_DEPENDS+=	sablot.70:${PORTSDIR}/textproc/sablotron
CONFIGURE_ARGS+=--enable-xslt --with-xslt-sablot=${LOCALBASE}
.endif

.if defined(WITH_YAZ)
LIB_DEPENDS+=	yaz.2:${PORTSDIR}/net/yaz
CONFIGURE_ARGS+=--with-yaz=${LOCALBASE}/bin
.endif

.if defined(WITH_YP)
CONFIGURE_ARGS+=--enable-yp
.endif

.if defined(WITH_ZIP)
LIB_DEPENDS+=	zzip-0.10:${PORTSDIR}/devel/zziplib
CONFIGURE_ARGS+=--with-zip=${LOCALBASE}
.endif

.if defined(WITH_ZLIB)
CONFIGURE_ARGS+=--with-zlib=yes
.endif

pre-patch:
	@${SETENV} ${SCRIPTS_ENV} ${SH} ${SCRIPTDIR}/configure.php

post-patch:
	@${SED} "s|%%PREFIX%%|${PREFIX}|g" \
		${WRKSRC}/pear/scripts/pearcmd.php > ${WRKSRC}/pear/scripts/pear

pre-configure:
.if defined(WITH_IMAP) && defined(WITH_RECODE)
	@${ECHO_CMD} "You cannot define WITH_IMAP *and* WITH_RECODE!"
	@${FALSE}
.endif
.if defined(WITH_IMAP) && defined(WITH_YAZ)
	@${ECHO_CMD} "You cannot define WITH_IMAP *and* WITH_YAZ!"
	@${FALSE}
.endif
.if defined(WITH_RECODE) && defined(WITH_YAZ)
	@${ECHO_CMD} "You cannot define WITH_RECODE *and* WITH_YAZ!"
	@${FALSE}
.endif
.if defined(WITH_SYBASEDB) && defined(WITH_SYBASECT)
	@${ECHO_CMD} "You cannot define WITH_SYBASEDB *and* WITH_SYBASECT!"
	@${FALSE}
.endif
.if defined(WITHOUT_CLI) && defined(WITHOUT_APACHE)
	@${ECHO_CMD} "You cannot define WITHOUT_CLI *and* WITHOUT_APACHE!"
	@${FALSE}
.endif
.if !defined(WITHOUT_CLI) && !defined(WITHOUT_APACHE)
	@${ECHO_CMD} ""
	@${ECHO_CMD} "You may use the following build options:"
	@${ECHO_CMD} ""
.if !defined(WITHOUT_CLI) && !defined(WITHOUT_APACHE)
	@${ECHO_CMD} "	WITHOUT_CLI=yes		Disable Command Line Interpreter"
	@${ECHO_CMD} "	WITHOUT_APACHE=yes	Disable Apache Module"
.endif
	@${ECHO_CMD} ""
.endif

post-build:
	@${ECHO_CMD} ""
	@${ECHO_CMD} "You may run the tests from the PHP test framework."
	@${ECHO_CMD} "You can do this by typing 'make test' now."
	@${ECHO_CMD} ""

test: all
	@(cd ${BUILD_WRKSRC}; ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} \
		${MAKEFILE} ${MAKE_ARGS} ${.TARGET})

post-install:
.if !defined(WITHOUT_CLI)
	@${INSTALL_SCRIPT} ${WRKSRC}/pear/scripts/pear ${PREFIX}/bin
.endif
	@${INSTALL_DATA} ${WRKSRC}/php.ini-dist ${PREFIX}/etc
	@${INSTALL_DATA} ${WRKSRC}/php.ini-recommended ${PREFIX}/etc
	@${TOUCH} ${PREFIX}/lib/php/${EXT_DIR}/.php
.if !defined(WITHOUT_APACHE)
	@${ECHO_CMD} "*****************************************************************************"
	@${ECHO_CMD} ""
	@${ECHO_CMD} "Make sure index.php is part of your DirectoryIndex."
	@${ECHO_CMD} ""
	@${ECHO_CMD} "You should add the following lines to your Apache configuration file:"
	@${ECHO_CMD} ""
	@${ECHO_CMD} "AddType application/x-httpd-php .php"
	@${ECHO_CMD} "AddType application/x-httpd-php-source .phps"
	@${ECHO_CMD} ""
	@${ECHO_CMD} "*****************************************************************************"
.endif

.include <bsd.port.post.mk>