2 # Copyright (C) 2006-2011 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 include $(TOPDIR)/rules.mk
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
15 PKG_SOURCE_URL:=http://www.php.net/distributions/
16 PKG_MD5SUM:=704cd414a0565d905e1074ffdc1fadfb
18 PKG_FIXUP:=libtool no-autoreconf
33 mbstring mcrypt mysql \
35 pcntl pdo pdo-mysql pdo-pgsql pdo-sqlite pgsql \
36 session simplexml soap sockets sqlite sqlite3 sysvmsg sysvsem sysvshm \
38 xml xmlreader xmlwriter \
40 PKG_CONFIG_DEPENDS:= \
41 CONFIG_PACKAGE_php5-cgi CONFIG_PACKAGE_php5-cli \
42 $(patsubst %,CONFIG_PACKAGE_php5-mod-%,$(PHP5_MODULES)) \
43 CONFIG_PHP5_FILTER CONFIG_PHP5_LIBXML
45 include $(INCLUDE_DIR)/package.mk
46 include $(INCLUDE_DIR)/nls.mk
48 define Package/php5/Default
52 TITLE:=PHP5 Hypertext preprocessor
53 URL:=http://www.php.net/
54 MAINTAINER:=Michael Heimpold <mhei@heimpold.de>
58 define Package/php5/Default/description
59 PHP is a widely-used general-purpose scripting language that is especially
60 suited for Web development and can be embedded into HTML.
63 define Package/php5/config
65 bool "PHP5 Filter support"
66 depends on PACKAGE_php5-cli || PACKAGE_php5-cgi
69 bool "PHP5 LIBXML support"
70 depends on PACKAGE_php5-cli || PACKAGE_php5-cgi
74 $(call Package/php5/Default)
76 DEPENDS:=+libpcre +zlib \
80 define Package/php5/description
81 $(call Package/php5/Default/description)
82 This package contains only the PHP config file. You must actually choose
83 your PHP flavour (cli, cgi or fastcgi).
86 define Package/php5-cli
87 $(call Package/php5/Default)
91 define Package/php5-cli/description
92 $(call Package/php5/Default/description)
93 This package contains the CLI version of the PHP5 interpreter.
96 define Package/php5-cgi
97 $(call Package/php5/Default)
98 TITLE+= (CGI & FastCGI)
101 define Package/php5-cgi/description
102 $(call Package/php5/Default/description)
103 This package contains the CGI version of the PHP5 interpreter.
106 define Package/php5-fastcgi
107 $(call Package/php5/Default)
109 TITLE:=FastCGI startup script
112 define Package/php5-fastcgi/description
113 As FastCGI support is now a core feature the php5-fastcgi package now depends
114 on the php5-cgi package, containing just the startup script.
124 --with-config-file-path=/etc \
125 --with-config-file-scan-dir=/etc/php5 \
126 --enable-magic-quotes \
127 --disable-short-tags \
129 --with-zlib="$(STAGING_DIR)/usr" \
130 --with-zlib-dir="$(STAGING_DIR)/usr" \
131 --with-pcre-regex="$(STAGING_DIR)/usr" \
135 PKG_BUILD_DEPENDS+=libopenssl zlib libcurl libgd libgmp libopenldap libmysqlclient libpq libsqlite2 libpthread libsqlite3 libpcre libxml2
136 # force PKG_CONFIGURE_{LIBS,OPTS} below when built in the SDK
137 CONFIG_PACKAGE_php5-cli:=m
138 CONFIG_PACKAGE_php5-cgi:=m
139 CONFIG_PACKAGE_php5-fastcgi:=m
140 CONFIG_PACKAGE_php5-mod-curl:=m
141 CONFIG_PACKAGE_php5-mod-gd:=m
142 CONFIG_PACKAGE_php5-mod-gmp:=m
143 CONFIG_PACKAGE_php5-mod-ldap:=m
144 CONFIG_PACKAGE_php5-mod-mysql:=m
145 CONFIG_PACKAGE_php5-mod-pgsql:=m
146 CONFIG_PACKAGE_php5-mod-sqlite:=m
147 CONFIG_PACKAGE_php5-mod-sqlite3:=m
148 CONFIG_PACKAGE_php5-mod-xml:=m
151 ifneq ($(CONFIG_PACKAGE_php5-cli),)
152 CONFIGURE_ARGS+= --enable-cli
154 CONFIGURE_ARGS+= --disable-cli
157 ifneq ($(CONFIG_PACKAGE_php5-cgi),)
158 CONFIGURE_ARGS+= --enable-cgi
160 CONFIGURE_ARGS+= --disable-cgi
163 ifneq ($(CONFIG_PACKAGE_php5-mod-apc),)
164 CONFIGURE_ARGS+= --enable-apc=shared --disable-apc-mmap --disable-apc-pthreadmutex
166 CONFIGURE_ARGS+= --disable-apc
169 ifneq ($(CONFIG_PACKAGE_php5-mod-ctype),)
170 CONFIGURE_ARGS+= --enable-ctype=shared
172 CONFIGURE_ARGS+= --disable-ctype
175 ifneq ($(CONFIG_PACKAGE_php5-mod-curl),)
176 CONFIGURE_ARGS+= --with-curl=shared,"$(STAGING_DIR)/usr"
178 CONFIGURE_ARGS+= --without-curl
181 ifneq ($(CONFIG_PACKAGE_php5-mod-fileinfo),)
182 CONFIGURE_ARGS+= --enable-fileinfo=shared
184 CONFIGURE_ARGS+= --disable-fileinfo
187 ifneq ($(CONFIG_PACKAGE_php5-mod-gettext),)
188 CONFIGURE_ARGS+= --with-gettext=shared,"$(STAGING_DIR)/usr/lib/libintl-full"
190 CONFIGURE_ARGS+= --without-gettext
193 ifneq ($(CONFIG_PACKAGE_php5-mod-dio),)
194 CONFIGURE_ARGS+= --enable-dio=shared
196 CONFIGURE_ARGS+= --disable-dio
199 ifneq ($(CONFIG_PACKAGE_php5-mod-dom),)
200 CONFIGURE_ARGS+= --enable-dom=shared
202 CONFIGURE_ARGS+= --disable-dom
205 ifneq ($(CONFIG_PACKAGE_php5-mod-exif),)
206 CONFIGURE_ARGS+= --enable-exif=shared
208 CONFIGURE_ARGS+= --disable-exif
211 ifneq ($(CONFIG_PACKAGE_php5-mod-ftp),)
212 CONFIGURE_ARGS+= --enable-ftp=shared
214 CONFIGURE_ARGS+= --disable-ftp
217 ifneq ($(CONFIG_PACKAGE_php5-mod-gd),)
219 --with-gd=shared,"$(STAGING_DIR)/usr" \
220 --without-freetype-dir \
221 --with-jpeg-dir="$(STAGING_DIR)/usr" \
222 --with-png-dir="$(STAGING_DIR)/usr" \
225 --enable-gd-native-ttf \
226 --disable-gd-jis-conv
228 CONFIGURE_ARGS+= --without-gd
231 ifneq ($(CONFIG_PACKAGE_php5-mod-gmp),)
232 CONFIGURE_ARGS+= --with-gmp=shared,"$(STAGING_DIR)/usr"
234 CONFIGURE_ARGS+= --without-gmp
237 ifneq ($(CONFIG_PACKAGE_php5-mod-hash),)
238 CONFIGURE_ARGS+= --enable-hash=shared
240 CONFIGURE_ARGS+= --disable-hash
243 ifneq ($(CONFIG_PACKAGE_php5-mod-http),)
245 --enable-http=shared \
246 --without-http-shared-deps \
247 --with-http-curl-requests="$(STAGING_DIR)/usr"
249 CONFIGURE_ARGS+= --disable-http
252 ifneq ($(CONFIG_PACKAGE_php5-mod-iconv),)
253 CONFIGURE_ARGS+= --with-iconv=shared,"$(ICONV_PREFIX)"
255 CONFIGURE_ARGS+= --without-iconv
258 ifneq ($(CONFIG_PACKAGE_php5-mod-json),)
259 CONFIGURE_ARGS+= --enable-json=shared
261 CONFIGURE_ARGS+= --disable-json
264 ifneq ($(CONFIG_PACKAGE_php5-mod-ldap),)
266 --with-ldap=shared,"$(STAGING_DIR)/usr" \
267 --with-ldap-sasl="$(STAGING_DIR)/usr"
269 CONFIGURE_ARGS+= --without-ldap
272 ifneq ($(CONFIG_PACKAGE_php5-mod-libevent),)
273 CONFIGURE_ARGS+= --with-libevent=shared,"$(STAGING_DIR)/usr"
275 CONFIGURE_ARGS+= --without-libevent
278 ifneq ($(CONFIG_PACKAGE_php5-mod-mbstring),)
279 CONFIGURE_ARGS+= --enable-mbstring=shared --enable-mbregex
281 CONFIGURE_ARGS+= --disable-mbstring
284 ifneq ($(CONFIG_PACKAGE_php5-mod-mcrypt),)
285 CONFIGURE_ARGS+= --with-mcrypt=shared,"$(STAGING_DIR)/usr"
287 CONFIGURE_ARGS+= --without-mcrypt
290 ifneq ($(CONFIG_PACKAGE_php5-mod-mysql),)
291 CONFIGURE_ARGS+= --with-mysql=shared,"$(STAGING_DIR)/usr"
293 CONFIGURE_ARGS+= --without-mysql
296 ifneq ($(CONFIG_PACKAGE_php5-mod-openssl),)
298 --with-openssl=shared,"$(STAGING_DIR)/usr" \
300 --with-openssl-dir="$(STAGING_DIR)/usr"
302 CONFIGURE_ARGS+= --without-openssl
305 ifneq ($(CONFIG_PACKAGE_php5-mod-pcntl),)
306 CONFIGURE_ARGS+= --enable-pcntl=shared
308 CONFIGURE_ARGS+= --disable-pcntl
311 ifneq ($(CONFIG_PACKAGE_php5-mod-pdo),)
312 CONFIGURE_ARGS+= --enable-pdo=shared
313 ifneq ($(CONFIG_PACKAGE_php5-mod-pdo-mysql),)
314 CONFIGURE_ARGS+= --with-pdo-mysql=shared,"$(STAGING_DIR)/usr"
316 CONFIGURE_ARGS+= --without-pdo-mysql
318 ifneq ($(CONFIG_PACKAGE_php5-mod-pdo-pgsql),)
319 CONFIGURE_ARGS+= --with-pdo-pgsql=shared,"$(STAGING_DIR)/usr"
321 CONFIGURE_ARGS+= --without-pdo-pgsql
323 ifneq ($(CONFIG_PACKAGE_php5-mod-pdo-sqlite),)
324 CONFIGURE_ARGS+= --with-pdo-sqlite=shared,"$(STAGING_DIR)/usr"
326 CONFIGURE_ARGS+= --without-pdo-sqlite
329 CONFIGURE_ARGS+= --disable-pdo
332 ifneq ($(CONFIG_PACKAGE_php5-mod-pgsql),)
333 CONFIGURE_ARGS+= --with-pgsql=shared,"$(STAGING_DIR)/usr"
335 CONFIGURE_ARGS+= --without-pgsql
338 ifneq ($(CONFIG_PACKAGE_php5-mod-session),)
339 CONFIGURE_ARGS+= --enable-session=shared
341 CONFIGURE_ARGS+= --disable-session
344 ifneq ($(CONFIG_PACKAGE_php5-mod-simplexml),)
345 CONFIGURE_ARGS+= --enable-simplexml=shared
347 CONFIGURE_ARGS+= --disable-simplexml
350 ifneq ($(CONFIG_PACKAGE_php5-mod-soap),)
351 CONFIGURE_ARGS+= --enable-soap=shared
353 CONFIGURE_ARGS+= --disable-soap
356 ifneq ($(CONFIG_PACKAGE_php5-mod-sockets),)
357 CONFIGURE_ARGS+= --enable-sockets=shared
359 CONFIGURE_ARGS+= --disable-sockets
362 ifneq ($(CONFIG_PACKAGE_php5-mod-sqlite),)
363 CONFIGURE_ARGS+= --with-sqlite=shared,"$(STAGING_DIR)/usr"
365 CONFIGURE_ARGS+= --without-sqlite
368 ifneq ($(CONFIG_PACKAGE_php5-mod-sqlite3),)
369 CONFIGURE_ARGS+= --with-sqlite3=shared,"$(STAGING_DIR)/usr"
371 CONFIGURE_ARGS+= --without-sqlite3
374 ifneq ($(CONFIG_PACKAGE_php5-mod-sysvmsg),)
375 CONFIGURE_ARGS+= --enable-sysvmsg=shared
377 CONFIGURE_ARGS+= --disable-sysvmsg
380 ifneq ($(CONFIG_PACKAGE_php5-mod-sysvsem),)
381 CONFIGURE_ARGS+= --enable-sysvsem=shared
383 CONFIGURE_ARGS+= --disable-sysvsem
386 ifneq ($(CONFIG_PACKAGE_php5-mod-sysvshm),)
387 CONFIGURE_ARGS+= --enable-sysvshm=shared
389 CONFIGURE_ARGS+= --disable-sysvshm
392 ifneq ($(CONFIG_PACKAGE_php5-mod-tokenizer),)
393 CONFIGURE_ARGS+= --enable-tokenizer=shared
395 CONFIGURE_ARGS+= --disable-tokenizer
398 ifneq ($(CONFIG_PACKAGE_php5-mod-xml),)
399 CONFIGURE_ARGS+= --enable-xml=shared,"$(STAGING_DIR)/usr"
400 ifneq ($(CONFIG_PHP5_LIBXML),)
401 CONFIGURE_ARGS+= --with-libxml-dir="$(STAGING_DIR)/usr/include/libxml2"
403 CONFIGURE_ARGS+= --with-libexpat-dir="$(STAGING_DIR)/usr"
406 CONFIGURE_ARGS+= --disable-xml
409 ifneq ($(CONFIG_PACKAGE_php5-mod-xmlreader),)
410 CONFIGURE_ARGS+= --enable-xmlreader=shared,"$(STAGING_DIR)/usr"
412 CONFIGURE_ARGS+= --disable-xmlreader
415 ifneq ($(CONFIG_PACKAGE_php5-mod-xmlwriter),)
416 CONFIGURE_ARGS+= --enable-xmlwriter=shared,"$(STAGING_DIR)/usr"
418 CONFIGURE_ARGS+= --disable-xmlwriter
421 ifneq ($(CONFIG_PHP5_FILTER),)
422 CONFIGURE_ARGS+= --enable-filter
424 CONFIGURE_ARGS+= --disable-filter
427 ifneq ($(CONFIG_PHP5_LIBXML),)
428 CONFIGURE_ARGS+= --enable-libxml
429 CONFIGURE_ARGS+= --with-libxml-dir="$(STAGING_DIR)/usr/include/libxml2"
431 CONFIGURE_ARGS+= --disable-libxml
435 LIBS="$(CONFIGURE_LIBS)" \
436 ac_cv_c_bigendian_php=$(if $(CONFIG_BIG_ENDIAN),yes,no) \
437 php_cv_cc_rpath="no" \
438 iconv_impl_name="gnu_libiconv" \
439 ac_cv_php_xml2_config_path="$(STAGING_DIR)/host/bin/xml2-config" \
441 define Package/php5/conffiles
445 define Package/php5/install
446 $(INSTALL_DIR) $(1)/etc
447 $(INSTALL_DATA) ./files/php.ini $(1)/etc/
450 define Package/php5-cli/install
451 $(INSTALL_DIR) $(1)/usr/bin
452 $(CP) $(PKG_BUILD_DIR)/sapi/cli/php $(1)/usr/bin/php-cli
455 define Package/php5-cgi/install
456 $(INSTALL_DIR) $(1)/usr/bin
457 $(CP) $(PKG_BUILD_DIR)/sapi/cgi/php-cgi $(1)/usr/bin/php-cgi
458 ln -sf php-cgi $(1)/usr/bin/php-fcgi
461 define Package/php5-fastcgi/install
462 $(INSTALL_DIR) $(1)/etc/init.d
463 $(INSTALL_BIN) ./files/php.init $(1)/etc/init.d/php
468 define Package/php5-mod-$(1)
469 $(call Package/php5/Default)
475 TITLE:=$(2) shared module
478 define Package/php5-mod-$(1)/install
479 $(INSTALL_DIR) $$(1)/usr/lib/php
480 $(INSTALL_BIN) $(PKG_BUILD_DIR)/modules/$(subst -,_,$(1)).so $$(1)/usr/lib/php/
481 $(INSTALL_DIR) $$(1)/etc/php5
482 echo "extension=$(subst -,_,$(1)).so" > $$(1)/etc/php5/$(subst -,_,$(1)).ini
485 $$(eval $$(call BuildPackage,php5-mod-$(1)))
489 $(eval $(call BuildPackage,php5))
490 $(eval $(call BuildPackage,php5-cli))
491 $(eval $(call BuildPackage,php5-cgi))
492 $(eval $(call BuildPackage,php5-fastcgi))
494 #$(eval $(call BuildModule,NAME,TITLE[,PKG DEPENDS]))
495 $(eval $(call BuildModule,apc,APC,+librt))
496 $(eval $(call BuildModule,ctype,Ctype))
497 $(eval $(call BuildModule,curl,cURL,+libcurl))
498 $(eval $(call BuildModule,fileinfo,Fileinfo,+libmagic))
499 $(eval $(call BuildModule,dio,Direct IO))
500 $(eval $(call BuildModule,dom,DOM,@PHP5_LIBXML +libxml2))
501 $(eval $(call BuildModule,exif,EXIF))
502 $(eval $(call BuildModule,ftp,FTP))
503 $(eval $(call BuildModule,gettext,Gettext,+libintl-full))
504 $(eval $(call BuildModule,gd,GD graphics,+libgd))
505 $(eval $(call BuildModule,gmp,GMP,+libgmp))
506 $(eval $(call BuildModule,hash,Hash))
507 $(eval $(call BuildModule,http,HTTP,+libcurl +librt))
508 $(eval $(call BuildModule,iconv,iConv,+libiconv))
509 $(eval $(call BuildModule,json,JSON))
510 $(eval $(call BuildModule,ldap,LDAP,+libopenldap +libsasl2))
511 $(eval $(call BuildModule,libevent,libevent,+libevent))
512 $(eval $(call BuildModule,mbstring,MBString))
513 $(eval $(call BuildModule,mcrypt,Mcrypt,+libmcrypt +libltdl))
514 $(eval $(call BuildModule,mysql,MySQL,+libmysqlclient))
515 $(eval $(call BuildModule,openssl,OpenSSL,+libopenssl))
516 $(eval $(call BuildModule,pcntl,PCNTL))
517 $(eval $(call BuildModule,pdo,PHP Data Objects))
518 $(eval $(call BuildModule,pdo-mysql,PDO driver for MySQL,php5-mod-pdo +libmysqlclient))
519 $(eval $(call BuildModule,pdo-pgsql,PDO driver for PostgreSQL,php5-mod-pdo +libpq))
520 $(eval $(call BuildModule,pdo-sqlite,PDO driver for SQLite 3.x,php5-mod-pdo +libsqlite3 +libpthread))
521 $(eval $(call BuildModule,pgsql,PostgreSQL,+libpq))
522 $(eval $(call BuildModule,session,Session))
523 $(eval $(call BuildModule,simplexml,SimpleXML,@PHP5_LIBXML +libxml2))
524 $(eval $(call BuildModule,soap,SOAP,@PHP5_LIBXML +libxml2))
525 $(eval $(call BuildModule,sockets,Sockets))
526 $(eval $(call BuildModule,sqlite,SQLite 2.x,+libsqlite2))
527 $(eval $(call BuildModule,sqlite3,SQLite3,+libsqlite3 +libpthread))
528 $(eval $(call BuildModule,sysvmsg,System V messages))
529 $(eval $(call BuildModule,sysvsem,System V shared memory))
530 $(eval $(call BuildModule,sysvshm,System V semaphore))
531 $(eval $(call BuildModule,tokenizer,Tokenizer))
532 $(eval $(call BuildModule,xml,XML,+PHP5_LIBXML:libxml2 +!PHP5_LIBXML:libexpat))
533 $(eval $(call BuildModule,xmlreader,XMLReader,@PHP5_LIBXML +libxml2 +libiconv))
534 $(eval $(call BuildModule,xmlwriter,XMLWriter,@PHP5_LIBXML +libxml2 +libiconv))