update based on db90h's changes to the whiterussian package. note: this still needs...
[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.0.5
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:=b5d4ca75bbb11ee5b830fa67213d9f7f
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-mbstring \
176 --disable-mbregex \
177 --with-openssl=shared,"$(STAGING_DIR)/usr" \
178 --with-kerberos=no \
179 --with-openssl-dir="$(STAGING_DIR)/usr" \
180 --enable-session=shared \
181 --disable-simplexml \
182 --disable-soap \
183 --enable-sockets=shared \
184 --disable-tokenizer \
185 --with-zlib="$(STAGING_DIR)/usr" \
186 --with-zlib-dir="$(STAGING_DIR)/usr" \
187
188 ifneq ($(SDK),)
189 PKG_BUILDDEP:=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_php5-cli:=m
192 CONFIG_PACKAGE_php5-cgi:=m
193 CONFIG_PACKAGE_php5-fastcgi:=m
194 CONFIG_PACKAGE_php5-mod-curl:=m
195 CONFIG_PACKAGE_php5-mod-gd:=m
196 CONFIG_PACKAGE_php5-mod-gmp:=m
197 CONFIG_PACKAGE_php5-mod-ldap:=m
198 CONFIG_PACKAGE_php5-mod-mysql:=m
199 CONFIG_PACKAGE_php5-mod-pcre:=m
200 CONFIG_PACKAGE_php5-mod-pgsql:=m
201 CONFIG_PACKAGE_php5-mod-sqlite:=m
202 CONFIG_PACKAGE_php5-mod-xml:=m
203 endif
204
205 ifneq ($(CONFIG_PACKAGE_php5-mod-curl),)
206 PKG_CONFIGURE_OPTS+= --with-curl=shared,"$(STAGING_DIR)/usr"
207 else
208 PKG_CONFIGURE_OPTS+= --without-curl
209 endif
210 ifneq ($(CONFIG_PACKAGE_php5-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" \
215 --without-xpm-dir \
216 --without-ttf \
217 --without-t1lib \
218 --enable-gd-native-ttf \
219 --disable-gd-jis-conv
220 else
221 PKG_CONFIGURE_OPTS+= --without-gd
222 endif
223 ifneq ($(CONFIG_PACKAGE_php5-mod-gmp),)
224 PKG_CONFIGURE_OPTS+= --with-gmp=shared,"$(STAGING_DIR)/usr"
225 else
226 PKG_CONFIGURE_OPTS+= --without-gmp
227 endif
228 ifneq ($(CONFIG_PACKAGE_php5-mod-ldap),)
229 PKG_CONFIGURE_OPTS+= --with-ldap=shared,"$(STAGING_DIR)/usr" \
230 --with-ldap-sasl="$(STAGING_DIR)/usr"
231 else
232 PKG_CONFIGURE_OPTS+= --without-ldap
233 endif
234 ifneq ($(CONFIG_PACKAGE_php5-mod-mysql),)
235 PKG_CONFIGURE_OPTS+= --with-mysql=shared,"$(STAGING_DIR)/usr"
236 else
237 PKG_CONFIGURE_OPTS+= --without-mysql
238 endif
239 ifneq ($(CONFIG_PACKAGE_php5-mod-pcre),)
240 PKG_CONFIGURE_OPTS+= --with-pcre-regex=shared,"$(STAGING_DIR)/usr"
241 else
242 PKG_CONFIGURE_OPTS+= --without-pcre-regex
243 endif
244 ifneq ($(CONFIG_PACKAGE_php5-mod-pgsql),)
245 PKG_CONFIGURE_OPTS+= --with-pgsql=shared,"$(STAGING_DIR)/usr"
246 else
247 PKG_CONFIGURE_OPTS+= --without-pgsql
248 endif
249 ifneq ($(CONFIG_PACKAGE_php5-mod-sqlite),)
250 PKG_CONFIGURE_OPTS+= --with-sqlite=shared,"$(STAGING_DIR)/usr"
251 else
252 PKG_CONFIGURE_OPTS+= --without-sqlite
253 endif
254 ifneq ($(CONFIG_PACKAGE_php5-mod-xml),)
255 PKG_CONFIGURE_OPTS+= --enable-xml=shared,"$(STAGING_DIR)/usr" \
256 --with-libexpat-dir="$(STAGING_DIR)/usr"
257 else
258 PKG_CONFIGURE_OPTS+= --disable-xml
259 endif
260
261 define Build/Configure
262 endef
263
264 ifneq ($(CONFIG_PACKAGE_php5-cli),)
265 define Build/Compile/php5-cli
266 -$(MAKE) -C $(PKG_BUILD_DIR) clean
267 $(call Build/Configure/Default, \
268 $(PKG_CONFIGURE_OPTS) \
269 --enable-cli \
270 --disable-cgi \
271 --disable-fastcgi \
272 --enable-force-cgi-redirect \
273 --enable-discard-path \
274 , \
275 LIBS="$(PKG_CONFIGURE_LIBS)" \
276 php_cv_cc_rpath="no" \
277 )
278 $(MAKE) -C $(PKG_BUILD_DIR)
279 mv $(PKG_BUILD_DIR)/sapi/cli/php $(PKG_BUILD_DIR)/php-cli
280 endef
281 endif
282
283 ifneq ($(CONFIG_PACKAGE_php5-cgi),)
284 define Build/Compile/php5-cgi
285 -$(MAKE) -C $(PKG_BUILD_DIR) clean
286 $(call Build/Configure/Default, \
287 $(PKG_CONFIGURE_OPTS) \
288 --disable-cli \
289 --enable-cgi \
290 --disable-fastcgi \
291 --enable-force-cgi-redirect \
292 --enable-discard-path \
293 , \
294 LIBS="$(PKG_CONFIGURE_LIBS)" \
295 php_cv_cc_rpath="no" \
296 )
297 $(MAKE) -C $(PKG_BUILD_DIR)
298 mv $(PKG_BUILD_DIR)/sapi/cgi/php $(PKG_BUILD_DIR)/php-cgi
299 endef
300 endif
301
302 ifneq ($(CONFIG_PACKAGE_php5-fastcgi),)
303 define Build/Compile/php5-fastcgi
304 -$(MAKE) -C $(PKG_BUILD_DIR) clean
305 $(call Build/Configure/Default, \
306 $(PKG_CONFIGURE_OPTS) \
307 --disable-cli \
308 --enable-cgi \
309 --enable-fastcgi \
310 --enable-force-cgi-redirect \
311 --enable-discard-path \
312 , \
313 LIBS="$(PKG_CONFIGURE_LIBS)" \
314 php_cv_cc_rpath="no" \
315 )
316 $(MAKE) -C $(PKG_BUILD_DIR)
317 mv $(PKG_BUILD_DIR)/sapi/cgi/php $(PKG_BUILD_DIR)/php-fastcgi
318 endef
319 endif
320
321 define Build/Compile
322 $(call Build/Compile/php5-cli)
323 $(call Build/Compile/php5-cgi)
324 $(call Build/Compile/php5-fastcgi)
325 endef
326
327 define Package/php5/install
328 $(INSTALL_DIR) $(1)/etc
329 $(INSTALL_DATA) ./files/php.ini $(1)/etc/
330 endef
331
332 define Package/php5-cli/install
333 $(INSTALL_DIR) $(1)/usr/bin
334 $(CP) $(PKG_BUILD_DIR)/php-cli $(1)/usr/bin/php
335 endef
336
337 define Package/php5-cgi/install
338 $(INSTALL_DIR) $(1)/usr/bin
339 $(CP) $(PKG_BUILD_DIR)/php-cgi $(1)/usr/bin/php
340 endef
341
342 define Package/php5-fastcgi/install
343 $(INSTALL_DIR) $(1)/usr/sbin
344 $(CP) $(PKG_BUILD_DIR)/php-fastcgi $(1)/usr/sbin/php
345 $(INSTALL_DIR) $(1)/etc/init.d
346 $(INSTALL_BIN) ./files/php.init $(1)/etc/init.d/php
347 endef
348
349 define BuildPlugin
350 define Package/$(1)/install
351 [ -z "$(2)" ] || $(INSTALL_DIR) $$(1)/usr/lib/php
352 for m in $(2); do \
353 $(INSTALL_BIN) $(PKG_BUILD_DIR)/modules/$$$$$$$${m}.so $$(1)/usr/lib/php/ ; \
354 done
355 endef
356
357 $$(eval $$(call BuildPackage,$(1)))
358 endef
359
360 $(eval $(call BuildPackage,php5))
361 $(eval $(call BuildPackage,php5-cli))
362 $(eval $(call BuildPackage,php5-cgi))
363 $(eval $(call BuildPackage,php5-fastcgi))
364 $(eval $(call BuildPlugin,php5-mod-curl,curl))
365 $(eval $(call BuildPlugin,php5-mod-ftp,ftp))
366 $(eval $(call BuildPlugin,php5-mod-gd,gd))
367 $(eval $(call BuildPlugin,php5-mod-gmp,gmp))
368 $(eval $(call BuildPlugin,php5-mod-ldap,ldap))
369 $(eval $(call BuildPlugin,php5-mod-mysql,mysql))
370 $(eval $(call BuildPlugin,php5-mod-openssl,openssl))
371 $(eval $(call BuildPlugin,php5-mod-pcre,pcre))
372 $(eval $(call BuildPlugin,php5-mod-pgsql,pgsql))
373 $(eval $(call BuildPlugin,php5-mod-session,session))
374 $(eval $(call BuildPlugin,php5-mod-sockets,sockets))
375 $(eval $(call BuildPlugin,php5-mod-sqlite,sqlite))
376 $(eval $(call BuildPlugin,php5-mod-xml,xml))