upgrade miniupnpd to 1.0-RC3
[openwrt/svn-archive/archive.git] / lang / php4 / Makefile
1 #
2 # Copyright (C) 2006 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 # $Id$
8
9 include $(TOPDIR)/rules.mk
10
11 PKG_NAME:=php
12 PKG_VERSION:=4.3.11
13 PKG_RELEASE:=2
14
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
16 PKG_SOURCE_URL:=http://fr.php.net/distributions/
17 PKG_MD5SUM:=fbc67d240812136a9842bc1f2a217b7a
18 PKG_CAT:=bzcat
19
20 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
21
22 include $(INCLUDE_DIR)/package.mk
23
24 define Package/php4/Default
25 SECTION:=lang
26 CATEGORY:=Languages
27 TITLE:=PHP4 Hypertext preprocessor
28 DESCRIPTION:=\
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/
32 endef
33
34 define Package/php4
35 $(call Package/php4/Default)
36 DEPENDS:=+libopenssl +zlib
37 DESCRIPTION+=\\\
38 \\\
39 This package contains only the PHP config file. You must actually choose your \\\
40 PHP flavour (cli, cgi or fastcgi).
41 MENU:=1
42 endef
43
44 define Package/php4/conffiles
45 /etc/php.ini
46 endef
47
48 define Package/php4-cli
49 $(call Package/php4/Default)
50 DEPENDS:=php4
51 TITLE+= (CLI)
52 DESCRIPTION+=\\\
53 \\\
54 This package contains the CLI version of the PHP4 interpreter.
55 endef
56
57 define Package/php4-cgi
58 $(call Package/php4/Default)
59 DEPENDS:=php4
60 TITLE+= (CGI)
61 DESCRIPTION+=\\\
62 \\\
63 This package contains the CGI version of the PHP4 interpreter.
64 endef
65
66 define Package/php4-fastcgi
67 $(call Package/php4/Default)
68 DEPENDS:=php4
69 TITLE+= (FastCGI)
70 DESCRIPTION+=\\\
71 \\\
72 This package contains the FastCGI version of the PHP4 interpreter.
73 endef
74
75 define Package/php4-mod-curl
76 $(call Package/php4/Default)
77 DEPENDS:=php4 +libcurl
78 TITLE:=cURL module
79 endef
80
81 define Package/php4-mod-ftp
82 $(call Package/php4/Default)
83 DEPENDS:=php4
84 TITLE:=FTP module
85 endef
86
87 define Package/php4-mod-gd
88 $(call Package/php4/Default)
89 DEPENDS:=php4 +libgd
90 TITLE:=GD graphics module
91 endef
92
93 define Package/php4-mod-gmp
94 $(call Package/php4/Default)
95 DEPENDS:=php4 +libgmp
96 TITLE:=GMP module
97 endef
98
99 define Package/php4-mod-ldap
100 $(call Package/php4/Default)
101 DEPENDS:=php4 +libopenldap
102 TITLE:=LDAP module
103 endef
104
105 define Package/php4-mod-mysql
106 $(call Package/php4/Default)
107 DEPENDS:=php4 +libmysqlclient
108 TITLE:=MySQL module
109 endef
110
111 define Package/php4-mod-openssl
112 $(call Package/php4/Default)
113 DEPENDS:=php4 +libopenssl
114 TITLE:=OpenSSL module
115 endef
116
117 define Package/php4-mod-pcre
118 $(call Package/php4/Default)
119 DEPENDS:=php4 +libpcre
120 TITLE:=PCRE module
121 endef
122
123 define Package/php4-mod-pgsql
124 $(call Package/php4/Default)
125 DEPENDS:=php4 +libpq
126 TITLE:=PostgreSQL module
127 endef
128
129 define Package/php4-mod-session
130 $(call Package/php4/Default)
131 DEPENDS:=php4
132 TITLE:=Session module
133 endef
134
135 define Package/php4-mod-sockets
136 $(call Package/php4/Default)
137 DEPENDS:=php4
138 TITLE:=Sockets module
139 endef
140
141 define Package/php4-mod-sqlite
142 $(call Package/php4/Default)
143 DEPENDS:=php4 +libsqlite2
144 TITLE:=SQLite module
145 endef
146
147 define Package/php4-mod-xml
148 $(call Package/php4/Default)
149 DEPENDS:=php4 +libexpat
150 TITLE:=XML module
151 endef
152
153 PKG_CONFIGURE_LIBS:= -lcrypto -lssl
154 PKG_CONFIGURE_OPTS:= \
155 --enable-shared \
156 --disable-static \
157 --disable-rpath \
158 --disable-debug \
159 --without-pear \
160 \
161 --with-config-file-path=/etc \
162 --disable-ipv6 \
163 --enable-magic-quotes \
164 --enable-memory-limit \
165 --disable-overload \
166 --disable-short-tags \
167 \
168 --disable-ctype \
169 --disable-dom \
170 --enable-ftp=shared \
171 --without-gettext \
172 --without-iconv \
173 --disable-mbstring \
174 --disable-mbregex \
175 --with-openssl=shared,"$(STAGING_DIR)/usr" \
176 --with-kerberos=no \
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" \
183
184 ifneq ($(SDK),)
185 PKG_BUILD_DEPENDS:=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
199 endif
200
201 ifneq ($(CONFIG_PACKAGE_php4-mod-curl),)
202 PKG_CONFIGURE_OPTS+= --with-curl=shared,"$(STAGING_DIR)/usr"
203 else
204 PKG_CONFIGURE_OPTS+= --without-curl
205 endif
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" \
211 --without-xpm-dir \
212 --without-ttf \
213 --without-t1lib \
214 --enable-gd-native-ttf \
215 --disable-gd-jis-conv
216 else
217 PKG_CONFIGURE_OPTS+= --without-gd
218 endif
219 ifneq ($(CONFIG_PACKAGE_php4-mod-gmp),)
220 PKG_CONFIGURE_OPTS+= --with-gmp=shared,"$(STAGING_DIR)/usr"
221 else
222 PKG_CONFIGURE_OPTS+= --without-gmp
223 endif
224 ifneq ($(CONFIG_PACKAGE_php4-mod-ldap),)
225 PKG_CONFIGURE_OPTS+= --with-ldap=shared,"$(STAGING_DIR)/usr"
226 --with-ldap-sasl="$(STAGING_DIR)/usr"
227 else
228 PKG_CONFIGURE_OPTS+= --without-ldap
229 endif
230 ifneq ($(CONFIG_PACKAGE_php4-mod-mysql),)
231 PKG_CONFIGURE_OPTS+= --with-mysql=shared,"$(STAGING_DIR)/usr"
232 else
233 PKG_CONFIGURE_OPTS+= --without-mysql
234 endif
235 ifneq ($(CONFIG_PACKAGE_php4-mod-pcre),)
236 PKG_CONFIGURE_OPTS+= --with-pcre-regex=shared,"$(STAGING_DIR)/usr"
237 else
238 PKG_CONFIGURE_OPTS+= --without-pcre-regex
239 endif
240 ifneq ($(CONFIG_PACKAGE_php4-mod-pgsql),)
241 PKG_CONFIGURE_OPTS+= --with-pgsql=shared,"$(STAGING_DIR)/usr"
242 else
243 PKG_CONFIGURE_OPTS+= --without-pgsql
244 endif
245 ifneq ($(CONFIG_PACKAGE_php4-mod-sqlite),)
246 PKG_CONFIGURE_OPTS+= --with-sqlite=shared,"$(STAGING_DIR)/usr"
247 else
248 PKG_CONFIGURE_OPTS+= --without-sqlite
249 endif
250 ifneq ($(CONFIG_PACKAGE_php4-mod-xml),)
251 PKG_CONFIGURE_OPTS+= --enable-xml=shared \
252 --with-expat-dir="$(STAGING_DIR)/usr"
253 else
254 PKG_CONFIGURE_OPTS+= --disable-xml
255 endif
256
257 define Build/Configure
258 endef
259
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) \
265 --enable-cli \
266 --disable-cgi \
267 --disable-fastcgi \
268 --enable-force-cgi-redirect \
269 --enable-discard-path \
270 , \
271 LIBS="$(PKG_CONFIGURE_LIBS)" \
272 php_cv_cc_rpath="no" \
273 )
274 $(MAKE) -C $(PKG_BUILD_DIR)
275 mv $(PKG_BUILD_DIR)/sapi/cli/php $(PKG_BUILD_DIR)/php-cli
276 endef
277 endif
278
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) \
284 --disable-cli \
285 --enable-cgi \
286 --disable-fastcgi \
287 --enable-force-cgi-redirect \
288 --enable-discard-path \
289 , \
290 LIBS="$(PKG_CONFIGURE_LIBS)" \
291 php_cv_cc_rpath="no" \
292 )
293 $(MAKE) -C $(PKG_BUILD_DIR)
294 mv $(PKG_BUILD_DIR)/sapi/cgi/php $(PKG_BUILD_DIR)/php-cgi
295 endef
296 endif
297
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) \
303 --disable-cli \
304 --enable-cgi \
305 --enable-fastcgi \
306 --enable-force-cgi-redirect \
307 --enable-discard-path \
308 , \
309 LIBS="$(PKG_CONFIGURE_LIBS)" \
310 php_cv_cc_rpath="no" \
311 )
312 $(MAKE) -C $(PKG_BUILD_DIR)
313 mv $(PKG_BUILD_DIR)/sapi/cgi/php $(PKG_BUILD_DIR)/php-fastcgi
314 endef
315 endif
316
317 define Build/Compile
318 $(call Build/Compile/php4-cli)
319 $(call Build/Compile/php4-cgi)
320 $(call Build/Compile/php4-fastcgi)
321 endef
322
323 define Package/php4/install
324 $(INSTALL_DIR) $(1)/etc
325 $(INSTALL_DATA) ./files/php.ini $(1)/etc/
326 endef
327
328 define Package/php4-cli/install
329 $(INSTALL_DIR) $(1)/usr/bin
330 $(CP) $(PKG_BUILD_DIR)/php-cli $(1)/usr/bin/php
331 endef
332
333 define Package/php4-cgi/install
334 $(INSTALL_DIR) $(1)/usr/bin
335 $(CP) $(PKG_BUILD_DIR)/php-cgi $(1)/usr/bin/php
336 endef
337
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
343 endef
344
345 define BuildPlugin
346 define Package/$(1)/install
347 [ -z "$(2)" ] || $(INSTALL_DIR) $$(1)/usr/lib/php
348 for m in $(2); do \
349 $(INSTALL_BIN) $(PKG_BUILD_DIR)/modules/$$$$$$$${m}.so $$(1)/usr/lib/php/ ; \
350 done
351 endef
352
353 $$(eval $$(call BuildPackage,$(1)))
354 endef
355
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))