2 # Copyright (C) 2006-2013 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:=f06f99b9872b503758adab5ba7a7e755
18 PKG_FIXUP:=libtool no-autoreconf
32 mbstring mcrypt mysql mysqli \
34 pcntl pdo pdo-mysql pdo-pgsql pdo-sqlite pgsql \
35 session shmop simplexml soap sockets sqlite sqlite3 sysvmsg sysvsem sysvshm \
37 xml xmlreader xmlwriter zip \
39 PKG_CONFIG_DEPENDS:= \
40 CONFIG_PACKAGE_php5-cgi CONFIG_PACKAGE_php5-cli \
41 $(patsubst %,CONFIG_PACKAGE_php5-mod-%,$(PHP5_MODULES)) \
42 CONFIG_PHP5_FILTER CONFIG_PHP5_LIBXML CONFIG_PHP5_SYSTEMTZDATA
44 include $(INCLUDE_DIR)/package.mk
45 include $(INCLUDE_DIR)/nls.mk
47 define Package/php5/Default
51 TITLE:=PHP5 Hypertext preprocessor
52 URL:=http://www.php.net/
53 MAINTAINER:=Michael Heimpold <mhei@heimpold.de>
57 define Package/php5/Default/description
58 PHP is a widely-used general-purpose scripting language that is especially
59 suited for Web development and can be embedded into HTML.
62 define Package/php5/config
64 bool "PHP5 Filter support"
65 depends on PACKAGE_php5-cli || PACKAGE_php5-cgi
68 bool "PHP5 LIBXML support"
69 depends on PACKAGE_php5-cli || PACKAGE_php5-cgi
71 config PHP5_SYSTEMTZDATA
72 bool "Use system timezone data instead of php's built-in database"
73 depends on PACKAGE_php5-cli || PACKAGE_php5-cgi
74 select PACKAGE_zoneinfo-core
77 Enabling this feature automatically selects the zoneinfo-core package
78 which contains data for UTC timezone. To use other timezones you have
79 to install the corresponding zoneinfo-... package(s).
83 $(call Package/php5/Default)
85 DEPENDS:=+libpcre +zlib \
89 define Package/php5/description
90 $(call Package/php5/Default/description)
91 This package contains only the PHP config file. You must actually choose
92 your PHP flavour (cli, cgi or fastcgi).
95 define Package/php5-cli
96 $(call Package/php5/Default)
100 define Package/php5-cli/description
101 $(call Package/php5/Default/description)
102 This package contains the CLI version of the PHP5 interpreter.
105 define Package/php5-cgi
106 $(call Package/php5/Default)
107 TITLE+= (CGI & FastCGI)
110 define Package/php5-cgi/description
111 $(call Package/php5/Default/description)
112 This package contains the CGI version of the PHP5 interpreter.
115 define Package/php5-fastcgi
116 $(call Package/php5/Default)
118 TITLE:=FastCGI startup script
121 define Package/php5-fastcgi/description
122 As FastCGI support is now a core feature the php5-fastcgi package now depends
123 on the php5-cgi package, containing just the startup script.
133 --with-config-file-path=/etc \
134 --with-config-file-scan-dir=/etc/php5 \
135 --disable-short-tags \
137 --with-zlib="$(STAGING_DIR)/usr" \
138 --with-zlib-dir="$(STAGING_DIR)/usr" \
139 --with-pcre-regex="$(STAGING_DIR)/usr" \
142 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-cli),)
143 CONFIGURE_ARGS+= --enable-cli
145 CONFIGURE_ARGS+= --disable-cli
148 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-cgi),)
149 CONFIGURE_ARGS+= --enable-cgi
151 CONFIGURE_ARGS+= --disable-cgi
154 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-calendar),)
155 CONFIGURE_ARGS+= --enable-calendar=shared
157 CONFIGURE_ARGS+= --disable-calendar
160 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-ctype),)
161 CONFIGURE_ARGS+= --enable-ctype=shared
163 CONFIGURE_ARGS+= --disable-ctype
166 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-curl),)
167 CONFIGURE_ARGS+= --with-curl=shared,"$(STAGING_DIR)/usr"
169 CONFIGURE_ARGS+= --without-curl
172 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-fileinfo),)
173 CONFIGURE_ARGS+= --enable-fileinfo=shared
175 CONFIGURE_ARGS+= --disable-fileinfo
178 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-gettext),)
179 CONFIGURE_ARGS+= --with-gettext=shared,"$(STAGING_DIR)/usr/lib/libintl-full"
181 CONFIGURE_ARGS+= --without-gettext
184 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-dom),)
185 CONFIGURE_ARGS+= --enable-dom=shared
187 CONFIGURE_ARGS+= --disable-dom
190 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-exif),)
191 CONFIGURE_ARGS+= --enable-exif=shared
193 CONFIGURE_ARGS+= --disable-exif
196 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-ftp),)
197 CONFIGURE_ARGS+= --enable-ftp=shared
199 CONFIGURE_ARGS+= --disable-ftp
202 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-gd),)
205 --without-freetype-dir \
206 --with-jpeg-dir="$(STAGING_DIR)/usr" \
207 --with-png-dir="$(STAGING_DIR)/usr" \
210 --enable-gd-native-ttf \
211 --disable-gd-jis-conv
213 CONFIGURE_ARGS+= --without-gd
216 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-gmp),)
217 CONFIGURE_ARGS+= --with-gmp=shared,"$(STAGING_DIR)/usr"
219 CONFIGURE_ARGS+= --without-gmp
222 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-hash),)
223 CONFIGURE_ARGS+= --enable-hash=shared
225 CONFIGURE_ARGS+= --disable-hash
228 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-iconv),)
229 CONFIGURE_ARGS+= --with-iconv=shared,"$(ICONV_PREFIX)"
231 CONFIGURE_ARGS+= --without-iconv
234 ifneq ($(CONFIG_PACKAGE_php5-mod-json),)
235 CONFIGURE_ARGS+= --enable-json=shared
237 CONFIGURE_ARGS+= --disable-json
240 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-ldap),)
242 --with-ldap=shared,"$(STAGING_DIR)/usr" \
243 --with-ldap-sasl="$(STAGING_DIR)/usr"
245 CONFIGURE_ARGS+= --without-ldap
248 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-mbstring),)
249 CONFIGURE_ARGS+= --enable-mbstring=shared --enable-mbregex
251 CONFIGURE_ARGS+= --disable-mbstring
254 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-mcrypt),)
255 CONFIGURE_ARGS+= --with-mcrypt=shared,"$(STAGING_DIR)/usr"
257 CONFIGURE_ARGS+= --without-mcrypt
260 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-mysql),)
261 CONFIGURE_ARGS+= --with-mysql=shared,"$(STAGING_DIR)/usr"
263 CONFIGURE_ARGS+= --without-mysql
266 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-mysqli),)
267 CONFIGURE_ARGS+= --with-mysqli=shared,"$(STAGING_DIR)/usr/bin/mysql_config"
269 CONFIGURE_ARGS+= --without-mysqli
272 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-openssl),)
274 --with-openssl=shared,"$(STAGING_DIR)/usr" \
276 --with-openssl-dir="$(STAGING_DIR)/usr"
278 CONFIGURE_ARGS+= --without-openssl
281 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-pcntl),)
282 CONFIGURE_ARGS+= --enable-pcntl=shared
284 CONFIGURE_ARGS+= --disable-pcntl
287 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-pdo),)
288 CONFIGURE_ARGS+= --enable-pdo=shared
289 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-pdo-mysql),)
290 CONFIGURE_ARGS+= --with-pdo-mysql=shared,"$(STAGING_DIR)/usr"
292 CONFIGURE_ARGS+= --without-pdo-mysql
294 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-pdo-pgsql),)
295 CONFIGURE_ARGS+= --with-pdo-pgsql=shared,"$(STAGING_DIR)/usr"
297 CONFIGURE_ARGS+= --without-pdo-pgsql
299 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-pdo-sqlite),)
300 CONFIGURE_ARGS+= --with-pdo-sqlite=shared,"$(STAGING_DIR)/usr"
302 CONFIGURE_ARGS+= --without-pdo-sqlite
305 CONFIGURE_ARGS+= --disable-pdo
308 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-pgsql),)
309 CONFIGURE_ARGS+= --with-pgsql=shared,"$(STAGING_DIR)/usr"
311 CONFIGURE_ARGS+= --without-pgsql
314 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-session),)
315 CONFIGURE_ARGS+= --enable-session=shared
317 CONFIGURE_ARGS+= --disable-session
320 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-shmop),)
321 CONFIGURE_ARGS+= --enable-shmop=shared
323 CONFIGURE_ARGS+= --disable-shmop
326 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-simplexml),)
327 CONFIGURE_ARGS+= --enable-simplexml=shared
329 CONFIGURE_ARGS+= --disable-simplexml
332 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-soap),)
333 CONFIGURE_ARGS+= --enable-soap=shared
335 CONFIGURE_ARGS+= --disable-soap
338 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-sockets),)
339 CONFIGURE_ARGS+= --enable-sockets=shared
341 CONFIGURE_ARGS+= --disable-sockets
344 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-sqlite),)
345 CONFIGURE_ARGS+= --with-sqlite=shared,"$(STAGING_DIR)/usr"
347 CONFIGURE_ARGS+= --without-sqlite
350 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-sqlite3),)
351 CONFIGURE_ARGS+= --with-sqlite3=shared,"$(STAGING_DIR)/usr"
353 CONFIGURE_ARGS+= --without-sqlite3
356 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-sysvmsg),)
357 CONFIGURE_ARGS+= --enable-sysvmsg=shared
359 CONFIGURE_ARGS+= --disable-sysvmsg
362 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-sysvsem),)
363 CONFIGURE_ARGS+= --enable-sysvsem=shared
365 CONFIGURE_ARGS+= --disable-sysvsem
368 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-sysvshm),)
369 CONFIGURE_ARGS+= --enable-sysvshm=shared
371 CONFIGURE_ARGS+= --disable-sysvshm
374 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-tokenizer),)
375 CONFIGURE_ARGS+= --enable-tokenizer=shared
377 CONFIGURE_ARGS+= --disable-tokenizer
380 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-xml),)
381 CONFIGURE_ARGS+= --enable-xml=shared,"$(STAGING_DIR)/usr"
382 ifneq ($(CONFIG_PHP5_LIBXML),)
383 CONFIGURE_ARGS+= --with-libxml-dir="$(STAGING_DIR)/usr/include/libxml2"
385 CONFIGURE_ARGS+= --with-libexpat-dir="$(STAGING_DIR)/usr"
388 CONFIGURE_ARGS+= --disable-xml
391 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-xmlreader),)
392 CONFIGURE_ARGS+= --enable-xmlreader=shared,"$(STAGING_DIR)/usr"
394 CONFIGURE_ARGS+= --disable-xmlreader
397 ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-xmlwriter),)
398 CONFIGURE_ARGS+= --enable-xmlwriter=shared,"$(STAGING_DIR)/usr"
400 CONFIGURE_ARGS+= --disable-xmlwriter
403 ifneq ($(CONFIG_PACKAGE_php5-mod-zip),)
404 CONFIGURE_ARGS+= --enable-zip=shared
406 CONFIGURE_ARGS+= --disable-zip
409 ifneq ($(SDK)$(CONFIG_PHP5_FILTER),)
410 CONFIGURE_ARGS+= --enable-filter
412 CONFIGURE_ARGS+= --disable-filter
415 ifneq ($(SDK)$(CONFIG_PHP5_LIBXML),)
416 CONFIGURE_ARGS+= --enable-libxml
417 CONFIGURE_ARGS+= --with-libxml-dir="$(STAGING_DIR)/usr/include/libxml2"
419 CONFIGURE_ARGS+= --disable-libxml
422 ifneq ($(CONFIG_PHP5_SYSTEMTZDATA),)
423 CONFIGURE_ARGS+= --with-system-tzdata
425 CONFIGURE_ARGS+= --without-system-tzdata
429 ac_cv_c_bigendian_php=$(if $(CONFIG_BIG_ENDIAN),yes,no) \
430 php_cv_cc_rpath="no" \
431 iconv_impl_name="gnu_libiconv" \
432 ac_cv_php_xml2_config_path="$(STAGING_DIR)/host/bin/xml2-config" \
434 define Package/php5/conffiles
438 define Package/php5/install
439 $(INSTALL_DIR) $(1)/etc
440 $(INSTALL_DATA) ./files/php.ini $(1)/etc/
443 define Package/php5-cli/install
444 $(INSTALL_DIR) $(1)/usr/bin
445 $(CP) $(PKG_BUILD_DIR)/sapi/cli/php $(1)/usr/bin/php-cli
448 define Package/php5-cgi/install
449 $(INSTALL_DIR) $(1)/usr/bin
450 $(CP) $(PKG_BUILD_DIR)/sapi/cgi/php-cgi $(1)/usr/bin/php-cgi
451 ln -sf php-cgi $(1)/usr/bin/php-fcgi
454 define Package/php5-fastcgi/install
455 $(INSTALL_DIR) $(1)/etc/config
456 $(INSTALL_DATA) ./files/php5-fastcgi.config $(1)/etc/config/php5-fastcgi
458 $(INSTALL_DIR) $(1)/etc/init.d
459 $(INSTALL_BIN) ./files/php5-fastcgi.init $(1)/etc/init.d/php5-fastcgi
463 $(call Build/Prepare/Default)
464 ( cd $(PKG_BUILD_DIR); touch configure.in; ./buildconf --force )
467 define Build/InstallDev
468 mkdir -p $(PKG_BUILD_DIR)/staging/usr/bin
469 make -C $(PKG_BUILD_DIR) install INSTALL_ROOT=$(PKG_BUILD_DIR)/staging
470 rm -f $(PKG_BUILD_DIR)/staging/usr/bin/php
471 $(CP) $(PKG_BUILD_DIR)/staging/* $(STAGING_DIR_HOST)
472 sed -i -e "s#prefix='/usr'#prefix='$(STAGING_DIR_HOST)/usr'#" $(STAGING_DIR_HOST)/usr/bin/phpize
473 sed -i -e "s#exec_prefix=\"\`eval echo /usr\`\"#exec_prefix='$(STAGING_DIR_HOST)/usr'#" $(STAGING_DIR_HOST)/usr/bin/phpize
474 sed -i -e "s#prefix=\"/usr\"#prefix=\"$(STAGING_DIR_HOST)/usr\"#" $(STAGING_DIR_HOST)/usr/bin/php-config
479 define Package/php5-mod-$(1)
480 $(call Package/php5/Default)
486 TITLE:=$(2) shared module
489 define Package/php5-mod-$(1)/install
490 $(INSTALL_DIR) $$(1)/usr/lib/php
491 $(INSTALL_BIN) $(PKG_BUILD_DIR)/modules/$(subst -,_,$(1)).so $$(1)/usr/lib/php/
492 $(INSTALL_DIR) $$(1)/etc/php5
493 echo "extension=$(subst -,_,$(1)).so" > $$(1)/etc/php5/$(subst -,_,$(1)).ini
496 $$(eval $$(call BuildPackage,php5-mod-$(1)))
500 $(eval $(call BuildPackage,php5))
501 $(eval $(call BuildPackage,php5-cli))
502 $(eval $(call BuildPackage,php5-cgi))
503 $(eval $(call BuildPackage,php5-fastcgi))
505 #$(eval $(call BuildModule,NAME,TITLE[,PKG DEPENDS]))
506 $(eval $(call BuildModule,calendar,Calendar))
507 $(eval $(call BuildModule,ctype,Ctype))
508 $(eval $(call BuildModule,curl,cURL,+PACKAGE_php5-mod-curl:libcurl))
509 $(eval $(call BuildModule,fileinfo,Fileinfo,+PACKAGE_php5-mod-fileinfo:libmagic))
510 $(eval $(call BuildModule,dom,DOM,+@PHP5_LIBXML +PACKAGE_php5-mod-dom:libxml2))
511 $(eval $(call BuildModule,exif,EXIF))
512 $(eval $(call BuildModule,ftp,FTP,+PACKAGE_php5-mod-ftp:libopenssl))
513 $(eval $(call BuildModule,gettext,Gettext,+PACKAGE_php5-mod-gettext:libintl-full))
514 $(eval $(call BuildModule,gd,GD graphics,+PACKAGE_php5-mod-gd:libjpeg +PACKAGE_php5-mod-gd:libpng))
515 $(eval $(call BuildModule,gmp,GMP,+PACKAGE_php5-mod-gmp:libgmp))
516 $(eval $(call BuildModule,hash,Hash))
517 $(eval $(call BuildModule,iconv,iConv,+PACKAGE_php5-mod-iconv:libiconv))
518 $(eval $(call BuildModule,json,JSON))
519 $(eval $(call BuildModule,ldap,LDAP,+PACKAGE_php5-mod-ldap:libopenldap +PACKAGE_php5-mod-ldap:libsasl2))
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,mysqli,MySQL Improved Extension,+PACKAGE_php5-mod-mysqli:libmysqlclient))
524 $(eval $(call BuildModule,openssl,OpenSSL,+PACKAGE_php5-mod-openssl:libopenssl))
525 $(eval $(call BuildModule,pcntl,PCNTL))
526 $(eval $(call BuildModule,pdo,PHP Data Objects))
527 $(eval $(call BuildModule,pdo-mysql,PDO driver for MySQL,+php5-mod-pdo +PACKAGE_php5-mod-pdo-mysql:libmysqlclient))
528 $(eval $(call BuildModule,pdo-pgsql,PDO driver for PostgreSQL,+php5-mod-pdo +PACKAGE_php5-mod-pdo-pgsql:libpq))
529 $(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 +PACKAGE_php5-mod-pdo-sqlite:librt))
530 $(eval $(call BuildModule,pgsql,PostgreSQL,+PACKAGE_php5-mod-pgsql:libpq))
531 $(eval $(call BuildModule,session,Session))
532 $(eval $(call BuildModule,shmop,Shared Memory))
533 $(eval $(call BuildModule,simplexml,SimpleXML,+@PHP5_LIBXML +PACKAGE_php5-mod-simplexml:libxml2))
534 $(eval $(call BuildModule,soap,SOAP,+@PHP5_LIBXML +PACKAGE_php5-mod-soap:libxml2))
535 $(eval $(call BuildModule,sockets,Sockets))
536 $(eval $(call BuildModule,sqlite,SQLite 2.x,+PACKAGE_php5-mod-sqlite:libsqlite2))
537 $(eval $(call BuildModule,sqlite3,SQLite3,+PACKAGE_php5-mod-sqlite3:libsqlite3 +PACKAGE_php5-mod-sqlite3:libpthread))
538 $(eval $(call BuildModule,sysvmsg,System V messages))
539 $(eval $(call BuildModule,sysvsem,System V shared memory))
540 $(eval $(call BuildModule,sysvshm,System V semaphore))
541 $(eval $(call BuildModule,tokenizer,Tokenizer))
542 $(eval $(call BuildModule,xml,XML,+PHP5_LIBXML:libxml2 +!PHP5_LIBXML:libexpat))
543 $(eval $(call BuildModule,xmlreader,XMLReader,+@PHP5_LIBXML +PACKAGE_php5-mod-xmlreader:libxml2 +PACKAGE_php5-mod-xmlreader:libiconv))
544 $(eval $(call BuildModule,xmlwriter,XMLWriter,+@PHP5_LIBXML +PACKAGE_php5-mod-xmlwriter:libxml2 +PACKAGE_php5-mod-xmlwriter:libiconv))
545 $(eval $(call BuildModule,zip,ZIP,+PACKAGE_php5-mod-zip:zlib))