move php related packages in a 'PHP' submenu, cleanup
[openwrt/svn-archive/archive.git] / lang / php4 / Makefile
1 #
2 # Copyright (C) 2006,2007 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
19 include $(INCLUDE_DIR)/package.mk
20
21 define Package/php4/Default
22 SUBMENU:=PHP
23 SECTION:=lang
24 CATEGORY:=Languages
25 TITLE:=PHP4 Hypertext preprocessor
26 URL:=http://www.php.net/
27 endef
28
29 define Package/php4/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.
32 endef
33
34 define Package/php4
35 $(call Package/php4/Default)
36 DEPENDS:=+libopenssl +zlib
37 endef
38
39 define Package/php4/description
40 $(call Package/php4/Default/description)
41 This package contains only the PHP config file. You must actually choose
42 your PHP flavour (cli, cgi or fastcgi).
43 endef
44
45 define Package/php4-cli
46 $(call Package/php4/Default)
47 DEPENDS:=php4
48 TITLE+= (CLI)
49 endef
50
51 define Package/php4-cli/description
52 $(call Package/php4/Default/description)
53 This package contains the CLI version of the PHP4 interpreter.
54 endef
55
56 define Package/php4-cgi
57 $(call Package/php4/Default)
58 DEPENDS:=php4
59 TITLE+= (CGI)
60 endef
61
62 define Package/php4-cgi/description
63 $(call Package/php4/Default/description)
64 This package contains the CGI version of the PHP4 interpreter.
65 endef
66
67 define Package/php4-fastcgi
68 $(call Package/php4/Default)
69 DEPENDS:=php4
70 TITLE+= (FastCGI)
71 endef
72
73 define Package/php4-fastcgi/description
74 $(call Package/php4/Default/description)
75 This package contains the FastCGI version of the PHP4 interpreter.
76 endef
77
78 define Package/php4-mod-curl
79 $(call Package/php4/Default)
80 DEPENDS:=php4 +libcurl
81 TITLE:=cURL module
82 endef
83
84 define Package/php4-mod-ftp
85 $(call Package/php4/Default)
86 DEPENDS:=php4
87 TITLE:=FTP module
88 endef
89
90 define Package/php4-mod-gd
91 $(call Package/php4/Default)
92 DEPENDS:=php4 +libgd
93 TITLE:=GD graphics module
94 endef
95
96 define Package/php4-mod-gmp
97 $(call Package/php4/Default)
98 DEPENDS:=php4 +libgmp
99 TITLE:=GMP module
100 endef
101
102 define Package/php4-mod-ldap
103 $(call Package/php4/Default)
104 DEPENDS:=php4 +libopenldap
105 TITLE:=LDAP module
106 endef
107
108 define Package/php4-mod-mysql
109 $(call Package/php4/Default)
110 DEPENDS:=php4 +libmysqlclient
111 TITLE:=MySQL module
112 endef
113
114 define Package/php4-mod-openssl
115 $(call Package/php4/Default)
116 DEPENDS:=php4 +libopenssl
117 TITLE:=OpenSSL module
118 endef
119
120 define Package/php4-mod-pcre
121 $(call Package/php4/Default)
122 DEPENDS:=php4 +libpcre
123 TITLE:=PCRE module
124 endef
125
126 define Package/php4-mod-pgsql
127 $(call Package/php4/Default)
128 DEPENDS:=php4 +libpq
129 TITLE:=PostgreSQL module
130 endef
131
132 define Package/php4-mod-session
133 $(call Package/php4/Default)
134 DEPENDS:=php4
135 TITLE:=Session module
136 endef
137
138 define Package/php4-mod-sockets
139 $(call Package/php4/Default)
140 DEPENDS:=php4
141 TITLE:=Sockets module
142 endef
143
144 define Package/php4-mod-sqlite
145 $(call Package/php4/Default)
146 DEPENDS:=php4 +libsqlite2
147 TITLE:=SQLite module
148 endef
149
150 define Package/php4-mod-xml
151 $(call Package/php4/Default)
152 DEPENDS:=php4 +libexpat
153 TITLE:=XML module
154 endef
155
156 PKG_CONFIGURE_LIBS:= -lcrypto -lssl
157 PKG_CONFIGURE_OPTS:= \
158 --enable-shared \
159 --disable-static \
160 --disable-rpath \
161 --disable-debug \
162 --without-pear \
163 \
164 --with-config-file-path=/etc \
165 --disable-ipv6 \
166 --enable-magic-quotes \
167 --enable-memory-limit \
168 --disable-overload \
169 --disable-short-tags \
170 \
171 --disable-ctype \
172 --disable-dom \
173 --enable-ftp=shared \
174 --without-gettext \
175 --without-iconv \
176 --disable-mbstring \
177 --disable-mbregex \
178 --with-openssl=shared,"$(STAGING_DIR)/usr" \
179 --with-kerberos=no \
180 --with-openssl-dir="$(STAGING_DIR)/usr" \
181 --enable-session=shared \
182 --enable-sockets=shared \
183 --disable-tokenizer \
184 --with-zlib="$(STAGING_DIR)/usr" \
185 --with-zlib-dir="$(STAGING_DIR)/usr" \
186
187 ifneq ($(SDK),)
188 PKG_BUILD_DEPENDS:=libopenssl zlib libcurl libgd libgmp libopenldap libmysqlclient libpq libsqlite2 libexpat
189 # force PKG_CONFIGURE_{LIBS,OPTS} below when built in the SDK
190 CONFIG_PACKAGE_php4-cli:=m
191 CONFIG_PACKAGE_php4-cgi:=m
192 CONFIG_PACKAGE_php4-fastcgi:=m
193 CONFIG_PACKAGE_php4-mod-curl:=m
194 CONFIG_PACKAGE_php4-mod-gd:=m
195 CONFIG_PACKAGE_php4-mod-gmp:=m
196 CONFIG_PACKAGE_php4-mod-ldap:=m
197 CONFIG_PACKAGE_php4-mod-mysql:=m
198 CONFIG_PACKAGE_php4-mod-pcre:=m
199 CONFIG_PACKAGE_php4-mod-pgsql:=m
200 CONFIG_PACKAGE_php4-mod-sqlite:=m
201 CONFIG_PACKAGE_php4-mod-xml:=m
202 endif
203
204 ifneq ($(CONFIG_PACKAGE_php4-mod-curl),)
205 PKG_CONFIGURE_OPTS+= --with-curl=shared,"$(STAGING_DIR)/usr"
206 else
207 PKG_CONFIGURE_OPTS+= --without-curl
208 endif
209 ifneq ($(CONFIG_PACKAGE_php4-mod-gd),)
210 PKG_CONFIGURE_OPTS+= --with-gd=shared,"$(STAGING_DIR)/usr" \
211 --without-freetype-dir \
212 --with-jpeg-dir="$(STAGING_DIR)/usr" \
213 --with-png-dir="$(STAGING_DIR)/usr" \
214 --without-xpm-dir \
215 --without-ttf \
216 --without-t1lib \
217 --enable-gd-native-ttf \
218 --disable-gd-jis-conv
219 else
220 PKG_CONFIGURE_OPTS+= --without-gd
221 endif
222 ifneq ($(CONFIG_PACKAGE_php4-mod-gmp),)
223 PKG_CONFIGURE_OPTS+= --with-gmp=shared,"$(STAGING_DIR)/usr"
224 else
225 PKG_CONFIGURE_OPTS+= --without-gmp
226 endif
227 ifneq ($(CONFIG_PACKAGE_php4-mod-ldap),)
228 PKG_CONFIGURE_OPTS+= --with-ldap=shared,"$(STAGING_DIR)/usr"
229 --with-ldap-sasl="$(STAGING_DIR)/usr"
230 else
231 PKG_CONFIGURE_OPTS+= --without-ldap
232 endif
233 ifneq ($(CONFIG_PACKAGE_php4-mod-mysql),)
234 PKG_CONFIGURE_OPTS+= --with-mysql=shared,"$(STAGING_DIR)/usr"
235 else
236 PKG_CONFIGURE_OPTS+= --without-mysql
237 endif
238 ifneq ($(CONFIG_PACKAGE_php4-mod-pcre),)
239 PKG_CONFIGURE_OPTS+= --with-pcre-regex=shared,"$(STAGING_DIR)/usr"
240 else
241 PKG_CONFIGURE_OPTS+= --without-pcre-regex
242 endif
243 ifneq ($(CONFIG_PACKAGE_php4-mod-pgsql),)
244 PKG_CONFIGURE_OPTS+= --with-pgsql=shared,"$(STAGING_DIR)/usr"
245 else
246 PKG_CONFIGURE_OPTS+= --without-pgsql
247 endif
248 ifneq ($(CONFIG_PACKAGE_php4-mod-sqlite),)
249 PKG_CONFIGURE_OPTS+= --with-sqlite=shared,"$(STAGING_DIR)/usr"
250 else
251 PKG_CONFIGURE_OPTS+= --without-sqlite
252 endif
253 ifneq ($(CONFIG_PACKAGE_php4-mod-xml),)
254 PKG_CONFIGURE_OPTS+= --enable-xml=shared \
255 --with-expat-dir="$(STAGING_DIR)/usr"
256 else
257 PKG_CONFIGURE_OPTS+= --disable-xml
258 endif
259
260 define Build/Configure
261 endef
262
263 ifneq ($(CONFIG_PACKAGE_php4-cli),)
264 define Build/Compile/php4-cli
265 -$(MAKE) -C $(PKG_BUILD_DIR) clean
266 $(call Build/Configure/Default, \
267 $(PKG_CONFIGURE_OPTS) \
268 --enable-cli \
269 --disable-cgi \
270 --disable-fastcgi \
271 --enable-force-cgi-redirect \
272 --enable-discard-path \
273 , \
274 LIBS="$(PKG_CONFIGURE_LIBS)" \
275 php_cv_cc_rpath="no" \
276 )
277 $(MAKE) -C $(PKG_BUILD_DIR)
278 mv $(PKG_BUILD_DIR)/sapi/cli/php $(PKG_BUILD_DIR)/php-cli
279 endef
280 endif
281
282 ifneq ($(CONFIG_PACKAGE_php4-cgi),)
283 define Build/Compile/php4-cgi
284 -$(MAKE) -C $(PKG_BUILD_DIR) clean
285 $(call Build/Configure/Default, \
286 $(PKG_CONFIGURE_OPTS) \
287 --disable-cli \
288 --enable-cgi \
289 --disable-fastcgi \
290 --enable-force-cgi-redirect \
291 --enable-discard-path \
292 , \
293 LIBS="$(PKG_CONFIGURE_LIBS)" \
294 php_cv_cc_rpath="no" \
295 )
296 $(MAKE) -C $(PKG_BUILD_DIR)
297 mv $(PKG_BUILD_DIR)/sapi/cgi/php $(PKG_BUILD_DIR)/php-cgi
298 endef
299 endif
300
301 ifneq ($(CONFIG_PACKAGE_php4-fastcgi),)
302 define Build/Compile/php4-fastcgi
303 -$(MAKE) -C $(PKG_BUILD_DIR) clean
304 $(call Build/Configure/Default, \
305 $(PKG_CONFIGURE_OPTS) \
306 --disable-cli \
307 --enable-cgi \
308 --enable-fastcgi \
309 --enable-force-cgi-redirect \
310 --enable-discard-path \
311 , \
312 LIBS="$(PKG_CONFIGURE_LIBS)" \
313 php_cv_cc_rpath="no" \
314 )
315 $(MAKE) -C $(PKG_BUILD_DIR)
316 mv $(PKG_BUILD_DIR)/sapi/cgi/php $(PKG_BUILD_DIR)/php-fastcgi
317 endef
318 endif
319
320 define Build/Compile
321 $(call Build/Compile/php4-cli)
322 $(call Build/Compile/php4-cgi)
323 $(call Build/Compile/php4-fastcgi)
324 endef
325
326 define Package/php4/conffiles
327 /etc/php.ini
328 endef
329
330 define Package/php4/install
331 $(INSTALL_DIR) $(1)/etc
332 $(INSTALL_DATA) ./files/php.ini $(1)/etc/
333 endef
334
335 define Package/php4-cli/install
336 $(INSTALL_DIR) $(1)/usr/bin
337 $(CP) $(PKG_BUILD_DIR)/php-cli $(1)/usr/bin/php
338 endef
339
340 define Package/php4-cgi/install
341 $(INSTALL_DIR) $(1)/usr/bin
342 $(CP) $(PKG_BUILD_DIR)/php-cgi $(1)/usr/bin/php
343 endef
344
345 define Package/php4-fastcgi/install
346 $(INSTALL_DIR) $(1)/usr/sbin
347 $(CP) $(PKG_BUILD_DIR)/php-fastcgi $(1)/usr/sbin/php
348 $(INSTALL_DIR) $(1)/etc/init.d
349 $(INSTALL_BIN) ./files/php.init $(1)/etc/init.d/php
350 endef
351
352 define BuildPlugin
353 define Package/$(1)/install
354 [ -z "$(2)" ] || $(INSTALL_DIR) $$(1)/usr/lib/php
355 for m in $(2); do \
356 $(INSTALL_BIN) $(PKG_BUILD_DIR)/modules/$$$$$$$${m}.so $$(1)/usr/lib/php/ ; \
357 done
358 endef
359
360 $$(eval $$(call BuildPackage,$(1)))
361 endef
362
363 $(eval $(call BuildPackage,php4))
364 $(eval $(call BuildPackage,php4-cli))
365 $(eval $(call BuildPackage,php4-cgi))
366 $(eval $(call BuildPackage,php4-fastcgi))
367 $(eval $(call BuildPlugin,php4-mod-curl,curl))
368 $(eval $(call BuildPlugin,php4-mod-ftp,ftp))
369 $(eval $(call BuildPlugin,php4-mod-gd,gd))
370 $(eval $(call BuildPlugin,php4-mod-gmp,gmp))
371 $(eval $(call BuildPlugin,php4-mod-ldap,ldap))
372 $(eval $(call BuildPlugin,php4-mod-mysql,mysql))
373 $(eval $(call BuildPlugin,php4-mod-openssl,openssl))
374 $(eval $(call BuildPlugin,php4-mod-pcre,pcre))
375 $(eval $(call BuildPlugin,php4-mod-pgsql,pgsql))
376 $(eval $(call BuildPlugin,php4-mod-session,session))
377 $(eval $(call BuildPlugin,php4-mod-sockets,sockets))
378 $(eval $(call BuildPlugin,php4-mod-sqlite,sqlite))
379 $(eval $(call BuildPlugin,php4-mod-xml,xml))
380