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