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