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