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