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