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 zip \
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 PHP5_SYSTEMTZDATA
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
72 config PHP5_SYSTEMTZDATA
73 bool "Use system timezone data instead of php's built-in database"
74 depends on PACKAGE_php5-cli || PACKAGE_php5-cgi
75 select PACKAGE_zoneinfo-core
78 Enabling this feature automatically selects the zoneinfo-core package
79 which contains data for UTC timezone. To use other timezones you have
80 to install the corresponding zoneinfo-... package(s).
84 $(call Package/php5/Default)
86 DEPENDS:=+libpcre +zlib \
90 define Package/php5/description
91 $(call Package/php5/Default/description)
92 This package contains only the PHP config file. You must actually choose
93 your PHP flavour (cli, cgi or fastcgi).
96 define Package/php5-cli
97 $(call Package/php5/Default)
101 define Package/php5-cli/description
102 $(call Package/php5/Default/description)
103 This package contains the CLI version of the PHP5 interpreter.
106 define Package/php5-cgi
107 $(call Package/php5/Default)
108 TITLE+= (CGI & FastCGI)
111 define Package/php5-cgi/description
112 $(call Package/php5/Default/description)
113 This package contains the CGI version of the PHP5 interpreter.
116 define Package/php5-fastcgi
117 $(call Package/php5/Default)
119 TITLE:=FastCGI startup script
122 define Package/php5-fastcgi/description
123 As FastCGI support is now a core feature the php5-fastcgi package now depends
124 on the php5-cgi package, containing just the startup script.
134 --with-config-file-path=/etc \
135 --with-config-file-scan-dir=/etc/php5 \
136 --enable-magic-quotes \
137 --disable-short-tags \
139 --with-zlib="$(STAGING_DIR)/usr" \
140 --with-zlib-dir="$(STAGING_DIR)/usr" \
141 --with-pcre-regex="$(STAGING_DIR)/usr" \
144 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-cli),)
145 CONFIGURE_ARGS+= --enable-cli
147 CONFIGURE_ARGS+= --disable-cli
150 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-cgi),)
151 CONFIGURE_ARGS+= --enable-cgi
153 CONFIGURE_ARGS+= --disable-cgi
156 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-apc),)
157 CONFIGURE_ARGS+= --enable-apc=shared --disable-apc-mmap --disable-apc-pthreadmutex
159 CONFIGURE_ARGS+= --disable-apc
162 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-ctype),)
163 CONFIGURE_ARGS+= --enable-ctype=shared
165 CONFIGURE_ARGS+= --disable-ctype
168 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-curl),)
169 CONFIGURE_ARGS+= --with-curl=shared,"$(STAGING_DIR)/usr"
171 CONFIGURE_ARGS+= --without-curl
174 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-fileinfo),)
175 CONFIGURE_ARGS+= --enable-fileinfo=shared
177 CONFIGURE_ARGS+= --disable-fileinfo
180 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-gettext),)
181 CONFIGURE_ARGS+= --with-gettext=shared,"$(STAGING_DIR)/usr/lib/libintl-full"
183 CONFIGURE_ARGS+= --without-gettext
186 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-dio),)
187 CONFIGURE_ARGS+= --enable-dio=shared
189 CONFIGURE_ARGS+= --disable-dio
192 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-dom),)
193 CONFIGURE_ARGS+= --enable-dom=shared
195 CONFIGURE_ARGS+= --disable-dom
198 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-exif),)
199 CONFIGURE_ARGS+= --enable-exif=shared
201 CONFIGURE_ARGS+= --disable-exif
204 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-ftp),)
205 CONFIGURE_ARGS+= --enable-ftp=shared
207 CONFIGURE_ARGS+= --disable-ftp
210 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-gd),)
212 --with-gd=shared,"$(STAGING_DIR)/usr" \
213 --without-freetype-dir \
214 --with-jpeg-dir="$(STAGING_DIR)/usr" \
215 --with-png-dir="$(STAGING_DIR)/usr" \
218 --enable-gd-native-ttf \
219 --disable-gd-jis-conv
221 CONFIGURE_ARGS+= --without-gd
224 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-gmp),)
225 CONFIGURE_ARGS+= --with-gmp=shared,"$(STAGING_DIR)/usr"
227 CONFIGURE_ARGS+= --without-gmp
230 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-hash),)
231 CONFIGURE_ARGS+= --enable-hash=shared
233 CONFIGURE_ARGS+= --disable-hash
236 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-http),)
238 --enable-http=shared \
239 --without-http-shared-deps \
240 --with-http-curl-requests="$(STAGING_DIR)/usr"
242 CONFIGURE_ARGS+= --disable-http
245 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-iconv),)
246 CONFIGURE_ARGS+= --with-iconv=shared,"$(ICONV_PREFIX)"
248 CONFIGURE_ARGS+= --without-iconv
251 ifneq ($(CONFIG_PACKAGE_php5-mod-json),)
252 CONFIGURE_ARGS+= --enable-json=shared
254 CONFIGURE_ARGS+= --disable-json
257 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-ldap),)
259 --with-ldap=shared,"$(STAGING_DIR)/usr" \
260 --with-ldap-sasl="$(STAGING_DIR)/usr"
262 CONFIGURE_ARGS+= --without-ldap
265 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-libevent),)
266 CONFIGURE_ARGS+= --with-libevent=shared,"$(STAGING_DIR)/usr"
268 CONFIGURE_ARGS+= --without-libevent
271 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-mbstring),)
272 CONFIGURE_ARGS+= --enable-mbstring=shared --enable-mbregex
274 CONFIGURE_ARGS+= --disable-mbstring
277 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-mcrypt),)
278 CONFIGURE_ARGS+= --with-mcrypt=shared,"$(STAGING_DIR)/usr"
280 CONFIGURE_ARGS+= --without-mcrypt
283 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-mysql),)
284 CONFIGURE_ARGS+= --with-mysql=shared,"$(STAGING_DIR)/usr"
286 CONFIGURE_ARGS+= --without-mysql
289 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-openssl),)
291 --with-openssl=shared,"$(STAGING_DIR)/usr" \
293 --with-openssl-dir="$(STAGING_DIR)/usr"
295 CONFIGURE_ARGS+= --without-openssl
298 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-pcntl),)
299 CONFIGURE_ARGS+= --enable-pcntl=shared
301 CONFIGURE_ARGS+= --disable-pcntl
304 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-pdo),)
305 CONFIGURE_ARGS+= --enable-pdo=shared
306 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-pdo-mysql),)
307 CONFIGURE_ARGS+= --with-pdo-mysql=shared,"$(STAGING_DIR)/usr"
309 CONFIGURE_ARGS+= --without-pdo-mysql
311 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-pdo-pgsql),)
312 CONFIGURE_ARGS+= --with-pdo-pgsql=shared,"$(STAGING_DIR)/usr"
314 CONFIGURE_ARGS+= --without-pdo-pgsql
316 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-pdo-sqlite),)
317 CONFIGURE_ARGS+= --with-pdo-sqlite=shared,"$(STAGING_DIR)/usr"
319 CONFIGURE_ARGS+= --without-pdo-sqlite
322 CONFIGURE_ARGS+= --disable-pdo
325 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-pgsql),)
326 CONFIGURE_ARGS+= --with-pgsql=shared,"$(STAGING_DIR)/usr"
328 CONFIGURE_ARGS+= --without-pgsql
331 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-session),)
332 CONFIGURE_ARGS+= --enable-session=shared
334 CONFIGURE_ARGS+= --disable-session
337 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-simplexml),)
338 CONFIGURE_ARGS+= --enable-simplexml=shared
340 CONFIGURE_ARGS+= --disable-simplexml
343 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-soap),)
344 CONFIGURE_ARGS+= --enable-soap=shared
346 CONFIGURE_ARGS+= --disable-soap
349 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-sockets),)
350 CONFIGURE_ARGS+= --enable-sockets=shared
352 CONFIGURE_ARGS+= --disable-sockets
355 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-sqlite),)
356 CONFIGURE_ARGS+= --with-sqlite=shared,"$(STAGING_DIR)/usr"
358 CONFIGURE_ARGS+= --without-sqlite
361 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-sqlite3),)
362 CONFIGURE_ARGS+= --with-sqlite3=shared,"$(STAGING_DIR)/usr"
364 CONFIGURE_ARGS+= --without-sqlite3
367 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-sysvmsg),)
368 CONFIGURE_ARGS+= --enable-sysvmsg=shared
370 CONFIGURE_ARGS+= --disable-sysvmsg
373 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-sysvsem),)
374 CONFIGURE_ARGS+= --enable-sysvsem=shared
376 CONFIGURE_ARGS+= --disable-sysvsem
379 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-sysvshm),)
380 CONFIGURE_ARGS+= --enable-sysvshm=shared
382 CONFIGURE_ARGS+= --disable-sysvshm
385 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-tokenizer),)
386 CONFIGURE_ARGS+= --enable-tokenizer=shared
388 CONFIGURE_ARGS+= --disable-tokenizer
391 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-xml),)
392 CONFIGURE_ARGS+= --enable-xml=shared,"$(STAGING_DIR)/usr"
393 ifneq ($(CONFIG_PHP5_LIBXML),)
394 CONFIGURE_ARGS+= --with-libxml-dir="$(STAGING_DIR)/usr/include/libxml2"
396 CONFIGURE_ARGS+= --with-libexpat-dir="$(STAGING_DIR)/usr"
399 CONFIGURE_ARGS+= --disable-xml
402 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-xmlreader),)
403 CONFIGURE_ARGS+= --enable-xmlreader=shared,"$(STAGING_DIR)/usr"
405 CONFIGURE_ARGS+= --disable-xmlreader
408 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-xmlwriter),)
409 CONFIGURE_ARGS+= --enable-xmlwriter=shared,"$(STAGING_DIR)/usr"
411 CONFIGURE_ARGS+= --disable-xmlwriter
414 ifneq ($(CONFIG_PACKAGE_php5-mod-zip),)
415 CONFIGURE_ARGS+= --enable-zip=shared
417 CONFIGURE_ARGS+= --disable-zip
420 ifneq ($(SDK)$(CONFIG_PHP5_FILTER),)
421 CONFIGURE_ARGS+= --enable-filter
423 CONFIGURE_ARGS+= --disable-filter
426 ifneq ($(SDK)$(CONFIG_PHP5_LIBXML),)
427 CONFIGURE_ARGS+= --enable-libxml
428 CONFIGURE_ARGS+= --with-libxml-dir="$(STAGING_DIR)/usr/include/libxml2"
430 CONFIGURE_ARGS+= --disable-libxml
433 ifneq ($(CONFIG_PHP5_SYSTEMTZDATA),)
434 CONFIGURE_ARGS+= --with-system-tzdata
436 CONFIGURE_ARGS+= --without-system-tzdata
440 LIBS="$(CONFIGURE_LIBS)" \
441 ac_cv_c_bigendian_php=$(if $(CONFIG_BIG_ENDIAN),yes,no) \
442 php_cv_cc_rpath="no" \
443 iconv_impl_name="gnu_libiconv" \
444 ac_cv_php_xml2_config_path="$(STAGING_DIR)/host/bin/xml2-config" \
446 define Package/php5/conffiles
450 define Package/php5/install
451 $(INSTALL_DIR) $(1)/etc
452 $(INSTALL_DATA) ./files/php.ini $(1)/etc/
455 define Package/php5-cli/install
456 $(INSTALL_DIR) $(1)/usr/bin
457 $(CP) $(PKG_BUILD_DIR)/sapi/cli/php $(1)/usr/bin/php-cli
460 define Package/php5-cgi/install
461 $(INSTALL_DIR) $(1)/usr/bin
462 $(CP) $(PKG_BUILD_DIR)/sapi/cgi/php-cgi $(1)/usr/bin/php-cgi
463 ln -sf php-cgi $(1)/usr/bin/php-fcgi
466 define Package/php5-fastcgi/install
467 $(INSTALL_DIR) $(1)/etc/config
468 $(INSTALL_DATA) ./files/php5-fastcgi.config $(1)/etc/config/php5-fastcgi
470 $(INSTALL_DIR) $(1)/etc/init.d
471 $(INSTALL_BIN) ./files/php5-fastcgi.init $(1)/etc/init.d/php5-fastcgi
476 define Package/php5-mod-$(1)
477 $(call Package/php5/Default)
483 TITLE:=$(2) shared module
486 define Package/php5-mod-$(1)/install
487 $(INSTALL_DIR) $$(1)/usr/lib/php
488 $(INSTALL_BIN) $(PKG_BUILD_DIR)/modules/$(subst -,_,$(1)).so $$(1)/usr/lib/php/
489 $(INSTALL_DIR) $$(1)/etc/php5
490 echo "extension=$(subst -,_,$(1)).so" > $$(1)/etc/php5/$(subst -,_,$(1)).ini
493 $$(eval $$(call BuildPackage,php5-mod-$(1)))
497 $(eval $(call BuildPackage,php5))
498 $(eval $(call BuildPackage,php5-cli))
499 $(eval $(call BuildPackage,php5-cgi))
500 $(eval $(call BuildPackage,php5-fastcgi))
502 #$(eval $(call BuildModule,NAME,TITLE[,PKG DEPENDS]))
503 $(eval $(call BuildModule,apc,APC,+PACKAGE_php5-mod-apc:librt))
504 $(eval $(call BuildModule,ctype,Ctype))
505 $(eval $(call BuildModule,curl,cURL,+PACKAGE_php5-mod-curl:libcurl))
506 $(eval $(call BuildModule,fileinfo,Fileinfo,+PACKAGE_php5-mod-fileinfo:libmagic))
507 $(eval $(call BuildModule,dio,Direct IO))
508 $(eval $(call BuildModule,dom,DOM,+@PHP5_LIBXML +PACKAGE_php5-mod-dom:libxml2))
509 $(eval $(call BuildModule,exif,EXIF))
510 $(eval $(call BuildModule,ftp,FTP))
511 $(eval $(call BuildModule,gettext,Gettext,+PACKAGE_php5-mod-gettext:libintl-full))
512 $(eval $(call BuildModule,gd,GD graphics,+PACKAGE_php5-mod-gd:libgd))
513 $(eval $(call BuildModule,gmp,GMP,+PACKAGE_php5-mod-gmp:libgmp))
514 $(eval $(call BuildModule,hash,Hash))
515 $(eval $(call BuildModule,http,HTTP,+PACKAGE_php5-mod-http:libcurl +PACKAGE_php5-mod-http:librt))
516 $(eval $(call BuildModule,iconv,iConv,+PACKAGE_php5-mod-iconv:libiconv))
517 $(eval $(call BuildModule,json,JSON))
518 $(eval $(call BuildModule,ldap,LDAP,+PACKAGE_php5-mod-ldap:libopenldap +PACKAGE_php5-mod-ldap:libsasl2))
519 $(eval $(call BuildModule,libevent,libevent,+PACKAGE_php5-mod-libevent:libevent))
520 $(eval $(call BuildModule,mbstring,MBString))
521 $(eval $(call BuildModule,mcrypt,Mcrypt,+PACKAGE_php5-mod-mcrypt:libmcrypt +PACKAGE_php5-mod-mcrypt:libltdl))
522 $(eval $(call BuildModule,mysql,MySQL,+PACKAGE_php5-mod-mysql:libmysqlclient))
523 $(eval $(call BuildModule,openssl,OpenSSL,+PACKAGE_php5-mod-openssl:libopenssl))
524 $(eval $(call BuildModule,pcntl,PCNTL))
525 $(eval $(call BuildModule,pdo,PHP Data Objects))
526 $(eval $(call BuildModule,pdo-mysql,PDO driver for MySQL,+php5-mod-pdo +PACKAGE_php5-mod-pdo-mysql:libmysqlclient))
527 $(eval $(call BuildModule,pdo-pgsql,PDO driver for PostgreSQL,+php5-mod-pdo +PACKAGE_php5-mod-pdo-pgsql:libpq))
528 $(eval $(call BuildModule,pdo-sqlite,PDO driver for SQLite 3.x,+php5-mod-pdo +PACKAGE_php5-mod-pdo-sqlite:libsqlite3 +PACKAGE_php5-mod-pdo-sqlite:libpthread))
529 $(eval $(call BuildModule,pgsql,PostgreSQL,+PACKAGE_php5-mod-pgsql:libpq))
530 $(eval $(call BuildModule,session,Session))
531 $(eval $(call BuildModule,simplexml,SimpleXML,+@PHP5_LIBXML +PACKAGE_php5-mod-simplexml:libxml2))
532 $(eval $(call BuildModule,soap,SOAP,+@PHP5_LIBXML +PACKAGE_php5-mod-soap:libxml2))
533 $(eval $(call BuildModule,sockets,Sockets))
534 $(eval $(call BuildModule,sqlite,SQLite 2.x,+PACKAGE_php5-mod-sqlite:libsqlite2))
535 $(eval $(call BuildModule,sqlite3,SQLite3,+PACKAGE_php5-mod-sqlite3:libsqlite3 +PACKAGE_php5-mod-sqlite3:libpthread))
536 $(eval $(call BuildModule,sysvmsg,System V messages))
537 $(eval $(call BuildModule,sysvsem,System V shared memory))
538 $(eval $(call BuildModule,sysvshm,System V semaphore))
539 $(eval $(call BuildModule,tokenizer,Tokenizer))
540 $(eval $(call BuildModule,xml,XML,+PHP5_LIBXML:libxml2 +!PHP5_LIBXML:libexpat))
541 $(eval $(call BuildModule,xmlreader,XMLReader,+@PHP5_LIBXML +PACKAGE_php5-mod-xmlreader:libxml2 +PACKAGE_php5-mod-xmlreader:libiconv))
542 $(eval $(call BuildModule,xmlwriter,XMLWriter,+@PHP5_LIBXML +PACKAGE_php5-mod-xmlwriter:libxml2 +PACKAGE_php5-mod-xmlwriter:libiconv))
543 $(eval $(call BuildModule,zip,ZIP,+PACKAGE_php5-mod-zip:zip))