5a9f11d3f1dc690b37c5502e092434cd8307623c
[packages.git] / lang / php5 / Makefile
1 #
2 # Copyright (C) 2006-2010 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=php
11 PKG_VERSION:=5.3.4
12 PKG_RELEASE:=1
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
15 PKG_SOURCE_URL:=http://www.php.net/distributions/
16 PKG_MD5SUM:=2c069d8f690933e3bf6a8741ed818150
17
18 PKG_FIXUP:=libtool no-autoreconf
19 PKG_BUILD_PARALLEL:=1 
20
21 include $(INCLUDE_DIR)/package.mk
22 include $(INCLUDE_DIR)/nls.mk
23
24 define Package/php5/Default
25   SUBMENU:=PHP
26   SECTION:=lang
27   CATEGORY:=Languages
28   TITLE:=PHP5 Hypertext preprocessor
29   URL:=http://www.php.net/
30 endef
31
32 define Package/php5/Default/description
33  PHP is a widely-used general-purpose scripting language that is especially 
34  suited for Web development and can be embedded into HTML.
35 endef
36
37 define Package/php5/config
38         config PHP5_APC
39                 bool "PHP5 APC support"
40                 depends on PACKAGE_php5-cli || PACKAGE_php5-cgi
41
42         config PHP5_FILTER
43                 bool "PHP5 Filter support"
44                 depends on PACKAGE_php5-cli || PACKAGE_php5-cgi
45
46         config PHP5_LIBXML
47                 bool "PHP5 LIBXML support"
48                 depends on PACKAGE_php5-cli || PACKAGE_php5-cgi
49
50         config PHP5_SYSVIPC
51                 bool "PHP5 Semaphore, Shared Memory and IPC support"
52                 depends on PACKAGE_php5-cli || PACKAGE_php5-cgi
53 endef
54
55 define Package/php5
56   $(call Package/php5/Default)
57   DEPENDS:=+libpcre +zlib
58   ifneq ($(CONFIG_PHP5_LIBXML),)
59     DEPENDS+= +libxml2
60   endif
61 endef
62
63 define Package/php5/description
64 $(call Package/php5/Default/description)
65  This package contains only the PHP config file. You must actually choose 
66  your PHP flavour (cli, cgi or fastcgi).
67 endef
68
69 define Package/php5-cli
70   $(call Package/php5/Default)
71   DEPENDS:=php5
72   TITLE+= (CLI)
73 endef
74
75 define Package/php5-cli/description
76 $(call Package/php5/Default/description)
77  This package contains the CLI version of the PHP5 interpreter.
78 endef
79
80 define Package/php5-cgi
81   $(call Package/php5/Default)
82   DEPENDS:=php5
83   TITLE+= (CGI & FastCGI)
84 endef
85
86 define Package/php5-cgi/description
87 $(call Package/php5/Default/description)
88  This package contains the CGI version of the PHP5 interpreter.
89 endef
90
91 define Package/php5-fastcgi
92   $(call Package/php5/Default)
93   DEPENDS:=php5 +php5-cgi
94   TITLE:=FastCGI startup script
95 endef
96
97 define Package/php5-cgi/description
98 As FastCGI support is now a core feature the php5-fastcgi package now depends
99 on the php5-cgi package, containing just the startup script.
100 endef
101
102 define Package/php5-mod-ctype
103   $(call Package/php5/Default)
104   DEPENDS:=php5
105   TITLE:=ctype shared module
106 endef
107 define Package/php5-mod-ctype/config
108   depends on PACKAGE_php5-cli || PACKAGE_php5-cgi
109 endef
110
111 define Package/php5-mod-curl
112   $(call Package/php5/Default)
113   DEPENDS:=php5 +libcurl
114   TITLE:=cURL shared module
115 endef
116 define Package/php5-mod-curl/config
117   depends on PACKAGE_php5-cli || PACKAGE_php5-cgi
118 endef
119
120 define Package/php5-mod-fileinfo
121   $(call Package/php5/Default)
122   DEPENDS:=php5 +libmagic
123   TITLE:=Fileinfo shared module
124 endef
125 define Package/php5-mod-fileinfo/config
126   depends on PACKAGE_php5-cli || PACKAGE_php5-cgi
127 endef
128
129 define Package/php5-mod-dom
130   $(call Package/php5/Default)
131   DEPENDS:=php5 +libxml2
132   TITLE:=DOM shared module
133 endef
134 define Package/php5-mod-dom/config
135   depends on PACKAGE_php5-cli || PACKAGE_php5-cgi
136   depends on PHP5_LIBXML
137 endef
138
139 define Package/php5-mod-exif
140   $(call Package/php5/Default)
141   DEPENDS:=php5
142   TITLE:=EXIF shared module
143 endef
144 define Package/php5-mod-exif/config
145   depends on PACKAGE_php5-cli || PACKAGE_php5-cgi
146 endef
147
148 define Package/php5-mod-ftp
149   $(call Package/php5/Default)
150   DEPENDS:=php5
151   TITLE:=FTP shared module
152 endef
153 define Package/php5-mod-ftp/config
154   depends on PACKAGE_php5-cli || PACKAGE_php5-cgi
155 endef
156
157 define Package/php5-mod-gd
158   $(call Package/php5/Default)
159   DEPENDS:=php5 +libgd
160   TITLE:=GD graphics shared module
161 endef
162 define Package/php5-mod-gd/config
163   depends on PACKAGE_php5-cli || PACKAGE_php5-cgi
164 endef
165
166 define Package/php5-mod-gmp
167   $(call Package/php5/Default)
168   DEPENDS:=php5 +libgmp
169   TITLE:=GMP shared module
170 endef
171 define Package/php5-mod-gmp/config
172   depends on PACKAGE_php5-cli || PACKAGE_php5-cgi
173 endef
174
175 define Package/php5-mod-hash
176   $(call Package/php5/Default)
177   DEPENDS:=php5
178   TITLE:=Hash shared module
179 endef
180 define Package/php5-mod-hash/config
181   depends on PACKAGE_php5-cli || PACKAGE_php5-cgi
182 endef
183
184 define Package/php5-mod-iconv
185   $(call Package/php5/Default)
186   DEPENDS:=php5 $(ICONV_DEPENDS)
187   TITLE:=iConv shared module
188 endef
189 define Package/php5-mod-iconv/config
190   depends on PACKAGE_php5-cli || PACKAGE_php5-cgi
191 endef
192
193 define Package/php5-mod-json
194   $(call Package/php5/Default)
195   DEPENDS:=php5
196   TITLE:=JSON shared module
197 endef
198 define Package/php5-mod-json/config
199   depends on PACKAGE_php5-cli || PACKAGE_php5-cgi
200 endef
201
202 define Package/php5-mod-ldap
203   $(call Package/php5/Default)
204   DEPENDS:=php5 +libopenldap +libsasl2
205   TITLE:=LDAP shared module
206 endef
207 define Package/php5-mod-ldap/config
208   depends on PACKAGE_php5-cli || PACKAGE_php5-cgi
209 endef
210
211 define Package/php5-mod-mbstring
212   $(call Package/php5/Default)
213   DEPENDS:=php5
214   TITLE:=MBString shared module
215 endef
216 define Package/php5-mod-mbstring/config
217   depends on PACKAGE_php5-cli || PACKAGE_php5-cgi
218 endef
219
220 define Package/php5-mod-mcrypt
221   $(call Package/php5/Default)
222   DEPENDS:=php5 +libmcrypt +libltdl
223   TITLE:=mcrypt shared module
224 endef
225 define Package/php5-mod-mcrypt/config
226   depends on PACKAGE_php5-cli || PACKAGE_php5-cgi
227 endef
228
229 define Package/php5-mod-mysql
230   $(call Package/php5/Default)
231   DEPENDS:=php5 +libmysqlclient
232   TITLE:=MySQL shared module
233 endef
234 define Package/php5-mod-mysql/config
235   depends on PACKAGE_php5-cli || PACKAGE_php5-cgi
236 endef
237
238 define Package/php5-mod-openssl
239   $(call Package/php5/Default)
240   DEPENDS:=php5 +libopenssl
241   TITLE:=OpenSSL shared module
242 endef
243 define Package/php5-mod-openssl/config
244   depends on PACKAGE_php5-cli || PACKAGE_php5-cgi
245 endef
246
247 define Package/php5-mod-pdo
248   $(call Package/php5/Default)
249   DEPENDS:=php5
250   TITLE:=PHP Data Objects shared module
251 endef
252 define Package/php5-mod-pdo/config
253   depends on PACKAGE_php5-cli || PACKAGE_php5-cgi
254 endef
255
256 define Package/php5-mod-pdo-mysql
257   $(call Package/php5/Default)
258   DEPENDS:=php5-mod-pdo +libmysqlclient
259   TITLE:=PDO driver for MySQL
260 endef
261
262 define Package/php5-mod-pdo-pgsql
263   $(call Package/php5/Default)
264   DEPENDS:=php5-mod-pdo +libpq
265   TITLE:=PDO driver for PostgreSQL
266 endef
267
268 define Package/php5-mod-pdo-sqlite
269   $(call Package/php5/Default)
270   DEPENDS:=php5-mod-pdo +libsqlite3 +libpthread
271   TITLE:=PDO driver for SQLite (3.x)
272 endef
273
274 define Package/php5-mod-pgsql
275   $(call Package/php5/Default)
276   DEPENDS:=php5 +libpq
277   TITLE:=PostgreSQL shared module
278 endef
279 define Package/php5-mod-pgsql/config
280   depends on PACKAGE_php5-cli || PACKAGE_php5-cgi
281 endef
282
283 define Package/php5-mod-session
284   $(call Package/php5/Default)
285   DEPENDS:=php5
286   TITLE:=Session shared module
287 endef
288 define Package/php5-mod-session/config
289   depends on PACKAGE_php5-cli || PACKAGE_php5-cgi
290 endef
291
292 define Package/php5-mod-soap
293   $(call Package/php5/Default)
294   DEPENDS:=php5 +libxml2
295   TITLE:=SOAP shared module
296 endef
297 define Package/php5-mod-soap/config
298   depends on PACKAGE_php5-cli || PACKAGE_php5-cgi
299   depends on PHP5_LIBXML
300 endef
301
302 define Package/php5-mod-sockets
303   $(call Package/php5/Default)
304   DEPENDS:=php5
305   TITLE:=Sockets shared module
306 endef
307 define Package/php5-mod-sockets/config
308   depends on PACKAGE_php5-cli || PACKAGE_php5-cgi
309 endef
310
311 define Package/php5-mod-sqlite
312   $(call Package/php5/Default)
313   DEPENDS:=php5 +libsqlite2
314   TITLE:=SQLite shared module (2.x)
315 endef
316 define Package/php5-mod-sqlite/config
317   depends on PACKAGE_php5-cli || PACKAGE_php5-cgi
318 endef
319
320 define Package/php5-mod-sqlite3
321   $(call Package/php5/Default)
322   DEPENDS:=php5 +libsqlite3 +libpthread
323   TITLE:=SQLite3 shared module (3.x)
324 endef
325 define Package/php5-mod-sqlite3/config
326   depends on PACKAGE_php5-cli || PACKAGE_php5-cgi
327 endef
328
329 define Package/php5-mod-tokenizer
330   $(call Package/php5/Default)
331   DEPENDS:=php5
332   TITLE:=Tokenizer shared module
333 endef
334 define Package/php5-mod-tokenizer/config
335   depends on PACKAGE_php5-cli || PACKAGE_php5-cgi
336 endef
337
338 define Package/php5-mod-xml
339   $(call Package/php5/Default)
340   DEPENDS:=php5
341   ifneq ($(CONFIG_PHP5_LIBXML),)
342     DEPENDS+= +libxml2
343   else
344     DEPENDS+= +libexpat
345   endif
346   TITLE:=XML shared module
347 endef
348 define Package/php5-mod-xml/config
349   depends on PACKAGE_php5-cli || PACKAGE_php5-cgi
350 endef
351
352 define Package/php5-mod-xmlreader
353   $(call Package/php5/Default)
354   DEPENDS:=php5 +libxml2 $(ICONV_DEPENDS)
355   TITLE:=XMLReader shared module
356 endef
357 define Package/php5-mod-xmlreader/config
358   depends on PACKAGE_php5-cli || PACKAGE_php5-cgi
359   depends on PHP5_LIBXML
360 endef
361
362 define Package/php5-mod-xmlwriter
363   $(call Package/php5/Default)
364   DEPENDS:=php5 +libxml2 $(ICONV_DEPENDS)
365   TITLE:=XMLWriter shared module
366 endef
367   define Package/php5-mod-xmlwriter/config
368   depends on PACKAGE_php5-cli || PACKAGE_php5-cgi
369   depends on PHP5_LIBXML
370 endef
371
372 CONFIGURE_VARS += \
373         ac_cv_c_bigendian_php=$(if $(CONFIG_BIG_ENDIAN),yes,no)
374
375 PKG_CONFIGURE_OPTS:= \
376         --enable-shared \
377         --disable-static \
378         --disable-rpath \
379         --disable-debug \
380         --without-pear \
381         \
382         --with-config-file-path=/etc \
383         --enable-magic-quotes \
384         --disable-short-tags \
385         \
386         --without-gettext \
387         --disable-simplexml \
388         --with-zlib="$(STAGING_DIR)/usr" \
389           --with-zlib-dir="$(STAGING_DIR)/usr" \
390         --with-pcre-regex="$(STAGING_DIR)/usr" \
391         --disable-phar
392
393 ifneq ($(SDK),)
394   PKG_BUILD_DEPENDS+=libopenssl zlib libcurl libgd libgmp libopenldap libmysqlclient libpq libsqlite2 libpthread libsqlite3 libpcre libxml2
395 # force PKG_CONFIGURE_{LIBS,OPTS} below when built in the SDK
396   CONFIG_PACKAGE_php5-cli:=m
397   CONFIG_PACKAGE_php5-cgi:=m
398   CONFIG_PACKAGE_php5-fastcgi:=m
399   CONFIG_PACKAGE_php5-mod-curl:=m
400   CONFIG_PACKAGE_php5-mod-gd:=m
401   CONFIG_PACKAGE_php5-mod-gmp:=m
402   CONFIG_PACKAGE_php5-mod-ldap:=m
403   CONFIG_PACKAGE_php5-mod-mysql:=m
404   CONFIG_PACKAGE_php5-mod-pgsql:=m
405   CONFIG_PACKAGE_php5-mod-sqlite:=m
406   CONFIG_PACKAGE_php5-mod-sqlite3:=m
407   CONFIG_PACKAGE_php5-mod-xml:=m
408 endif
409
410 ifneq ($(CONFIG_PACKAGE_php5-mod-ctype),)
411   PKG_CONFIGURE_OPTS+= --enable-ctype=shared
412 else
413   PKG_CONFIGURE_OPTS+= --disable-ctype
414 endif
415
416 ifneq ($(CONFIG_PACKAGE_php5-mod-curl),)
417   PKG_CONFIGURE_OPTS+= --with-curl=shared,"$(STAGING_DIR)/usr"
418 else
419   PKG_CONFIGURE_OPTS+= --without-curl
420 endif
421
422 ifneq ($(CONFIG_PACKAGE_php5-mod-fileinfo),)
423   PKG_CONFIGURE_OPTS+= --enable-fileinfo=shared
424 else
425   PKG_CONFIGURE_OPTS+= --disable-fileinfo
426 endif
427
428 ifneq ($(CONFIG_PACKAGE_php5-mod-dom),)
429   PKG_CONFIGURE_OPTS+= --enable-dom=shared
430 else
431   PKG_CONFIGURE_OPTS+= --disable-dom
432 endif
433
434 ifneq ($(CONFIG_PACKAGE_php5-mod-exif),)
435   PKG_CONFIGURE_OPTS+= --enable-exif=shared
436 else
437   PKG_CONFIGURE_OPTS+= --disable-exif
438 endif
439
440 ifneq ($(CONFIG_PACKAGE_php5-mod-ftp),)
441   PKG_CONFIGURE_OPTS+= --enable-ftp=shared
442 else
443   PKG_CONFIGURE_OPTS+= --disable-ftp
444 endif
445
446 ifneq ($(CONFIG_PACKAGE_php5-mod-gd),)
447   PKG_CONFIGURE_OPTS+= --with-gd=shared,"$(STAGING_DIR)/usr" \
448         --without-freetype-dir \
449         --with-jpeg-dir="$(STAGING_DIR)/usr" \
450         --with-png-dir="$(STAGING_DIR)/usr" \
451         --without-xpm-dir \
452         --without-ttf \
453         --without-t1lib \
454         --enable-gd-native-ttf \
455         --disable-gd-jis-conv
456 else
457   PKG_CONFIGURE_OPTS+= --without-gd
458 endif
459
460 ifneq ($(CONFIG_PACKAGE_php5-mod-gmp),)
461   PKG_CONFIGURE_OPTS+= --with-gmp=shared,"$(STAGING_DIR)/usr"
462 else
463   PKG_CONFIGURE_OPTS+= --without-gmp
464 endif
465
466 ifneq ($(CONFIG_PACKAGE_php5-mod-hash),)
467   PKG_CONFIGURE_OPTS+= --enable-hash=shared
468 else
469   PKG_CONFIGURE_OPTS+= --disable-hash
470 endif
471
472 ifneq ($(CONFIG_PACKAGE_php5-mod-iconv),)
473   PKG_CONFIGURE_OPTS+= --with-iconv=shared,"$(ICONV_PREFIX)"
474 else
475   PKG_CONFIGURE_OPTS+= --without-iconv
476 endif
477
478 ifneq ($(CONFIG_PACKAGE_php5-mod-json),)
479   PKG_CONFIGURE_OPTS+= --enable-json=shared
480 else
481   PKG_CONFIGURE_OPTS+= --disable-json
482 endif
483
484 ifneq ($(CONFIG_PACKAGE_php5-mod-ldap),)
485   PKG_CONFIGURE_OPTS+= --with-ldap=shared,"$(STAGING_DIR)/usr" \
486         --with-ldap-sasl="$(STAGING_DIR)/usr"
487 else
488   PKG_CONFIGURE_OPTS+= --without-ldap
489 endif
490
491 ifneq ($(CONFIG_PACKAGE_php5-mod-mbstring),)
492   PKG_CONFIGURE_OPTS+= --enable-mbstring=shared --enable-mbregex
493 else
494   PKG_CONFIGURE_OPTS+= --disable-mbstring
495 endif
496
497 ifneq ($(CONFIG_PACKAGE_php5-mod-mcrypt),)
498   PKG_CONFIGURE_OPTS+=  --with-mcrypt=shared,"$(STAGING_DIR)/usr"
499 else
500   PKG_CONFIGURE_OPTS+= --without-mcrypt
501 endif
502
503 ifneq ($(CONFIG_PACKAGE_php5-mod-mysql),)
504   PKG_CONFIGURE_OPTS+= --with-mysql=shared,"$(STAGING_DIR)/usr"
505 else
506   PKG_CONFIGURE_OPTS+= --without-mysql
507 endif
508
509 ifneq ($(CONFIG_PACKAGE_php5-mod-openssl),)
510   PKG_CONFIGURE_OPTS+= --with-openssl=shared,"$(STAGING_DIR)/usr"
511   PKG_CONFIGURE_OPTS+= --with-kerberos=no
512   PKG_CONFIGURE_OPTS+= --with-openssl-dir="$(STAGING_DIR)/usr"
513 else
514   PKG_CONFIGURE_OPTS+= --without-openssl
515 endif
516
517 ifneq ($(CONFIG_PACKAGE_php5-mod-pdo),)
518   PKG_CONFIGURE_OPTS+= --enable-pdo=shared
519   ifneq ($(CONFIG_PACKAGE_php5-mod-pdo-mysql),)
520     PKG_CONFIGURE_OPTS+= --with-pdo-mysql=shared,"$(STAGING_DIR)/usr"
521   else
522     PKG_CONFIGURE_OPTS+= --without-pdo-mysql
523   endif
524   ifneq ($(CONFIG_PACKAGE_php5-mod-pdo-pgsql),)
525     PKG_CONFIGURE_OPTS+= --with-pdo-pgsql=shared,"$(STAGING_DIR)/usr"
526   else
527     PKG_CONFIGURE_OPTS+= --without-pdo-pgsql
528   endif
529   ifneq ($(CONFIG_PACKAGE_php5-mod-pdo-sqlite),)
530     PKG_CONFIGURE_OPTS+= --with-pdo-sqlite=shared,"$(STAGING_DIR)/usr"
531     PKG_CONFIGURE_LIBS+= -lsqlite3 -lpthread
532   else
533     PKG_CONFIGURE_OPTS+= --without-pdo-sqlite
534   endif
535 else
536   PKG_CONFIGURE_OPTS+= --disable-pdo
537 endif
538
539 ifneq ($(CONFIG_PACKAGE_php5-mod-pgsql),)
540   PKG_CONFIGURE_OPTS+= --with-pgsql=shared,"$(STAGING_DIR)/usr"
541 else
542   PKG_CONFIGURE_OPTS+= --without-pgsql
543 endif
544
545 ifneq ($(CONFIG_PACKAGE_php5-mod-session),)
546   PKG_CONFIGURE_OPTS+= --enable-session=shared
547 else
548   PKG_CONFIGURE_OPTS+= --disable-session
549 endif
550
551 ifneq ($(CONFIG_PACKAGE_php5-mod-soap),)
552   PKG_CONFIGURE_OPTS+= --enable-soap=shared
553 else
554   PKG_CONFIGURE_OPTS+= --disable-soap
555 endif
556
557 ifneq ($(CONFIG_PACKAGE_php5-mod-sockets),)
558   PKG_CONFIGURE_OPTS+= --enable-sockets=shared
559 else
560   PKG_CONFIGURE_OPTS+= --disable-sockets
561 endif
562
563 ifneq ($(CONFIG_PACKAGE_php5-mod-sqlite),)
564   PKG_CONFIGURE_OPTS+= --with-sqlite=shared,"$(STAGING_DIR)/usr"
565 else
566   PKG_CONFIGURE_OPTS+= --without-sqlite
567 endif
568
569 ifneq ($(CONFIG_PACKAGE_php5-mod-sqlite3),)
570   PKG_CONFIGURE_OPTS+= --with-sqlite3=shared,"$(STAGING_DIR)/usr"
571   PKG_CONFIGURE_LIBS+= -lsqlite3 -lpthread
572 else
573   PKG_CONFIGURE_OPTS+= --without-sqlite3
574 endif
575
576 ifneq ($(CONFIG_PACKAGE_php5-mod-tokenizer),)
577   PKG_CONFIGURE_OPTS+= --enable-tokenizer=shared
578 else
579   PKG_CONFIGURE_OPTS+= --disable-tokenizer
580 endif
581
582 ifneq ($(CONFIG_PACKAGE_php5-mod-xml),)
583   PKG_CONFIGURE_OPTS+= --enable-xml=shared,"$(STAGING_DIR)/usr"
584   ifneq ($(CONFIG_PHP5_LIBXML),)
585     PKG_CONFIGURE_OPTS+= --with-libxml-dir="$(STAGING_DIR)/usr/include/libxml2"
586   else
587     PKG_CONFIGURE_OPTS+= --with-libexpat-dir="$(STAGING_DIR)/usr"
588   endif
589 else
590   PKG_CONFIGURE_OPTS+= --disable-xml
591 endif
592
593 ifneq ($(CONFIG_PACKAGE_php5-mod-xmlreader),)
594   PKG_CONFIGURE_OPTS+= --enable-xmlreader=shared,"$(STAGING_DIR)/usr"
595 else
596   PKG_CONFIGURE_OPTS+= --disable-xmlreader
597 endif
598
599 ifneq ($(CONFIG_PACKAGE_php5-mod-xmlwriter),)
600   PKG_CONFIGURE_OPTS+= --enable-xmlwriter=shared,"$(STAGING_DIR)/usr"
601 else
602   PKG_CONFIGURE_OPTS+= --disable-xmlwriter
603 endif
604
605 ifneq ($(CONFIG_PHP5_APC),)
606   PKG_CONFIGURE_OPTS+= --enable-apc --disable-apc-mmap --disable-apc-pthreadmutex
607   PKG_CONFIGURE_LIBS+= -lrt
608 else
609   PKG_CONFIGURE_OPTS+= --disable-apc
610 endif
611
612 ifneq ($(CONFIG_PHP5_FILTER),)
613   PKG_CONFIGURE_OPTS+= --enable-filter
614 else
615   PKG_CONFIGURE_OPTS+= --disable-filter
616 endif
617
618 ifneq ($(CONFIG_PHP5_LIBXML),)
619   PKG_CONFIGURE_OPTS+= --enable-libxml
620   PKG_CONFIGURE_OPTS+= --with-libxml-dir="$(STAGING_DIR)/usr/include/libxml2"
621 else
622   PKG_CONFIGURE_OPTS+= --disable-libxml
623 endif
624
625 ifneq ($(CONFIG_PHP5_SYSVIPC),)
626   PKG_CONFIGURE_OPTS+= --enable-sysvsem --enable-sysvshm --enable-sysvmsg
627 else
628   PKG_CONFIGURE_OPTS+= --disable-sysvsem --disable-sysvshm --disable-sysvmsg
629 endif
630
631 define Build/Configure
632 endef
633
634 ifneq ($(CONFIG_PACKAGE_php5-cli),)
635   define Build/Compile/php5-cli
636         -$(MAKE) -C $(PKG_BUILD_DIR) clean
637         $(call Build/Configure/Default, \
638                 $(PKG_CONFIGURE_OPTS) \
639                 --enable-cli \
640                 --disable-cgi \
641                 , \
642                 LIBS="$(PKG_CONFIGURE_LIBS)" \
643                 php_cv_cc_rpath="no" \
644                 iconv_impl_name="gnu_libiconv" \
645                 ac_cv_php_xml2_config_path="$(STAGING_DIR)/host/bin/xml2-config" \
646         )
647         $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)
648         mv $(PKG_BUILD_DIR)/sapi/cli/php $(PKG_BUILD_DIR)/php-cli
649   endef
650 endif
651
652 ifneq ($(CONFIG_PACKAGE_php5-cgi),)
653   define Build/Compile/php5-cgi
654         -$(MAKE) -C $(PKG_BUILD_DIR) clean
655         $(call Build/Configure/Default, \
656                 $(PKG_CONFIGURE_OPTS) \
657                 --disable-cli \
658                 --enable-cgi \
659                 , \
660                 LIBS="$(PKG_CONFIGURE_LIBS)" \
661                 php_cv_cc_rpath="no" \
662                 iconv_impl_name="gnu_libiconv" \
663                 ac_cv_php_xml2_config_path="$(STAGING_DIR)/host/bin/xml2-config" \
664         )
665         $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)
666         mv $(PKG_BUILD_DIR)/sapi/cgi/php-cgi $(PKG_BUILD_DIR)/php-cgi
667   endef
668 endif
669
670 define Build/Compile
671         $(call Build/Compile/php5-cli)
672         $(call Build/Compile/php5-cgi)
673 endef
674
675 define Package/php5/conffiles
676 /etc/php.ini
677 endef
678
679 define Package/php5/install
680         $(INSTALL_DIR) $(1)/etc
681         $(INSTALL_DATA) ./files/php.ini $(1)/etc/
682 endef
683
684 define Package/php5-cli/install
685         $(INSTALL_DIR) $(1)/usr/bin
686         $(CP) $(PKG_BUILD_DIR)/php-cli $(1)/usr/bin/php-cli
687 endef
688
689 define Package/php5-cgi/install
690         $(INSTALL_DIR) $(1)/usr/bin
691         $(CP) $(PKG_BUILD_DIR)/php-cgi $(1)/usr/bin/php-cgi
692         ln -sf php-cgi $(1)/usr/bin/php-fcgi
693 endef
694
695 define Package/php5-fastcgi/install
696         $(INSTALL_DIR) $(1)/etc/init.d
697         $(INSTALL_BIN) ./files/php.init $(1)/etc/init.d/php
698 endef
699
700 define BuildPlugin
701   define Package/$(1)/install
702         [ -z "$(2)" ] || $(INSTALL_DIR) $$(1)/usr/lib/php
703         for m in $(2); do \
704                 [ -z "$(CONFIG_PACKAGE_$(1))" ] \
705                          || $(INSTALL_BIN) $(PKG_BUILD_DIR)/modules/$$$$$$$${m}.so $$(1)/usr/lib/php/ ; \
706         done
707   endef
708
709   $$(eval $$(call BuildPackage,$(1)))
710 endef
711
712 $(eval $(call BuildPackage,php5))
713 $(eval $(call BuildPackage,php5-cli))
714 $(eval $(call BuildPackage,php5-cgi))
715 $(eval $(call BuildPackage,php5-fastcgi))
716 $(eval $(call BuildPlugin,php5-mod-ctype,ctype))
717 $(eval $(call BuildPlugin,php5-mod-curl,curl))
718 $(eval $(call BuildPlugin,php5-mod-fileinfo,fileinfo))
719 $(eval $(call BuildPlugin,php5-mod-dom,dom))
720 $(eval $(call BuildPlugin,php5-mod-exif,exif))
721 $(eval $(call BuildPlugin,php5-mod-ftp,ftp))
722 $(eval $(call BuildPlugin,php5-mod-gd,gd))
723 $(eval $(call BuildPlugin,php5-mod-gmp,gmp))
724 $(eval $(call BuildPlugin,php5-mod-hash,hash))
725 $(eval $(call BuildPlugin,php5-mod-iconv,iconv))
726 $(eval $(call BuildPlugin,php5-mod-json,json))
727 $(eval $(call BuildPlugin,php5-mod-ldap,ldap))
728 $(eval $(call BuildPlugin,php5-mod-mbstring,mbstring))
729 $(eval $(call BuildPlugin,php5-mod-mcrypt,mcrypt))
730 $(eval $(call BuildPlugin,php5-mod-mysql,mysql))
731 $(eval $(call BuildPlugin,php5-mod-openssl,openssl))
732 $(eval $(call BuildPlugin,php5-mod-pdo,pdo))
733 $(eval $(call BuildPlugin,php5-mod-pdo-mysql,pdo_mysql))
734 $(eval $(call BuildPlugin,php5-mod-pdo-pgsql,pdo_pgsql))
735 $(eval $(call BuildPlugin,php5-mod-pdo-sqlite,pdo_sqlite))
736 $(eval $(call BuildPlugin,php5-mod-pgsql,pgsql))
737 $(eval $(call BuildPlugin,php5-mod-session,session))
738 $(eval $(call BuildPlugin,php5-mod-soap,soap))
739 $(eval $(call BuildPlugin,php5-mod-sockets,sockets))
740 $(eval $(call BuildPlugin,php5-mod-sqlite,sqlite))
741 $(eval $(call BuildPlugin,php5-mod-sqlite3,sqlite3))
742 $(eval $(call BuildPlugin,php5-mod-tokenizer,tokenizer))
743 $(eval $(call BuildPlugin,php5-mod-xml,xml))
744 $(eval $(call BuildPlugin,php5-mod-xmlreader,xmlreader))
745 $(eval $(call BuildPlugin,php5-mod-xmlwriter,xmlwriter))