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://fr.php.net/distributions/
17 PKG_MD5SUM:=fbc67d240812136a9842bc1f2a217b7a
20 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
22 include $(INCLUDE_DIR)/package.mk
24 define Package/php4/Default
27 TITLE:=PHP4 Hypertext preprocessor
29 PHP is a widely-used general-purpose scripting language that is especially \\\
30 suited for Web development and can be embedded into HTML.
31 URL:=http://www.php.net/
35 $(call Package/php4/Default)
36 DEPENDS:=+libopenssl +zlib
39 This package contains only the PHP config file. You must actually choose your \\\
40 PHP flavour (cli, cgi or fastcgi).
44 define Package/php4/conffiles
48 define Package/php4-cli
49 $(call Package/php4/Default)
54 This package contains the CLI version of the PHP4 interpreter.
57 define Package/php4-cgi
58 $(call Package/php4/Default)
63 This package contains the CGI version of the PHP4 interpreter.
66 define Package/php4-fastcgi
67 $(call Package/php4/Default)
72 This package contains the FastCGI version of the PHP4 interpreter.
75 define Package/php4-mod-curl
76 $(call Package/php4/Default)
77 DEPENDS:=php4 +libcurl
81 define Package/php4-mod-ftp
82 $(call Package/php4/Default)
87 define Package/php4-mod-gd
88 $(call Package/php4/Default)
90 TITLE:=GD graphics module
93 define Package/php4-mod-gmp
94 $(call Package/php4/Default)
99 define Package/php4-mod-ldap
100 $(call Package/php4/Default)
101 DEPENDS:=php4 +libopenldap
105 define Package/php4-mod-mysql
106 $(call Package/php4/Default)
107 DEPENDS:=php4 +libmysqlclient
111 define Package/php4-mod-openssl
112 $(call Package/php4/Default)
113 DEPENDS:=php4 +libopenssl
114 TITLE:=OpenSSL module
117 define Package/php4-mod-pcre
118 $(call Package/php4/Default)
119 DEPENDS:=php4 +libpcre
123 define Package/php4-mod-pgsql
124 $(call Package/php4/Default)
126 TITLE:=PostgreSQL module
129 define Package/php4-mod-session
130 $(call Package/php4/Default)
132 TITLE:=Session module
135 define Package/php4-mod-sockets
136 $(call Package/php4/Default)
138 TITLE:=Sockets module
141 define Package/php4-mod-sqlite
142 $(call Package/php4/Default)
143 DEPENDS:=php4 +libsqlite2
147 define Package/php4-mod-xml
148 $(call Package/php4/Default)
149 DEPENDS:=php4 +libexpat
153 PKG_CONFIGURE_LIBS:= -lcrypto -lssl
154 PKG_CONFIGURE_OPTS:= \
161 --with-config-file-path=/etc \
163 --enable-magic-quotes \
164 --enable-memory-limit \
166 --disable-short-tags \
170 --enable-ftp=shared \
175 --with-openssl=shared,"$(STAGING_DIR)/usr" \
177 --with-openssl-dir="$(STAGING_DIR)/usr" \
178 --enable-session=shared \
179 --enable-sockets=shared \
180 --disable-tokenizer \
181 --with-zlib="$(STAGING_DIR)/usr" \
182 --with-zlib-dir="$(STAGING_DIR)/usr" \
185 PKG_BUILDDEP:=libopenssl zlib libcurl libgd libgmp libopenldap libmysqlclient libpq libsqlite2 libexpat
186 # force PKG_CONFIGURE_{LIBS,OPTS} below when built in the SDK
187 CONFIG_PACKAGE_php4-cli:=m
188 CONFIG_PACKAGE_php4-cgi:=m
189 CONFIG_PACKAGE_php4-fastcgi:=m
190 CONFIG_PACKAGE_php4-mod-curl:=m
191 CONFIG_PACKAGE_php4-mod-gd:=m
192 CONFIG_PACKAGE_php4-mod-gmp:=m
193 CONFIG_PACKAGE_php4-mod-ldap:=m
194 CONFIG_PACKAGE_php4-mod-mysql:=m
195 CONFIG_PACKAGE_php4-mod-pcre:=m
196 CONFIG_PACKAGE_php4-mod-pgsql:=m
197 CONFIG_PACKAGE_php4-mod-sqlite:=m
198 CONFIG_PACKAGE_php4-mod-xml:=m
201 ifneq ($(CONFIG_PACKAGE_php4-mod-curl),)
202 PKG_CONFIGURE_OPTS+= --with-curl=shared,"$(STAGING_DIR)/usr"
204 PKG_CONFIGURE_OPTS+= --without-curl
206 ifneq ($(CONFIG_PACKAGE_php4-mod-gd),)
207 PKG_CONFIGURE_OPTS+= --with-gd=shared,"$(STAGING_DIR)/usr" \
208 --without-freetype-dir \
209 --with-jpeg-dir="$(STAGING_DIR)/usr" \
210 --with-png-dir="$(STAGING_DIR)/usr" \
214 --enable-gd-native-ttf \
215 --disable-gd-jis-conv
217 PKG_CONFIGURE_OPTS+= --without-gd
219 ifneq ($(CONFIG_PACKAGE_php4-mod-gmp),)
220 PKG_CONFIGURE_OPTS+= --with-gmp=shared,"$(STAGING_DIR)/usr"
222 PKG_CONFIGURE_OPTS+= --without-gmp
224 ifneq ($(CONFIG_PACKAGE_php4-mod-ldap),)
225 PKG_CONFIGURE_OPTS+= --with-ldap=shared,"$(STAGING_DIR)/usr"
226 --with-ldap-sasl="$(STAGING_DIR)/usr"
228 PKG_CONFIGURE_OPTS+= --without-ldap
230 ifneq ($(CONFIG_PACKAGE_php4-mod-mysql),)
231 PKG_CONFIGURE_OPTS+= --with-mysql=shared,"$(STAGING_DIR)/usr"
233 PKG_CONFIGURE_OPTS+= --without-mysql
235 ifneq ($(CONFIG_PACKAGE_php4-mod-pcre),)
236 PKG_CONFIGURE_OPTS+= --with-pcre-regex=shared,"$(STAGING_DIR)/usr"
238 PKG_CONFIGURE_OPTS+= --without-pcre-regex
240 ifneq ($(CONFIG_PACKAGE_php4-mod-pgsql),)
241 PKG_CONFIGURE_OPTS+= --with-pgsql=shared,"$(STAGING_DIR)/usr"
243 PKG_CONFIGURE_OPTS+= --without-pgsql
245 ifneq ($(CONFIG_PACKAGE_php4-mod-sqlite),)
246 PKG_CONFIGURE_OPTS+= --with-sqlite=shared,"$(STAGING_DIR)/usr"
248 PKG_CONFIGURE_OPTS+= --without-sqlite
250 ifneq ($(CONFIG_PACKAGE_php4-mod-xml),)
251 PKG_CONFIGURE_OPTS+= --enable-xml=shared \
252 --with-expat-dir="$(STAGING_DIR)/usr"
254 PKG_CONFIGURE_OPTS+= --disable-xml
257 define Build/Configure
260 ifneq ($(CONFIG_PACKAGE_php4-cli),)
261 define Build/Compile/php4-cli
262 -$(MAKE) -C $(PKG_BUILD_DIR) clean
263 $(call Build/Configure/Default, \
264 $(PKG_CONFIGURE_OPTS) \
268 --enable-force-cgi-redirect \
269 --enable-discard-path \
271 LIBS="$(PKG_CONFIGURE_LIBS)" \
272 php_cv_cc_rpath="no" \
274 $(MAKE) -C $(PKG_BUILD_DIR)
275 mv $(PKG_BUILD_DIR)/sapi/cli/php $(PKG_BUILD_DIR)/php-cli
279 ifneq ($(CONFIG_PACKAGE_php4-cgi),)
280 define Build/Compile/php4-cgi
281 -$(MAKE) -C $(PKG_BUILD_DIR) clean
282 $(call Build/Configure/Default, \
283 $(PKG_CONFIGURE_OPTS) \
287 --enable-force-cgi-redirect \
288 --enable-discard-path \
290 LIBS="$(PKG_CONFIGURE_LIBS)" \
291 php_cv_cc_rpath="no" \
293 $(MAKE) -C $(PKG_BUILD_DIR)
294 mv $(PKG_BUILD_DIR)/sapi/cgi/php $(PKG_BUILD_DIR)/php-cgi
298 ifneq ($(CONFIG_PACKAGE_php4-fastcgi),)
299 define Build/Compile/php4-fastcgi
300 -$(MAKE) -C $(PKG_BUILD_DIR) clean
301 $(call Build/Configure/Default, \
302 $(PKG_CONFIGURE_OPTS) \
306 --enable-force-cgi-redirect \
307 --enable-discard-path \
309 LIBS="$(PKG_CONFIGURE_LIBS)" \
310 php_cv_cc_rpath="no" \
312 $(MAKE) -C $(PKG_BUILD_DIR)
313 mv $(PKG_BUILD_DIR)/sapi/cgi/php $(PKG_BUILD_DIR)/php-fastcgi
318 $(call Build/Compile/php4-cli)
319 $(call Build/Compile/php4-cgi)
320 $(call Build/Compile/php4-fastcgi)
323 define Package/php4/install
324 $(INSTALL_DIR) $(1)/etc
325 $(INSTALL_DATA) ./files/php.ini $(1)/etc/
328 define Package/php4-cli/install
329 $(INSTALL_DIR) $(1)/usr/bin
330 $(CP) $(PKG_BUILD_DIR)/php-cli $(1)/usr/bin/php
333 define Package/php4-cgi/install
334 $(INSTALL_DIR) $(1)/usr/bin
335 $(CP) $(PKG_BUILD_DIR)/php-cgi $(1)/usr/bin/php
338 define Package/php4-fastcgi/install
339 $(INSTALL_DIR) $(1)/usr/sbin
340 $(CP) $(PKG_BUILD_DIR)/php-fastcgi $(1)/usr/sbin/php
341 $(INSTALL_DIR) $(1)/etc/init.d
342 $(INSTALL_BIN) ./files/php.init $(1)/etc/init.d/php
346 define Package/$(1)/install
347 [ -z "$(2)" ] || $(INSTALL_DIR) $$(1)/usr/lib/php
349 $(INSTALL_BIN) $(PKG_BUILD_DIR)/modules/$$$$$$$${m}.so $$(1)/usr/lib/php/ ; \
353 $$(eval $$(call BuildPackage,$(1)))
356 $(eval $(call BuildPackage,php4))
357 $(eval $(call BuildPackage,php4-cli))
358 $(eval $(call BuildPackage,php4-cgi))
359 $(eval $(call BuildPackage,php4-fastcgi))
360 $(eval $(call BuildPlugin,php4-mod-curl,curl))
361 $(eval $(call BuildPlugin,php4-mod-ftp,ftp))
362 $(eval $(call BuildPlugin,php4-mod-gd,gd))
363 $(eval $(call BuildPlugin,php4-mod-gmp,gmp))
364 $(eval $(call BuildPlugin,php4-mod-ldap,ldap))
365 $(eval $(call BuildPlugin,php4-mod-mysql,mysql))
366 $(eval $(call BuildPlugin,php4-mod-openssl,openssl))
367 $(eval $(call BuildPlugin,php4-mod-pcre,pcre))
368 $(eval $(call BuildPlugin,php4-mod-pgsql,pgsql))
369 $(eval $(call BuildPlugin,php4-mod-session,session))
370 $(eval $(call BuildPlugin,php4-mod-sockets,sockets))
371 $(eval $(call BuildPlugin,php4-mod-sqlite,sqlite))
372 $(eval $(call BuildPlugin,php4-mod-xml,xml))