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
:=2286f5a82a6e8397955a0025c1c2ad98
18 PKG_FIXUP
:=libtool no-autoreconf
21 include $(INCLUDE_DIR
)/package.mk
22 include $(INCLUDE_DIR
)/nls.mk
24 define Package
/php5
/Default
28 TITLE
:=PHP5 Hypertext preprocessor
29 URL
:=http
://www.php.net
/
30 MAINTAINER
:=Michael Heimpold
<mhei@heimpold.de
>
33 define Package
/php5
/Default
/description
34 PHP is a widely-used general-purpose scripting language that is especially
35 suited for Web development and can be embedded into HTML.
38 define Package
/php5
/config
40 bool
"PHP5 Filter support"
41 depends on PACKAGE_php5-cli || PACKAGE_php5-cgi
44 bool
"PHP5 LIBXML support"
45 depends on PACKAGE_php5-cli || PACKAGE_php5-cgi
49 $(call Package
/php5
/Default
)
50 DEPENDS
:=+libpcre
+zlib
51 ifneq ($(CONFIG_PHP5_LIBXML
),)
54 ifneq ($(CONFIG_PACKAGE_php5-mod-apc
),)
57 ifneq ($(CONFIG_PACKAGE_php5-mod-sqlite3
)$(CONFIG_PACKAGE_php5-mod-pdo-sqlite
),)
58 DEPENDS
+= +libsqlite3
+libpthread
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
).
68 define Package
/php5-cli
69 $(call Package
/php5
/Default
)
74 define Package
/php5-cli
/description
75 (call Package
/php5
/Default
/description
)
76 This package contains the CLI version of the PHP5 interpreter.
79 define Package
/php5-cgi
80 $(call Package
/php5
/Default
)
82 TITLE
+= (CGI
& FastCGI
)
85 define Package
/php5-cgi
/description
86 $(call Package
/php5
/Default
/description
)
87 This package contains the CGI version of the PHP5 interpreter.
90 define Package
/php5-fastcgi
91 $(call Package
/php5
/Default
)
92 DEPENDS
:=php5
+php5-cgi
93 TITLE
:=FastCGI startup script
96 define Package
/php5-fastcgi
/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.
102 ac_cv_c_bigendian_php
=$(if
$(CONFIG_BIG_ENDIAN
),yes
,no
)
104 PKG_CONFIGURE_OPTS
:= \
111 --with-config-file-path
=/etc \
112 --with-config-file-scan-dir
=/etc
/php5 \
113 --enable-magic-quotes \
114 --disable-short-tags \
117 --with-zlib
="$(STAGING_DIR)/usr" \
118 --with-zlib-dir
="$(STAGING_DIR)/usr" \
119 --with-pcre-regex
="$(STAGING_DIR)/usr" \
123 PKG_BUILD_DEPENDS
+=libopenssl zlib libcurl libgd libgmp libopenldap libmysqlclient libpq libsqlite2 libpthread libsqlite3 libpcre libxml2
124 # force PKG_CONFIGURE_{LIBS,OPTS} below when built in the SDK
125 CONFIG_PACKAGE_php5-cli
:=m
126 CONFIG_PACKAGE_php5-cgi
:=m
127 CONFIG_PACKAGE_php5-fastcgi
:=m
128 CONFIG_PACKAGE_php5-mod-curl
:=m
129 CONFIG_PACKAGE_php5-mod-gd
:=m
130 CONFIG_PACKAGE_php5-mod-gmp
:=m
131 CONFIG_PACKAGE_php5-mod-ldap
:=m
132 CONFIG_PACKAGE_php5-mod-mysql
:=m
133 CONFIG_PACKAGE_php5-mod-pgsql
:=m
134 CONFIG_PACKAGE_php5-mod-sqlite
:=m
135 CONFIG_PACKAGE_php5-mod-sqlite3
:=m
136 CONFIG_PACKAGE_php5-mod-xml
:=m
139 ifneq ($(CONFIG_PACKAGE_php5-mod-apc
),)
140 PKG_CONFIGURE_OPTS
+= --enable-apc
=shared
--disable-apc-mmap
--disable-apc-pthreadmutex
141 PKG_CONFIGURE_LIBS
+= -lrt
143 PKG_CONFIGURE_OPTS
+= --disable-apc
146 ifneq ($(CONFIG_PACKAGE_php5-mod-ctype
),)
147 PKG_CONFIGURE_OPTS
+= --enable-ctype
=shared
149 PKG_CONFIGURE_OPTS
+= --disable-ctype
152 ifneq ($(CONFIG_PACKAGE_php5-mod-curl
),)
153 PKG_CONFIGURE_OPTS
+= --with-curl
=shared
,"$(STAGING_DIR)/usr"
155 PKG_CONFIGURE_OPTS
+= --without-curl
158 ifneq ($(CONFIG_PACKAGE_php5-mod-fileinfo
),)
159 PKG_CONFIGURE_OPTS
+= --enable-fileinfo
=shared
161 PKG_CONFIGURE_OPTS
+= --disable-fileinfo
164 ifneq ($(CONFIG_PACKAGE_php5-mod-dom
),)
165 PKG_CONFIGURE_OPTS
+= --enable-dom
=shared
167 PKG_CONFIGURE_OPTS
+= --disable-dom
170 ifneq ($(CONFIG_PACKAGE_php5-mod-exif
),)
171 PKG_CONFIGURE_OPTS
+= --enable-exif
=shared
173 PKG_CONFIGURE_OPTS
+= --disable-exif
176 ifneq ($(CONFIG_PACKAGE_php5-mod-ftp
),)
177 PKG_CONFIGURE_OPTS
+= --enable-ftp
=shared
179 PKG_CONFIGURE_OPTS
+= --disable-ftp
182 ifneq ($(CONFIG_PACKAGE_php5-mod-gd
),)
183 PKG_CONFIGURE_OPTS
+= --with-gd
=shared
,"$(STAGING_DIR)/usr" \
184 --without-freetype-dir \
185 --with-jpeg-dir
="$(STAGING_DIR)/usr" \
186 --with-png-dir
="$(STAGING_DIR)/usr" \
189 --enable-gd-native-ttf \
190 --disable-gd-jis-conv
192 PKG_CONFIGURE_OPTS
+= --without-gd
195 ifneq ($(CONFIG_PACKAGE_php5-mod-gmp
),)
196 PKG_CONFIGURE_OPTS
+= --with-gmp
=shared
,"$(STAGING_DIR)/usr"
198 PKG_CONFIGURE_OPTS
+= --without-gmp
201 ifneq ($(CONFIG_PACKAGE_php5-mod-hash
),)
202 PKG_CONFIGURE_OPTS
+= --enable-hash
=shared
204 PKG_CONFIGURE_OPTS
+= --disable-hash
207 ifneq ($(CONFIG_PACKAGE_php5-mod-iconv
),)
208 PKG_CONFIGURE_OPTS
+= --with-iconv
=shared
,"$(ICONV_PREFIX)"
210 PKG_CONFIGURE_OPTS
+= --without-iconv
213 ifneq ($(CONFIG_PACKAGE_php5-mod-json
),)
214 PKG_CONFIGURE_OPTS
+= --enable-json
=shared
216 PKG_CONFIGURE_OPTS
+= --disable-json
219 ifneq ($(CONFIG_PACKAGE_php5-mod-ldap
),)
220 PKG_CONFIGURE_OPTS
+= --with-ldap
=shared
,"$(STAGING_DIR)/usr" \
221 --with-ldap-sasl
="$(STAGING_DIR)/usr"
223 PKG_CONFIGURE_OPTS
+= --without-ldap
226 ifneq ($(CONFIG_PACKAGE_php5-mod-mbstring
),)
227 PKG_CONFIGURE_OPTS
+= --enable-mbstring
=shared
--enable-mbregex
229 PKG_CONFIGURE_OPTS
+= --disable-mbstring
232 ifneq ($(CONFIG_PACKAGE_php5-mod-mcrypt
),)
233 PKG_CONFIGURE_OPTS
+= --with-mcrypt
=shared
,"$(STAGING_DIR)/usr"
235 PKG_CONFIGURE_OPTS
+= --without-mcrypt
238 ifneq ($(CONFIG_PACKAGE_php5-mod-mysql
),)
239 PKG_CONFIGURE_OPTS
+= --with-mysql
=shared
,"$(STAGING_DIR)/usr"
241 PKG_CONFIGURE_OPTS
+= --without-mysql
244 ifneq ($(CONFIG_PACKAGE_php5-mod-openssl
),)
245 PKG_CONFIGURE_OPTS
+= --with-openssl
=shared
,"$(STAGING_DIR)/usr"
246 PKG_CONFIGURE_OPTS
+= --with-kerberos
=no
247 PKG_CONFIGURE_OPTS
+= --with-openssl-dir
="$(STAGING_DIR)/usr"
249 PKG_CONFIGURE_OPTS
+= --without-openssl
252 ifneq ($(CONFIG_PACKAGE_php5-mod-pcntl
),)
253 PKG_CONFIGURE_OPTS
+= --enable-pcntl
=shared
255 PKG_CONFIGURE_OPTS
+= --disable-pcntl
258 ifneq ($(CONFIG_PACKAGE_php5-mod-pdo
),)
259 PKG_CONFIGURE_OPTS
+= --enable-pdo
=shared
260 ifneq ($(CONFIG_PACKAGE_php5-mod-pdo-mysql
),)
261 PKG_CONFIGURE_OPTS
+= --with-pdo-mysql
=shared
,"$(STAGING_DIR)/usr"
263 PKG_CONFIGURE_OPTS
+= --without-pdo-mysql
265 ifneq ($(CONFIG_PACKAGE_php5-mod-pdo-pgsql
),)
266 PKG_CONFIGURE_OPTS
+= --with-pdo-pgsql
=shared
,"$(STAGING_DIR)/usr"
268 PKG_CONFIGURE_OPTS
+= --without-pdo-pgsql
270 ifneq ($(CONFIG_PACKAGE_php5-mod-pdo-sqlite
),)
271 PKG_CONFIGURE_OPTS
+= --with-pdo-sqlite
=shared
,"$(STAGING_DIR)/usr"
272 PKG_CONFIGURE_LIBS
+= -lsqlite3
-lpthread
274 PKG_CONFIGURE_OPTS
+= --without-pdo-sqlite
277 PKG_CONFIGURE_OPTS
+= --disable-pdo
280 ifneq ($(CONFIG_PACKAGE_php5-mod-pgsql
),)
281 PKG_CONFIGURE_OPTS
+= --with-pgsql
=shared
,"$(STAGING_DIR)/usr"
283 PKG_CONFIGURE_OPTS
+= --without-pgsql
286 ifneq ($(CONFIG_PACKAGE_php5-mod-session
),)
287 PKG_CONFIGURE_OPTS
+= --enable-session
=shared
289 PKG_CONFIGURE_OPTS
+= --disable-session
292 ifneq ($(CONFIG_PACKAGE_php5-mod-simplexml
),)
293 PKG_CONFIGURE_OPTS
+= --enable-simplexml
=shared
295 PKG_CONFIGURE_OPTS
+= --disable-simplexml
298 ifneq ($(CONFIG_PACKAGE_php5-mod-soap
),)
299 PKG_CONFIGURE_OPTS
+= --enable-soap
=shared
301 PKG_CONFIGURE_OPTS
+= --disable-soap
304 ifneq ($(CONFIG_PACKAGE_php5-mod-sockets
),)
305 PKG_CONFIGURE_OPTS
+= --enable-sockets
=shared
307 PKG_CONFIGURE_OPTS
+= --disable-sockets
310 ifneq ($(CONFIG_PACKAGE_php5-mod-sqlite
),)
311 PKG_CONFIGURE_OPTS
+= --with-sqlite
=shared
,"$(STAGING_DIR)/usr"
313 PKG_CONFIGURE_OPTS
+= --without-sqlite
316 ifneq ($(CONFIG_PACKAGE_php5-mod-sqlite3
),)
317 PKG_CONFIGURE_OPTS
+= --with-sqlite3
=shared
,"$(STAGING_DIR)/usr"
318 PKG_CONFIGURE_LIBS
+= -lsqlite3
-lpthread
320 PKG_CONFIGURE_OPTS
+= --without-sqlite3
323 ifneq ($(CONFIG_PACKAGE_php5-mod-sysvmsg
),)
324 PKG_CONFIGURE_OPTS
+= --enable-sysvmsg
=shared
326 PKG_CONFIGURE_OPTS
+= --disable-sysvmsg
329 ifneq ($(CONFIG_PACKAGE_php5-mod-sysvsem
),)
330 PKG_CONFIGURE_OPTS
+= --enable-sysvsem
=shared
332 PKG_CONFIGURE_OPTS
+= --disable-sysvsem
335 ifneq ($(CONFIG_PACKAGE_php5-mod-sysvshm
),)
336 PKG_CONFIGURE_OPTS
+= --enable-sysvshm
=shared
338 PKG_CONFIGURE_OPTS
+= --disable-sysvshm
341 ifneq ($(CONFIG_PACKAGE_php5-mod-tokenizer
),)
342 PKG_CONFIGURE_OPTS
+= --enable-tokenizer
=shared
344 PKG_CONFIGURE_OPTS
+= --disable-tokenizer
347 ifneq ($(CONFIG_PACKAGE_php5-mod-xml
),)
348 PKG_CONFIGURE_OPTS
+= --enable-xml
=shared
,"$(STAGING_DIR)/usr"
349 ifneq ($(CONFIG_PHP5_LIBXML
),)
350 PKG_CONFIGURE_OPTS
+= --with-libxml-dir
="$(STAGING_DIR)/usr/include/libxml2"
352 PKG_CONFIGURE_OPTS
+= --with-libexpat-dir
="$(STAGING_DIR)/usr"
355 PKG_CONFIGURE_OPTS
+= --disable-xml
358 ifneq ($(CONFIG_PACKAGE_php5-mod-xmlreader
),)
359 PKG_CONFIGURE_OPTS
+= --enable-xmlreader
=shared
,"$(STAGING_DIR)/usr"
361 PKG_CONFIGURE_OPTS
+= --disable-xmlreader
364 ifneq ($(CONFIG_PACKAGE_php5-mod-xmlwriter
),)
365 PKG_CONFIGURE_OPTS
+= --enable-xmlwriter
=shared
,"$(STAGING_DIR)/usr"
367 PKG_CONFIGURE_OPTS
+= --disable-xmlwriter
370 ifneq ($(CONFIG_PHP5_FILTER
),)
371 PKG_CONFIGURE_OPTS
+= --enable-filter
373 PKG_CONFIGURE_OPTS
+= --disable-filter
376 ifneq ($(CONFIG_PHP5_LIBXML
),)
377 PKG_CONFIGURE_OPTS
+= --enable-libxml
378 PKG_CONFIGURE_OPTS
+= --with-libxml-dir
="$(STAGING_DIR)/usr/include/libxml2"
380 PKG_CONFIGURE_OPTS
+= --disable-libxml
384 define Build
/Configure
387 ifneq ($(CONFIG_PACKAGE_php5-cli
),)
388 define Build
/Compile
/php5-cli
389 -$(MAKE
) -C
$(PKG_BUILD_DIR
) clean
390 $(call Build
/Configure
/Default
, \
391 $(PKG_CONFIGURE_OPTS
) \
395 LIBS
="$(PKG_CONFIGURE_LIBS)" \
396 php_cv_cc_rpath
="no" \
397 iconv_impl_name
="gnu_libiconv" \
398 ac_cv_php_xml2_config_path
="$(STAGING_DIR)/host/bin/xml2-config" \
400 $(MAKE
) $(PKG_JOBS
) -C
$(PKG_BUILD_DIR
)
401 mv
$(PKG_BUILD_DIR
)/sapi
/cli
/php
$(PKG_BUILD_DIR
)/php-cli
405 ifneq ($(CONFIG_PACKAGE_php5-cgi
),)
406 define Build
/Compile
/php5-cgi
407 -$(MAKE
) -C
$(PKG_BUILD_DIR
) clean
408 $(call Build
/Configure
/Default
, \
409 $(PKG_CONFIGURE_OPTS
) \
413 LIBS
="$(PKG_CONFIGURE_LIBS)" \
414 php_cv_cc_rpath
="no" \
415 iconv_impl_name
="gnu_libiconv" \
416 ac_cv_php_xml2_config_path
="$(STAGING_DIR)/host/bin/xml2-config" \
418 $(MAKE
) $(PKG_JOBS
) -C
$(PKG_BUILD_DIR
)
419 mv
$(PKG_BUILD_DIR
)/sapi
/cgi
/php-cgi
$(PKG_BUILD_DIR
)/php-cgi
424 $(call Build
/Compile
/php5-cli
)
425 $(call Build
/Compile
/php5-cgi
)
428 define Package
/php5
/conffiles
432 define Package
/php5
/install
433 $(INSTALL_DIR
) $(1)/etc
434 $(INSTALL_DATA
) .
/files
/php.ini
$(1)/etc
/
437 define Package
/php5-cli
/install
438 $(INSTALL_DIR
) $(1)/usr
/bin
439 $(CP
) $(PKG_BUILD_DIR
)/php-cli
$(1)/usr
/bin
/php-cli
442 define Package
/php5-cgi
/install
443 $(INSTALL_DIR
) $(1)/usr
/bin
444 $(CP
) $(PKG_BUILD_DIR
)/php-cgi
$(1)/usr
/bin
/php-cgi
445 ln
-sf php-cgi
$(1)/usr
/bin
/php-fcgi
448 define Package
/php5-fastcgi
/install
449 $(INSTALL_DIR
) $(1)/etc
/init.d
450 $(INSTALL_BIN
) .
/files
/php.init
$(1)/etc
/init.d
/php
456 define Package
/php5-mod-
$(1)
457 $(call Package
/php5
/Default
)
463 TITLE
:=$(2) shared module
466 define Package
/php5-mod-
$(1)/config
467 depends on PACKAGE_php5-cli || PACKAGE_php5-cgi
471 define Package
/php5-mod-
$(1)/install
472 $(INSTALL_DIR
) $$(1)/usr
/lib
/php
473 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/modules
/$(subst -,_
,$(1)).so
$$(1)/usr
/lib
/php
/
474 $(INSTALL_DIR
) $$(1)/etc
/php5
475 echo
"extension=$(subst -,_,$(1)).so" > $$(1)/etc
/php5
/$(subst -,_
,$(1)).ini
478 PHP5_MODULES
+= php5-mod-
$(1)
481 $(eval
$(call BuildPackage
,php5
))
482 $(eval
$(call BuildPackage
,php5-cli
))
483 $(eval
$(call BuildPackage
,php5-cgi
))
484 $(eval
$(call BuildPackage
,php5-fastcgi
))
486 $(eval
$(call BuildModule
,apc
,APC
))
487 $(eval
$(call BuildModule
,ctype
,Ctype
))
488 $(eval
$(call BuildModule
,curl
,cURL
,php5
+libcurl
))
489 $(eval
$(call BuildModule
,fileinfo
,Fileinfo
,php5
+libmagic
))
490 $(eval
$(call BuildModule
,dom
,DOM
,php5
+libxml2
,depends on PHP5_LIBXML
))
491 $(eval
$(call BuildModule
,exif
,EXIF
))
492 $(eval
$(call BuildModule
,ftp
,FTP
))
493 $(eval
$(call BuildModule
,gd
,GD graphics
,php5
+libgd
))
494 $(eval
$(call BuildModule
,gmp
,GMP
,php5
+libgmp
))
495 $(eval
$(call BuildModule
,hash
,Hash
))
496 $(eval
$(call BuildModule
,iconv
,iConv
,php5
+libiconv
))
497 $(eval
$(call BuildModule
,json
,JSON
))
498 $(eval
$(call BuildModule
,ldap
,LDAP
,php5
+libopenldap
+libsasl2
))
499 $(eval
$(call BuildModule
,mbstring
,MBString
))
500 $(eval
$(call BuildModule
,mcrypt
,Mcrypt
,php5
+libmcrypt
+libltdl
))
501 $(eval
$(call BuildModule
,mysql
,MySQL
,php5
+libmysqlclient
))
502 $(eval
$(call BuildModule
,openssl
,OpenSSL
,php5
+libopenssl
))
503 $(eval
$(call BuildModule
,pcntl
,PCNTL
))
504 $(eval
$(call BuildModule
,pdo
,PHP Data Objects
))
505 $(eval
$(call BuildModule
,pdo-mysql
,PDO driver for MySQL
,php5-mod-pdo
+libmysqlclient
))
506 $(eval
$(call BuildModule
,pdo-pgsql
,PDO driver for PostgreSQL
,php5-mod-pdo
+libpq
))
507 $(eval
$(call BuildModule
,pdo-sqlite
,PDO driver for SQLite
3.x
,php5-mod-pdo
+libsqlite3
+libpthread
))
508 $(eval
$(call BuildModule
,pgsql
,PostgreSQL
,php5
+libpq
))
509 $(eval
$(call BuildModule
,session
,Session
))
510 $(eval
$(call BuildModule
,simplexml
,SimpleXML
,php5
+libxml2
,depends on PHP5_LIBXML
))
511 $(eval
$(call BuildModule
,soap
,SOAP
,php5
+libxml2
,depends on PHP5_LIBXML
))
512 $(eval
$(call BuildModule
,sockets
,Sockets
))
513 $(eval
$(call BuildModule
,sqlite
,SQLite
2.x
,php5
+libsqlite2
))
514 $(eval
$(call BuildModule
,sqlite3
,SQLite3
,php5
+libsqlite3
+libpthread
))
515 $(eval
$(call BuildModule
,sysvmsg
,System V messages
))
516 $(eval
$(call BuildModule
,sysvsem
,System V shared memory
))
517 $(eval
$(call BuildModule
,sysvshm
,System V semaphore
))
518 $(eval
$(call BuildModule
,tokenizer
,Tokenizer
))
519 $(eval
$(call BuildModule
,xml
,XML
,php5
$(if
$(CONFIG_PHP5_LIBXML
),+libxml2
,+libexpat
)))
520 $(eval
$(call BuildModule
,xmlreader
,XMLReader
,php5
+libxml2
+libiconv
,depends on PHP5_LIBXML
))
521 $(eval
$(call BuildModule
,xmlwriter
,XMLWriter
,php5
+libxml2
+libiconv
,depends on PHP5_LIBXML
))
523 PKG_CONFIG_DEPENDS
:= $(patsubst %,CONFIG_PACKAGE_
%,$(PHP5_MODULES
))
524 $(foreach p
,$(PHP5_MODULES
),$(eval
$(call BuildPackage
,$(p
))))