2 # Copyright (C) 2006-2008 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:=php-$(PKG_VERSION).tar.bz2
16 PKG_SOURCE_URL:=http://fr.php.net/distributions/
17 PKG_MD5SUM:=3f21b44d37a57ca3876d3aea713c700d
18 PKG_BUILD_DIR:=$(BUILD_DIR)/php-$(PKG_VERSION)
20 include $(INCLUDE_DIR)/package.mk
22 define Package/php4/Default
26 TITLE:=PHP4 Hypertext preprocessor
27 DEPENDS:=@!TARGET_ixp4xx
28 URL:=http://www.php.net/
31 define Package/php4/Default/description
32 PHP is a widely-used general-purpose scripting language that is especially
33 suited for Web development and can be embedded into HTML.
37 $(call Package/php4/Default)
38 DEPENDS:=+libopenssl +zlib
41 define Package/php4/description
42 $(call Package/php4/Default/description)
43 This package contains only the PHP config file. You must actually choose
44 your PHP flavour (cli, cgi or fastcgi).
47 define Package/php4-cli
48 $(call Package/php4/Default)
53 define Package/php4-cli/description
54 $(call Package/php4/Default/description)
55 This package contains the CLI version of the PHP4 interpreter.
58 define Package/php4-cgi
59 $(call Package/php4/Default)
64 define Package/php4-cgi/description
65 $(call Package/php4/Default/description)
66 This package contains the CGI version of the PHP4 interpreter.
69 define Package/php4-fastcgi
70 $(call Package/php4/Default)
75 define Package/php4-fastcgi/description
76 $(call Package/php4/Default/description)
77 This package contains the FastCGI version of the PHP4 interpreter.
80 define Package/php4-mod-curl
81 $(call Package/php4/Default)
82 DEPENDS:=php4 +libcurl
86 define Package/php4-mod-ftp
87 $(call Package/php4/Default)
92 define Package/php4-mod-gd
93 $(call Package/php4/Default)
95 TITLE:=GD graphics module
98 define Package/php4-mod-gmp
99 $(call Package/php4/Default)
100 DEPENDS:=php4 +libgmp
104 define Package/php4-mod-ldap
105 $(call Package/php4/Default)
106 DEPENDS:=php4 +libopenldap
110 define Package/php4-mod-mysql
111 $(call Package/php4/Default)
112 DEPENDS:=php4 +libmysqlclient
116 define Package/php4-mod-openssl
117 $(call Package/php4/Default)
118 DEPENDS:=php4 +libopenssl
119 TITLE:=OpenSSL module
122 define Package/php4-mod-pcre
123 $(call Package/php4/Default)
124 DEPENDS:=php4 +libpcre
128 define Package/php4-mod-pgsql
129 $(call Package/php4/Default)
131 TITLE:=PostgreSQL module
134 define Package/php4-mod-session
135 $(call Package/php4/Default)
137 TITLE:=Session module
140 define Package/php4-mod-sockets
141 $(call Package/php4/Default)
143 TITLE:=Sockets module
146 define Package/php4-mod-xml
147 $(call Package/php4/Default)
148 DEPENDS:=php4 +libexpat
152 PKG_CONFIGURE_LIBS:= -lcrypto -lssl
153 PKG_CONFIGURE_OPTS:= \
160 --with-config-file-path=/etc \
162 --enable-magic-quotes \
163 --enable-memory-limit \
165 --disable-short-tags \
169 --enable-ftp=shared \
174 --with-openssl=shared,"$(STAGING_DIR)/usr" \
176 --with-openssl-dir="$(STAGING_DIR)/usr" \
177 --enable-session=shared \
178 --enable-sockets=shared \
179 --disable-tokenizer \
180 --with-zlib="$(STAGING_DIR)/usr" \
181 --with-zlib-dir="$(STAGING_DIR)/usr" \
184 PKG_BUILD_DEPENDS:=libopenssl zlib libcurl libgd libgmp libopenldap libmysqlclient libpq libexpat
185 # force PKG_CONFIGURE_{LIBS,OPTS} below when built in the SDK
186 CONFIG_PACKAGE_php4-cli:=m
187 CONFIG_PACKAGE_php4-cgi:=m
188 CONFIG_PACKAGE_php4-fastcgi:=m
189 CONFIG_PACKAGE_php4-mod-curl:=m
190 CONFIG_PACKAGE_php4-mod-gd:=m
191 CONFIG_PACKAGE_php4-mod-gmp:=m
192 CONFIG_PACKAGE_php4-mod-ldap:=m
193 CONFIG_PACKAGE_php4-mod-mysql:=m
194 CONFIG_PACKAGE_php4-mod-pcre:=m
195 CONFIG_PACKAGE_php4-mod-pgsql:=m
196 CONFIG_PACKAGE_php4-mod-xml:=m
199 ifneq ($(CONFIG_PACKAGE_php4-mod-curl),)
200 PKG_CONFIGURE_OPTS+= --with-curl=shared,"$(STAGING_DIR)/usr"
202 PKG_CONFIGURE_OPTS+= --without-curl
204 ifneq ($(CONFIG_PACKAGE_php4-mod-gd),)
205 PKG_CONFIGURE_OPTS+= --with-gd=shared,"$(STAGING_DIR)/usr" \
206 --without-freetype-dir \
207 --with-jpeg-dir="$(STAGING_DIR)/usr" \
208 --with-png-dir="$(STAGING_DIR)/usr" \
212 --enable-gd-native-ttf \
213 --disable-gd-jis-conv
215 PKG_CONFIGURE_OPTS+= --without-gd
217 ifneq ($(CONFIG_PACKAGE_php4-mod-gmp),)
218 PKG_CONFIGURE_OPTS+= --with-gmp=shared,"$(STAGING_DIR)/usr"
220 PKG_CONFIGURE_OPTS+= --without-gmp
222 ifneq ($(CONFIG_PACKAGE_php4-mod-ldap),)
223 PKG_CONFIGURE_OPTS+= --with-ldap=shared,"$(STAGING_DIR)/usr"
224 --with-ldap-sasl="$(STAGING_DIR)/usr"
226 PKG_CONFIGURE_OPTS+= --without-ldap
228 ifneq ($(CONFIG_PACKAGE_php4-mod-mysql),)
229 PKG_CONFIGURE_OPTS+= --with-mysql=shared,"$(STAGING_DIR)/usr"
231 PKG_CONFIGURE_OPTS+= --without-mysql
233 ifneq ($(CONFIG_PACKAGE_php4-mod-pcre),)
234 PKG_CONFIGURE_OPTS+= --with-pcre-regex=shared,"$(STAGING_DIR)/usr"
236 PKG_CONFIGURE_OPTS+= --without-pcre-regex
238 ifneq ($(CONFIG_PACKAGE_php4-mod-pgsql),)
239 PKG_CONFIGURE_OPTS+= --with-pgsql=shared,"$(STAGING_DIR)/usr"
241 PKG_CONFIGURE_OPTS+= --without-pgsql
243 ifneq ($(CONFIG_PACKAGE_php4-mod-xml),)
244 PKG_CONFIGURE_OPTS+= --enable-xml=shared \
245 --with-expat-dir="$(STAGING_DIR)/usr"
247 PKG_CONFIGURE_OPTS+= --disable-xml
250 define Build/Configure
253 ifneq ($(CONFIG_PACKAGE_php4-cli),)
254 define Build/Compile/php4-cli
255 -$(MAKE) -C $(PKG_BUILD_DIR) clean
256 $(call Build/Configure/Default, \
257 $(PKG_CONFIGURE_OPTS) \
261 --enable-force-cgi-redirect \
262 --enable-discard-path \
264 LIBS="$(PKG_CONFIGURE_LIBS)" \
265 php_cv_cc_rpath="no" \
267 $(MAKE) -C $(PKG_BUILD_DIR)
268 mv $(PKG_BUILD_DIR)/sapi/cli/php $(PKG_BUILD_DIR)/php-cli
272 ifneq ($(CONFIG_PACKAGE_php4-cgi),)
273 define Build/Compile/php4-cgi
274 -$(MAKE) -C $(PKG_BUILD_DIR) clean
275 $(call Build/Configure/Default, \
276 $(PKG_CONFIGURE_OPTS) \
280 --enable-force-cgi-redirect \
281 --enable-discard-path \
283 LIBS="$(PKG_CONFIGURE_LIBS)" \
284 php_cv_cc_rpath="no" \
286 $(MAKE) -C $(PKG_BUILD_DIR)
287 mv $(PKG_BUILD_DIR)/sapi/cgi/php $(PKG_BUILD_DIR)/php-cgi
291 ifneq ($(CONFIG_PACKAGE_php4-fastcgi),)
292 define Build/Compile/php4-fastcgi
293 -$(MAKE) -C $(PKG_BUILD_DIR) clean
294 $(call Build/Configure/Default, \
295 $(PKG_CONFIGURE_OPTS) \
299 --enable-force-cgi-redirect \
300 --enable-discard-path \
302 LIBS="$(PKG_CONFIGURE_LIBS)" \
303 php_cv_cc_rpath="no" \
305 $(MAKE) -C $(PKG_BUILD_DIR)
306 mv $(PKG_BUILD_DIR)/sapi/cgi/php $(PKG_BUILD_DIR)/php-fastcgi
311 $(call Build/Compile/php4-cli)
312 $(call Build/Compile/php4-cgi)
313 $(call Build/Compile/php4-fastcgi)
316 define Package/php4/conffiles
320 define Package/php4/install
321 $(INSTALL_DIR) $(1)/etc
322 $(INSTALL_DATA) ./files/php.ini $(1)/etc/
325 define Package/php4-cli/install
326 $(INSTALL_DIR) $(1)/usr/bin
327 $(CP) $(PKG_BUILD_DIR)/php-cli $(1)/usr/bin/php
330 define Package/php4-cgi/install
331 $(INSTALL_DIR) $(1)/usr/bin
332 $(CP) $(PKG_BUILD_DIR)/php-cgi $(1)/usr/bin/php
335 define Package/php4-fastcgi/install
336 $(INSTALL_DIR) $(1)/usr/sbin
337 $(CP) $(PKG_BUILD_DIR)/php-fastcgi $(1)/usr/sbin/php
338 $(INSTALL_DIR) $(1)/etc/init.d
339 $(INSTALL_BIN) ./files/php.init $(1)/etc/init.d/php
343 define Package/$(1)/install
344 [ -z "$(2)" ] || $(INSTALL_DIR) $$(1)/usr/lib/php
346 $(INSTALL_BIN) $(PKG_BUILD_DIR)/modules/$$$$$$$${m}.so $$(1)/usr/lib/php/ ; \
350 $$(eval $$(call BuildPackage,$(1)))
353 $(eval $(call BuildPackage,php4))
354 $(eval $(call BuildPackage,php4-cli))
355 $(eval $(call BuildPackage,php4-cgi))
356 $(eval $(call BuildPackage,php4-fastcgi))
357 $(eval $(call BuildPlugin,php4-mod-curl,curl))
358 $(eval $(call BuildPlugin,php4-mod-ftp,ftp))
359 $(eval $(call BuildPlugin,php4-mod-gd,gd))
360 $(eval $(call BuildPlugin,php4-mod-gmp,gmp))
361 $(eval $(call BuildPlugin,php4-mod-ldap,ldap))
362 $(eval $(call BuildPlugin,php4-mod-mysql,mysql))
363 $(eval $(call BuildPlugin,php4-mod-openssl,openssl))
364 $(eval $(call BuildPlugin,php4-mod-pcre,pcre))
365 $(eval $(call BuildPlugin,php4-mod-pgsql,pgsql))
366 $(eval $(call BuildPlugin,php4-mod-session,session))
367 $(eval $(call BuildPlugin,php4-mod-sockets,sockets))
368 $(eval $(call BuildPlugin,php4-mod-xml,xml))