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:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
16 PKG_SOURCE_URL:=http://www.php.net/distributions/
17 PKG_MD5SUM:=1fe14ca892460b09f06729941a1bb605
19 include $(INCLUDE_DIR)/package.mk
21 define Package/php5/Default
25 TITLE:=PHP5 Hypertext preprocessor
26 URL:=http://www.php.net/
29 define Package/php5/Default/description
30 PHP is a widely-used general-purpose scripting language that is especially
31 suited for Web development and can be embedded into HTML.
35 $(call Package/php5/Default)
36 DEPENDS:=+libopenssl +zlib
39 define Package/php5/description
40 $(call Package/php5/Default/description)
41 This package contains only the PHP config file. You must actually choose
42 your PHP flavour (cli, cgi or fastcgi).
45 define Package/php5-cli
46 $(call Package/php5/Default)
51 define Package/php5-cli/description
52 $(call Package/php5/Default/description)
53 This package contains the CLI version of the PHP5 interpreter.
56 define Package/php5-cgi
57 $(call Package/php5/Default)
62 define Package/php5-cgi/description
63 $(call Package/php5/Default/description)
64 This package contains the CGI version of the PHP5 interpreter.
67 define Package/php5-fastcgi
68 $(call Package/php5/Default)
73 define Package/php5-fastcgi/description
74 $(call Package/php5/Default/description)
75 This package contains the FastCGI version of the PHP5 interpreter.
78 define Package/php5-mod-curl
79 $(call Package/php5/Default)
80 DEPENDS:=php5 +libcurl
84 define Package/php5-mod-ftp
85 $(call Package/php5/Default)
90 define Package/php5-mod-gd
91 $(call Package/php5/Default)
93 TITLE:=GD graphics module
96 define Package/php5-mod-gmp
97 $(call Package/php5/Default)
102 define Package/php5-mod-ldap
103 $(call Package/php5/Default)
104 DEPENDS:=php5 +libopenldap +libsasl2
108 define Package/php5-mod-mysql
109 $(call Package/php5/Default)
110 DEPENDS:=php5 +libmysqlclient
114 define Package/php5-mod-openssl
115 $(call Package/php5/Default)
116 DEPENDS:=php5 +libopenssl
117 TITLE:=OpenSSL module
120 define Package/php5-mod-pcre
121 $(call Package/php5/Default)
122 DEPENDS:=php5 +libpcre
126 define Package/php5-mod-pgsql
127 $(call Package/php5/Default)
129 TITLE:=PostgreSQL module
132 define Package/php5-mod-session
133 $(call Package/php5/Default)
135 TITLE:=Session module
138 define Package/php5-mod-sockets
139 $(call Package/php5/Default)
141 TITLE:=Sockets module
144 define Package/php5-mod-sqlite
145 $(call Package/php5/Default)
146 DEPENDS:=php5 +libsqlite2
150 define Package/php5-mod-xml
151 $(call Package/php5/Default)
152 DEPENDS:=php5 +libexpat
156 define Package/php5-mod-apc
157 $(call Package/php5/Default)
162 PKG_CONFIGURE_LIBS:= -lcrypto -lssl
163 PKG_CONFIGURE_OPTS:= \
171 --with-config-file-path=/etc \
173 --enable-magic-quotes \
174 --enable-memory-limit \
175 --disable-short-tags \
179 --enable-ftp=shared \
183 --without-libxml-dir \
184 --disable-xmlreader \
185 --disable-xmlwriter \
188 --with-openssl=shared,"$(STAGING_DIR)/usr" \
190 --with-openssl-dir="$(STAGING_DIR)/usr" \
191 --enable-session=shared \
192 --disable-simplexml \
194 --enable-sockets=shared \
195 --disable-tokenizer \
196 --with-zlib="$(STAGING_DIR)/usr" \
197 --with-zlib-dir="$(STAGING_DIR)/usr" \
201 PKG_BUILD_DEPENDS:=libopenssl zlib libcurl libgd libgmp libopenldap libmysqlclient libpq libsqlite2 libexpat
202 # force PKG_CONFIGURE_{LIBS,OPTS} below when built in the SDK
203 CONFIG_PACKAGE_php5-cli:=m
204 CONFIG_PACKAGE_php5-cgi:=m
205 CONFIG_PACKAGE_php5-fastcgi:=m
206 CONFIG_PACKAGE_php5-mod-curl:=m
207 CONFIG_PACKAGE_php5-mod-gd:=m
208 CONFIG_PACKAGE_php5-mod-gmp:=m
209 CONFIG_PACKAGE_php5-mod-ldap:=m
210 CONFIG_PACKAGE_php5-mod-mysql:=m
211 CONFIG_PACKAGE_php5-mod-pcre:=m
212 CONFIG_PACKAGE_php5-mod-pgsql:=m
213 CONFIG_PACKAGE_php5-mod-sqlite:=m
214 CONFIG_PACKAGE_php5-mod-xml:=m
217 ifneq ($(CONFIG_PACKAGE_php5-mod-curl),)
218 PKG_CONFIGURE_OPTS+= --with-curl=shared,"$(STAGING_DIR)/usr"
220 PKG_CONFIGURE_OPTS+= --without-curl
222 ifneq ($(CONFIG_PACKAGE_php5-mod-gd),)
223 PKG_CONFIGURE_OPTS+= --with-gd=shared,"$(STAGING_DIR)/usr" \
224 --without-freetype-dir \
225 --with-jpeg-dir="$(STAGING_DIR)/usr" \
226 --with-png-dir="$(STAGING_DIR)/usr" \
230 --enable-gd-native-ttf \
231 --disable-gd-jis-conv
233 PKG_CONFIGURE_OPTS+= --without-gd
235 ifneq ($(CONFIG_PACKAGE_php5-mod-gmp),)
236 PKG_CONFIGURE_OPTS+= --with-gmp=shared,"$(STAGING_DIR)/usr"
238 PKG_CONFIGURE_OPTS+= --without-gmp
240 ifneq ($(CONFIG_PACKAGE_php5-mod-ldap),)
241 PKG_CONFIGURE_OPTS+= --with-ldap=shared,"$(STAGING_DIR)/usr" \
242 --with-ldap-sasl="$(STAGING_DIR)/usr"
244 PKG_CONFIGURE_OPTS+= --without-ldap
246 ifneq ($(CONFIG_PACKAGE_php5-mod-mysql),)
247 PKG_CONFIGURE_OPTS+= --with-mysql=shared,"$(STAGING_DIR)/usr"
249 PKG_CONFIGURE_OPTS+= --without-mysql
251 ifneq ($(CONFIG_PACKAGE_php5-mod-pcre),)
252 PKG_CONFIGURE_OPTS+= --with-pcre-regex=shared,"$(STAGING_DIR)/usr"
254 PKG_CONFIGURE_OPTS+= --without-pcre-regex
256 ifneq ($(CONFIG_PACKAGE_php5-mod-pgsql),)
257 PKG_CONFIGURE_OPTS+= --with-pgsql=shared,"$(STAGING_DIR)/usr"
259 PKG_CONFIGURE_OPTS+= --without-pgsql
261 ifneq ($(CONFIG_PACKAGE_php5-mod-sqlite),)
262 PKG_CONFIGURE_OPTS+= --with-sqlite=shared,"$(STAGING_DIR)/usr"
264 PKG_CONFIGURE_OPTS+= --without-sqlite
266 ifneq ($(CONFIG_PACKAGE_php5-mod-xml),)
267 PKG_CONFIGURE_OPTS+= --enable-xml=shared,"$(STAGING_DIR)/usr" \
268 --with-libexpat-dir="$(STAGING_DIR)/usr"
270 PKG_CONFIGURE_OPTS+= --disable-xml
272 ifneq ($(CONFIG_PACKAGE_php5-mod-apc),)
273 PKG_CONFIGURE_OPTS+= --enable-apc --disable-apc-mmap
274 PKG_CONFIGURE_LIBS+= -lrt
276 PKG_CONFIGURE_OPTS+= --disable-apc
279 define Build/Configure
282 ifneq ($(CONFIG_PACKAGE_php5-cli),)
283 define Build/Compile/php5-cli
284 -$(MAKE) -C $(PKG_BUILD_DIR) clean
285 $(call Build/Configure/Default, \
286 $(PKG_CONFIGURE_OPTS) \
290 --enable-force-cgi-redirect \
291 --enable-discard-path \
293 LIBS="$(PKG_CONFIGURE_LIBS)" \
294 php_cv_cc_rpath="no" \
296 $(MAKE) -C $(PKG_BUILD_DIR)
297 mv $(PKG_BUILD_DIR)/sapi/cli/php $(PKG_BUILD_DIR)/php-cli
301 ifneq ($(CONFIG_PACKAGE_php5-cgi),)
302 define Build/Compile/php5-cgi
303 -$(MAKE) -C $(PKG_BUILD_DIR) clean
304 $(call Build/Configure/Default, \
305 $(PKG_CONFIGURE_OPTS) \
309 --enable-force-cgi-redirect \
310 --enable-discard-path \
312 LIBS="$(PKG_CONFIGURE_LIBS)" \
313 php_cv_cc_rpath="no" \
315 $(MAKE) -C $(PKG_BUILD_DIR)
316 mv $(PKG_BUILD_DIR)/sapi/cgi/php-cgi $(PKG_BUILD_DIR)/php-cgi
320 ifneq ($(CONFIG_PACKAGE_php5-fastcgi),)
321 define Build/Compile/php5-fastcgi
322 -$(MAKE) -C $(PKG_BUILD_DIR) clean
323 rm $(PKG_BUILD_DIR)/configure
324 cd $(PKG_BUILD_DIR) && ./buildconf --force
325 $(call Build/Configure/Default, \
326 $(PKG_CONFIGURE_OPTS) \
330 --enable-force-cgi-redirect \
331 --enable-discard-path \
333 LIBS="$(PKG_CONFIGURE_LIBS)" \
334 php_cv_cc_rpath="no" \
336 $(MAKE) -C $(PKG_BUILD_DIR)
337 mv $(PKG_BUILD_DIR)/sapi/cgi/php-cgi $(PKG_BUILD_DIR)/php-fcgi
342 $(call Build/Compile/php5-cli)
343 $(call Build/Compile/php5-cgi)
344 $(call Build/Compile/php5-fastcgi)
347 define Package/php5/conffiles
351 define Package/php5/install
352 $(INSTALL_DIR) $(1)/etc
353 $(INSTALL_DATA) ./files/php.ini $(1)/etc/
356 define Package/php5-cli/install
357 $(INSTALL_DIR) $(1)/usr/bin
358 $(CP) $(PKG_BUILD_DIR)/php-cli $(1)/usr/bin/php-cli
361 define Package/php5-cgi/install
362 $(INSTALL_DIR) $(1)/usr/bin
363 $(CP) $(PKG_BUILD_DIR)/php-cgi $(1)/usr/bin/php-cgi
366 define Package/php5-fastcgi/install
367 $(INSTALL_DIR) $(1)/usr/bin
368 $(CP) $(PKG_BUILD_DIR)/php-fcgi $(1)/usr/bin/php-fcgi
369 $(INSTALL_DIR) $(1)/etc/init.d
370 $(INSTALL_BIN) ./files/php.init $(1)/etc/init.d/php
374 define Package/$(1)/install
375 [ -z "$(2)" ] || $(INSTALL_DIR) $$(1)/usr/lib/php
377 $(INSTALL_BIN) $(PKG_BUILD_DIR)/modules/$$$$$$$${m}.so $$(1)/usr/lib/php/ ; \
381 $$(eval $$(call BuildPackage,$(1)))
384 $(eval $(call BuildPackage,php5))
385 $(eval $(call BuildPackage,php5-cli))
386 $(eval $(call BuildPackage,php5-cgi))
387 $(eval $(call BuildPackage,php5-fastcgi))
388 $(eval $(call BuildPlugin,php5-mod-curl,curl))
389 $(eval $(call BuildPlugin,php5-mod-ftp,ftp))
390 $(eval $(call BuildPlugin,php5-mod-gd,gd))
391 $(eval $(call BuildPlugin,php5-mod-gmp,gmp))
392 $(eval $(call BuildPlugin,php5-mod-ldap,ldap))
393 $(eval $(call BuildPlugin,php5-mod-mysql,mysql))
394 $(eval $(call BuildPlugin,php5-mod-openssl,openssl))
395 $(eval $(call BuildPlugin,php5-mod-pcre,pcre))
396 $(eval $(call BuildPlugin,php5-mod-pgsql,pgsql))
397 $(eval $(call BuildPlugin,php5-mod-session,session))
398 $(eval $(call BuildPlugin,php5-mod-sockets,sockets))
399 $(eval $(call BuildPlugin,php5-mod-sqlite,sqlite))
400 $(eval $(call BuildPlugin,php5-mod-xml,xml))
401 $(eval $(call BuildPlugin,php5-mod-apc))