2 # Copyright (C) 2006,2007 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:=fbc67d240812136a9842bc1f2a217b7a
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 URL:=http://www.php.net/
30 define Package/php4/Default/description
31 PHP is a widely-used general-purpose scripting language that is especially
32 suited for Web development and can be embedded into HTML.
36 $(call Package/php4/Default)
37 DEPENDS:=+libopenssl +zlib
40 define Package/php4/description
41 $(call Package/php4/Default/description)
42 This package contains only the PHP config file. You must actually choose
43 your PHP flavour (cli, cgi or fastcgi).
46 define Package/php4-cli
47 $(call Package/php4/Default)
52 define Package/php4-cli/description
53 $(call Package/php4/Default/description)
54 This package contains the CLI version of the PHP4 interpreter.
57 define Package/php4-cgi
58 $(call Package/php4/Default)
63 define Package/php4-cgi/description
64 $(call Package/php4/Default/description)
65 This package contains the CGI version of the PHP4 interpreter.
68 define Package/php4-fastcgi
69 $(call Package/php4/Default)
74 define Package/php4-fastcgi/description
75 $(call Package/php4/Default/description)
76 This package contains the FastCGI version of the PHP4 interpreter.
79 define Package/php4-mod-curl
80 $(call Package/php4/Default)
81 DEPENDS:=php4 +libcurl
85 define Package/php4-mod-ftp
86 $(call Package/php4/Default)
91 define Package/php4-mod-gd
92 $(call Package/php4/Default)
94 TITLE:=GD graphics module
97 define Package/php4-mod-gmp
98 $(call Package/php4/Default)
103 define Package/php4-mod-ldap
104 $(call Package/php4/Default)
105 DEPENDS:=php4 +libopenldap
109 define Package/php4-mod-mysql
110 $(call Package/php4/Default)
111 DEPENDS:=php4 +libmysqlclient
115 define Package/php4-mod-openssl
116 $(call Package/php4/Default)
117 DEPENDS:=php4 +libopenssl
118 TITLE:=OpenSSL module
121 define Package/php4-mod-pcre
122 $(call Package/php4/Default)
123 DEPENDS:=php4 +libpcre
127 define Package/php4-mod-pgsql
128 $(call Package/php4/Default)
130 TITLE:=PostgreSQL module
133 define Package/php4-mod-session
134 $(call Package/php4/Default)
136 TITLE:=Session module
139 define Package/php4-mod-sockets
140 $(call Package/php4/Default)
142 TITLE:=Sockets module
145 define Package/php4-mod-sqlite
146 $(call Package/php4/Default)
147 DEPENDS:=php4 +libsqlite2
151 define Package/php4-mod-xml
152 $(call Package/php4/Default)
153 DEPENDS:=php4 +libexpat
157 PKG_CONFIGURE_LIBS:= -lcrypto -lssl
158 PKG_CONFIGURE_OPTS:= \
165 --with-config-file-path=/etc \
167 --enable-magic-quotes \
168 --enable-memory-limit \
170 --disable-short-tags \
174 --enable-ftp=shared \
179 --with-openssl=shared,"$(STAGING_DIR)/usr" \
181 --with-openssl-dir="$(STAGING_DIR)/usr" \
182 --enable-session=shared \
183 --enable-sockets=shared \
184 --disable-tokenizer \
185 --with-zlib="$(STAGING_DIR)/usr" \
186 --with-zlib-dir="$(STAGING_DIR)/usr" \
189 PKG_BUILD_DEPENDS:=libopenssl zlib libcurl libgd libgmp libopenldap libmysqlclient libpq libsqlite2 libexpat
190 # force PKG_CONFIGURE_{LIBS,OPTS} below when built in the SDK
191 CONFIG_PACKAGE_php4-cli:=m
192 CONFIG_PACKAGE_php4-cgi:=m
193 CONFIG_PACKAGE_php4-fastcgi:=m
194 CONFIG_PACKAGE_php4-mod-curl:=m
195 CONFIG_PACKAGE_php4-mod-gd:=m
196 CONFIG_PACKAGE_php4-mod-gmp:=m
197 CONFIG_PACKAGE_php4-mod-ldap:=m
198 CONFIG_PACKAGE_php4-mod-mysql:=m
199 CONFIG_PACKAGE_php4-mod-pcre:=m
200 CONFIG_PACKAGE_php4-mod-pgsql:=m
201 CONFIG_PACKAGE_php4-mod-sqlite:=m
202 CONFIG_PACKAGE_php4-mod-xml:=m
205 ifneq ($(CONFIG_PACKAGE_php4-mod-curl),)
206 PKG_CONFIGURE_OPTS+= --with-curl=shared,"$(STAGING_DIR)/usr"
208 PKG_CONFIGURE_OPTS+= --without-curl
210 ifneq ($(CONFIG_PACKAGE_php4-mod-gd),)
211 PKG_CONFIGURE_OPTS+= --with-gd=shared,"$(STAGING_DIR)/usr" \
212 --without-freetype-dir \
213 --with-jpeg-dir="$(STAGING_DIR)/usr" \
214 --with-png-dir="$(STAGING_DIR)/usr" \
218 --enable-gd-native-ttf \
219 --disable-gd-jis-conv
221 PKG_CONFIGURE_OPTS+= --without-gd
223 ifneq ($(CONFIG_PACKAGE_php4-mod-gmp),)
224 PKG_CONFIGURE_OPTS+= --with-gmp=shared,"$(STAGING_DIR)/usr"
226 PKG_CONFIGURE_OPTS+= --without-gmp
228 ifneq ($(CONFIG_PACKAGE_php4-mod-ldap),)
229 PKG_CONFIGURE_OPTS+= --with-ldap=shared,"$(STAGING_DIR)/usr"
230 --with-ldap-sasl="$(STAGING_DIR)/usr"
232 PKG_CONFIGURE_OPTS+= --without-ldap
234 ifneq ($(CONFIG_PACKAGE_php4-mod-mysql),)
235 PKG_CONFIGURE_OPTS+= --with-mysql=shared,"$(STAGING_DIR)/usr"
237 PKG_CONFIGURE_OPTS+= --without-mysql
239 ifneq ($(CONFIG_PACKAGE_php4-mod-pcre),)
240 PKG_CONFIGURE_OPTS+= --with-pcre-regex=shared,"$(STAGING_DIR)/usr"
242 PKG_CONFIGURE_OPTS+= --without-pcre-regex
244 ifneq ($(CONFIG_PACKAGE_php4-mod-pgsql),)
245 PKG_CONFIGURE_OPTS+= --with-pgsql=shared,"$(STAGING_DIR)/usr"
247 PKG_CONFIGURE_OPTS+= --without-pgsql
249 ifneq ($(CONFIG_PACKAGE_php4-mod-sqlite),)
250 PKG_CONFIGURE_OPTS+= --with-sqlite=shared,"$(STAGING_DIR)/usr"
252 PKG_CONFIGURE_OPTS+= --without-sqlite
254 ifneq ($(CONFIG_PACKAGE_php4-mod-xml),)
255 PKG_CONFIGURE_OPTS+= --enable-xml=shared \
256 --with-expat-dir="$(STAGING_DIR)/usr"
258 PKG_CONFIGURE_OPTS+= --disable-xml
261 define Build/Configure
264 ifneq ($(CONFIG_PACKAGE_php4-cli),)
265 define Build/Compile/php4-cli
266 -$(MAKE) -C $(PKG_BUILD_DIR) clean
267 $(call Build/Configure/Default, \
268 $(PKG_CONFIGURE_OPTS) \
272 --enable-force-cgi-redirect \
273 --enable-discard-path \
275 LIBS="$(PKG_CONFIGURE_LIBS)" \
276 php_cv_cc_rpath="no" \
278 $(MAKE) -C $(PKG_BUILD_DIR)
279 mv $(PKG_BUILD_DIR)/sapi/cli/php $(PKG_BUILD_DIR)/php-cli
283 ifneq ($(CONFIG_PACKAGE_php4-cgi),)
284 define Build/Compile/php4-cgi
285 -$(MAKE) -C $(PKG_BUILD_DIR) clean
286 $(call Build/Configure/Default, \
287 $(PKG_CONFIGURE_OPTS) \
291 --enable-force-cgi-redirect \
292 --enable-discard-path \
294 LIBS="$(PKG_CONFIGURE_LIBS)" \
295 php_cv_cc_rpath="no" \
297 $(MAKE) -C $(PKG_BUILD_DIR)
298 mv $(PKG_BUILD_DIR)/sapi/cgi/php $(PKG_BUILD_DIR)/php-cgi
302 ifneq ($(CONFIG_PACKAGE_php4-fastcgi),)
303 define Build/Compile/php4-fastcgi
304 -$(MAKE) -C $(PKG_BUILD_DIR) clean
305 $(call Build/Configure/Default, \
306 $(PKG_CONFIGURE_OPTS) \
310 --enable-force-cgi-redirect \
311 --enable-discard-path \
313 LIBS="$(PKG_CONFIGURE_LIBS)" \
314 php_cv_cc_rpath="no" \
316 $(MAKE) -C $(PKG_BUILD_DIR)
317 mv $(PKG_BUILD_DIR)/sapi/cgi/php $(PKG_BUILD_DIR)/php-fastcgi
322 $(call Build/Compile/php4-cli)
323 $(call Build/Compile/php4-cgi)
324 $(call Build/Compile/php4-fastcgi)
327 define Package/php4/conffiles
331 define Package/php4/install
332 $(INSTALL_DIR) $(1)/etc
333 $(INSTALL_DATA) ./files/php.ini $(1)/etc/
336 define Package/php4-cli/install
337 $(INSTALL_DIR) $(1)/usr/bin
338 $(CP) $(PKG_BUILD_DIR)/php-cli $(1)/usr/bin/php
341 define Package/php4-cgi/install
342 $(INSTALL_DIR) $(1)/usr/bin
343 $(CP) $(PKG_BUILD_DIR)/php-cgi $(1)/usr/bin/php
346 define Package/php4-fastcgi/install
347 $(INSTALL_DIR) $(1)/usr/sbin
348 $(CP) $(PKG_BUILD_DIR)/php-fastcgi $(1)/usr/sbin/php
349 $(INSTALL_DIR) $(1)/etc/init.d
350 $(INSTALL_BIN) ./files/php.init $(1)/etc/init.d/php
354 define Package/$(1)/install
355 [ -z "$(2)" ] || $(INSTALL_DIR) $$(1)/usr/lib/php
357 $(INSTALL_BIN) $(PKG_BUILD_DIR)/modules/$$$$$$$${m}.so $$(1)/usr/lib/php/ ; \
361 $$(eval $$(call BuildPackage,$(1)))
364 $(eval $(call BuildPackage,php4))
365 $(eval $(call BuildPackage,php4-cli))
366 $(eval $(call BuildPackage,php4-cgi))
367 $(eval $(call BuildPackage,php4-fastcgi))
368 $(eval $(call BuildPlugin,php4-mod-curl,curl))
369 $(eval $(call BuildPlugin,php4-mod-ftp,ftp))
370 $(eval $(call BuildPlugin,php4-mod-gd,gd))
371 $(eval $(call BuildPlugin,php4-mod-gmp,gmp))
372 $(eval $(call BuildPlugin,php4-mod-ldap,ldap))
373 $(eval $(call BuildPlugin,php4-mod-mysql,mysql))
374 $(eval $(call BuildPlugin,php4-mod-openssl,openssl))
375 $(eval $(call BuildPlugin,php4-mod-pcre,pcre))
376 $(eval $(call BuildPlugin,php4-mod-pgsql,pgsql))
377 $(eval $(call BuildPlugin,php4-mod-session,session))
378 $(eval $(call BuildPlugin,php4-mod-sockets,sockets))
379 $(eval $(call BuildPlugin,php4-mod-sqlite,sqlite))
380 $(eval $(call BuildPlugin,php4-mod-xml,xml))