2 # Copyright (C) 2006 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
9 include $(TOPDIR)/rules.mk
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
16 PKG_SOURCE_URL:=http://www.php.net/distributions/
17 PKG_MD5SUM:=55c97a671fdabf462cc7a82971a656d2
19 include $(INCLUDE_DIR)/package.mk
21 define Package/php5/Default
24 TITLE:=PHP5 Hypertext preprocessor
26 PHP is a widely-used general-purpose scripting language that is especially \\\
27 suited for Web development and can be embedded into HTML.
28 URL:=http://www.php.net/
32 $(call Package/php5/Default)
33 DEPENDS:=+libopenssl +zlib
36 This package contains only the PHP config file. You must actually choose your \\\
37 PHP flavour (cli, cgi or fastcgi).
41 define Package/php5/conffiles
45 define Package/php5-cli
46 $(call Package/php5/Default)
51 This package contains the CLI version of the PHP5 interpreter.
54 define Package/php5-cgi
55 $(call Package/php5/Default)
60 This package contains the CGI version of the PHP5 interpreter.
63 define Package/php5-fastcgi
64 $(call Package/php5/Default)
69 This package contains the FastCGI version of the PHP5 interpreter.
72 define Package/php5-mod-curl
73 $(call Package/php5/Default)
74 DEPENDS:=php5 +libcurl
78 define Package/php5-mod-ftp
79 $(call Package/php5/Default)
84 define Package/php5-mod-gd
85 $(call Package/php5/Default)
87 TITLE:=GD graphics module
90 define Package/php5-mod-gmp
91 $(call Package/php5/Default)
96 define Package/php5-mod-ldap
97 $(call Package/php5/Default)
98 DEPENDS:=php5 +libopenldap
102 define Package/php5-mod-mysql
103 $(call Package/php5/Default)
104 DEPENDS:=php5 +libmysqlclient
108 define Package/php5-mod-openssl
109 $(call Package/php5/Default)
110 DEPENDS:=php5 +libopenssl
111 TITLE:=OpenSSL module
114 define Package/php5-mod-pcre
115 $(call Package/php5/Default)
116 DEPENDS:=php5 +libpcre
120 define Package/php5-mod-pgsql
121 $(call Package/php5/Default)
123 TITLE:=PostgreSQL module
126 define Package/php5-mod-session
127 $(call Package/php5/Default)
129 TITLE:=Session module
132 define Package/php5-mod-sockets
133 $(call Package/php5/Default)
135 TITLE:=Sockets module
138 define Package/php5-mod-sqlite
139 $(call Package/php5/Default)
140 DEPENDS:=php5 +libsqlite2
144 define Package/php5-mod-xml
145 $(call Package/php5/Default)
146 DEPENDS:=php5 +libexpat
150 define Package/php5-mod-apc
151 $(call Package/php5/Default)
156 PKG_CONFIGURE_LIBS:= -lcrypto -lssl
157 PKG_CONFIGURE_OPTS:= \
165 --with-config-file-path=/etc \
167 --enable-magic-quotes \
168 --enable-memory-limit \
169 --disable-short-tags \
173 --enable-ftp=shared \
177 --without-libxml-dir \
178 --disable-xmlreader \
179 --disable-xmlwriter \
182 --with-openssl=shared,"$(STAGING_DIR)/usr" \
184 --with-openssl-dir="$(STAGING_DIR)/usr" \
185 --enable-session=shared \
186 --disable-simplexml \
188 --enable-sockets=shared \
189 --disable-tokenizer \
190 --with-zlib="$(STAGING_DIR)/usr" \
191 --with-zlib-dir="$(STAGING_DIR)/usr" \
195 PKG_BUILD_DEPENDS:=libopenssl zlib libcurl libgd libgmp libopenldap libmysqlclient libpq libsqlite2 libexpat
196 # force PKG_CONFIGURE_{LIBS,OPTS} below when built in the SDK
197 CONFIG_PACKAGE_php5-cli:=m
198 CONFIG_PACKAGE_php5-cgi:=m
199 CONFIG_PACKAGE_php5-fastcgi:=m
200 CONFIG_PACKAGE_php5-mod-curl:=m
201 CONFIG_PACKAGE_php5-mod-gd:=m
202 CONFIG_PACKAGE_php5-mod-gmp:=m
203 CONFIG_PACKAGE_php5-mod-ldap:=m
204 CONFIG_PACKAGE_php5-mod-mysql:=m
205 CONFIG_PACKAGE_php5-mod-pcre:=m
206 CONFIG_PACKAGE_php5-mod-pgsql:=m
207 CONFIG_PACKAGE_php5-mod-sqlite:=m
208 CONFIG_PACKAGE_php5-mod-xml:=m
211 ifneq ($(CONFIG_PACKAGE_php5-mod-curl),)
212 PKG_CONFIGURE_OPTS+= --with-curl=shared,"$(STAGING_DIR)/usr"
214 PKG_CONFIGURE_OPTS+= --without-curl
216 ifneq ($(CONFIG_PACKAGE_php5-mod-gd),)
217 PKG_CONFIGURE_OPTS+= --with-gd=shared,"$(STAGING_DIR)/usr" \
218 --without-freetype-dir \
219 --with-jpeg-dir="$(STAGING_DIR)/usr" \
220 --with-png-dir="$(STAGING_DIR)/usr" \
224 --enable-gd-native-ttf \
225 --disable-gd-jis-conv
227 PKG_CONFIGURE_OPTS+= --without-gd
229 ifneq ($(CONFIG_PACKAGE_php5-mod-gmp),)
230 PKG_CONFIGURE_OPTS+= --with-gmp=shared,"$(STAGING_DIR)/usr"
232 PKG_CONFIGURE_OPTS+= --without-gmp
234 ifneq ($(CONFIG_PACKAGE_php5-mod-ldap),)
235 PKG_CONFIGURE_OPTS+= --with-ldap=shared,"$(STAGING_DIR)/usr" \
236 --with-ldap-sasl="$(STAGING_DIR)/usr"
238 PKG_CONFIGURE_OPTS+= --without-ldap
240 ifneq ($(CONFIG_PACKAGE_php5-mod-mysql),)
241 PKG_CONFIGURE_OPTS+= --with-mysql=shared,"$(STAGING_DIR)/usr"
243 PKG_CONFIGURE_OPTS+= --without-mysql
245 ifneq ($(CONFIG_PACKAGE_php5-mod-pcre),)
246 PKG_CONFIGURE_OPTS+= --with-pcre-regex=shared,"$(STAGING_DIR)/usr"
248 PKG_CONFIGURE_OPTS+= --without-pcre-regex
250 ifneq ($(CONFIG_PACKAGE_php5-mod-pgsql),)
251 PKG_CONFIGURE_OPTS+= --with-pgsql=shared,"$(STAGING_DIR)/usr"
253 PKG_CONFIGURE_OPTS+= --without-pgsql
255 ifneq ($(CONFIG_PACKAGE_php5-mod-sqlite),)
256 PKG_CONFIGURE_OPTS+= --with-sqlite=shared,"$(STAGING_DIR)/usr"
258 PKG_CONFIGURE_OPTS+= --without-sqlite
260 ifneq ($(CONFIG_PACKAGE_php5-mod-xml),)
261 PKG_CONFIGURE_OPTS+= --enable-xml=shared,"$(STAGING_DIR)/usr" \
262 --with-libexpat-dir="$(STAGING_DIR)/usr"
264 PKG_CONFIGURE_OPTS+= --disable-xml
266 ifneq ($(CONFIG_PACKAGE_php5-mod-apc),)
267 PKG_CONFIGURE_OPTS+= --enable-apc --disable-apc-mmap
268 PKG_CONFIGURE_LIBS+= -lrt
270 PKG_CONFIGURE_OPTS+= --disable-apc
273 define Build/Configure
276 ifneq ($(CONFIG_PACKAGE_php5-cli),)
277 define Build/Compile/php5-cli
278 -$(MAKE) -C $(PKG_BUILD_DIR) clean
279 $(call Build/Configure/Default, \
280 $(PKG_CONFIGURE_OPTS) \
284 --enable-force-cgi-redirect \
285 --enable-discard-path \
287 LIBS="$(PKG_CONFIGURE_LIBS)" \
288 php_cv_cc_rpath="no" \
290 $(MAKE) -C $(PKG_BUILD_DIR)
291 mv $(PKG_BUILD_DIR)/sapi/cli/php $(PKG_BUILD_DIR)/php-cli
295 ifneq ($(CONFIG_PACKAGE_php5-cgi),)
296 define Build/Compile/php5-cgi
297 -$(MAKE) -C $(PKG_BUILD_DIR) clean
298 $(call Build/Configure/Default, \
299 $(PKG_CONFIGURE_OPTS) \
303 --enable-force-cgi-redirect \
304 --enable-discard-path \
306 LIBS="$(PKG_CONFIGURE_LIBS)" \
307 php_cv_cc_rpath="no" \
309 $(MAKE) -C $(PKG_BUILD_DIR)
310 mv $(PKG_BUILD_DIR)/sapi/cgi/php-cgi $(PKG_BUILD_DIR)/php-cgi
314 ifneq ($(CONFIG_PACKAGE_php5-fastcgi),)
315 define Build/Compile/php5-fastcgi
316 -$(MAKE) -C $(PKG_BUILD_DIR) clean
317 rm $(PKG_BUILD_DIR)/configure
318 cd $(PKG_BUILD_DIR) && ./buildconf --force
319 $(call Build/Configure/Default, \
320 $(PKG_CONFIGURE_OPTS) \
324 --enable-force-cgi-redirect \
325 --enable-discard-path \
327 LIBS="$(PKG_CONFIGURE_LIBS)" \
328 php_cv_cc_rpath="no" \
330 $(MAKE) -C $(PKG_BUILD_DIR)
331 mv $(PKG_BUILD_DIR)/sapi/cgi/php-cgi $(PKG_BUILD_DIR)/php-fcgi
336 $(call Build/Compile/php5-cli)
337 $(call Build/Compile/php5-cgi)
338 $(call Build/Compile/php5-fastcgi)
341 define Package/php5/install
342 $(INSTALL_DIR) $(1)/etc
343 $(INSTALL_DATA) ./files/php.ini $(1)/etc/
346 define Package/php5-cli/install
347 $(INSTALL_DIR) $(1)/usr/bin
348 $(CP) $(PKG_BUILD_DIR)/php-cli $(1)/usr/bin/php-cli
351 define Package/php5-cgi/install
352 $(INSTALL_DIR) $(1)/usr/bin
353 $(CP) $(PKG_BUILD_DIR)/php-cgi $(1)/usr/bin/php-cgi
356 define Package/php5-fastcgi/install
357 $(INSTALL_DIR) $(1)/usr/bin
358 $(CP) $(PKG_BUILD_DIR)/php-fcgi $(1)/usr/bin/php-fcgi
359 $(INSTALL_DIR) $(1)/etc/init.d
360 $(INSTALL_BIN) ./files/php.init $(1)/etc/init.d/php
364 define Package/$(1)/install
365 [ -z "$(2)" ] || $(INSTALL_DIR) $$(1)/usr/lib/php
367 $(INSTALL_BIN) $(PKG_BUILD_DIR)/modules/$$$$$$$${m}.so $$(1)/usr/lib/php/ ; \
371 $$(eval $$(call BuildPackage,$(1)))
374 $(eval $(call BuildPackage,php5))
375 $(eval $(call BuildPackage,php5-cli))
376 $(eval $(call BuildPackage,php5-cgi))
377 $(eval $(call BuildPackage,php5-fastcgi))
378 $(eval $(call BuildPlugin,php5-mod-curl,curl))
379 $(eval $(call BuildPlugin,php5-mod-ftp,ftp))
380 $(eval $(call BuildPlugin,php5-mod-gd,gd))
381 $(eval $(call BuildPlugin,php5-mod-gmp,gmp))
382 $(eval $(call BuildPlugin,php5-mod-ldap,ldap))
383 $(eval $(call BuildPlugin,php5-mod-mysql,mysql))
384 $(eval $(call BuildPlugin,php5-mod-openssl,openssl))
385 $(eval $(call BuildPlugin,php5-mod-pcre,pcre))
386 $(eval $(call BuildPlugin,php5-mod-pgsql,pgsql))
387 $(eval $(call BuildPlugin,php5-mod-session,session))
388 $(eval $(call BuildPlugin,php5-mod-sockets,sockets))
389 $(eval $(call BuildPlugin,php5-mod-sqlite,sqlite))
390 $(eval $(call BuildPlugin,php5-mod-xml,xml))
391 $(eval $(call BuildPlugin,php5-mod-apc))