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