change cp to $(CP)
[openwrt.git] / package / php4 / Makefile
1 # $Id$
2
3 include $(TOPDIR)/rules.mk
4
5 PKG_NAME:=php
6 PKG_VERSION:=4.3.11
7 PKG_RELEASE:=2
8 PKG_MD5SUM:=fbc67d240812136a9842bc1f2a217b7a
9
10 PKG_SOURCE_URL:=http://fr.php.net/distributions/
11 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
12 PKG_CAT:=bzcat
13
14 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
15
16 include $(TOPDIR)/package/rules.mk
17
18 define PKG_mod_template
19
20 $$(IPKG_$(1)):
21         install -d -m0755 $$(IDIR_$(1))/usr/lib/php
22         install -m0755 $(PKG_BUILD_DIR)/modules/$(2).so $$(IDIR_$(1))/usr/lib/php
23         $(RSTRIP) $$(IDIR_$(1))
24         $(IPKG_BUILD) $$(IDIR_$(1)) $(PACKAGE_DIR)
25
26 endef
27
28 PKG_CONFIGURE_OPTS:= \
29         --enable-shared \
30         --disable-static \
31         --disable-rpath \
32         --disable-debug \
33         --without-pear \
34         \
35         --with-config-file-path=/etc \
36         --disable-ipv6 \
37         --enable-magic-quotes \
38         --enable-memory-limit \
39         --disable-overload \
40         --disable-short-tags \
41         \
42         --disable-ctype \
43         --disable-dom \
44         --enable-ftp=shared \
45         --without-gettext \
46         --without-iconv \
47         --disable-mbstring \
48         --disable-mbregex \
49         --with-openssl=shared,"$(STAGING_DIR)/usr" \
50           --with-kerberos=no \
51           --with-openssl-dir="$(STAGING_DIR)/usr" \
52         --enable-session=shared \
53         --enable-sockets=shared \
54         --disable-tokenizer \
55         --with-zlib="$(STAGING_DIR)/usr" \
56           --with-zlib-dir="$(STAGING_DIR)/usr" \
57
58 ifneq ($(BR2_PACKAGE_PHP4_MOD_CURL),)
59 PKG_CONFIGURE_OPTS+= --with-curl=shared,"$(STAGING_DIR)/usr"
60 else
61 PKG_CONFIGURE_OPTS+= --without-curl
62 endif
63 ifneq ($(BR2_PACKAGE_PHP4_MOD_GD),)
64 PKG_CONFIGURE_OPTS+= --with-gd=shared,"$(STAGING_DIR)/usr" \
65         --without-freetype-dir \
66         --without-jpeg-dir \
67         --with-png-dir="$(STAGING_DIR)/usr" \
68         --without-xpm-dir \
69         --without-ttf \
70         --without-t1lib \
71         --enable-gd-native-ttf \
72         --disable-gd-jis-conv
73 else
74 PKG_CONFIGURE_OPTS+= --without-gd
75 endif
76 ifneq ($(BR2_PACKAGE_PHP4_MOD_GMP),)
77 PKG_CONFIGURE_OPTS+= --with-gmp=shared,"$(STAGING_DIR)/usr"
78 else
79 PKG_CONFIGURE_OPTS+= --without-gmp
80 endif
81 ifneq ($(BR2_PACKAGE_PHP4_MOD_LDAP),)
82 PKG_CONFIGURE_OPTS+= --with-ldap=shared,"$(STAGING_DIR)/usr"
83         --with-ldap-sasl="$(STAGING_DIR)/usr"
84 else
85 PKG_CONFIGURE_OPTS+= --without-ldap
86 endif
87 ifneq ($(BR2_PACKAGE_PHP4_MOD_MYSQL),)
88 PKG_CONFIGURE_OPTS+= --with-mysql=shared,"$(STAGING_DIR)/usr"
89 else
90 PKG_CONFIGURE_OPTS+= --without-mysql
91 endif
92 ifneq ($(BR2_PACKAGE_PHP4_MOD_PCRE),)
93 PKG_CONFIGURE_OPTS+= --with-pcre-regex=shared,"$(STAGING_DIR)/usr"
94 else
95 PKG_CONFIGURE_OPTS+= --without-pcre-regex
96 endif
97 ifneq ($(BR2_PACKAGE_PHP4_MOD_PGSQL),)
98 PKG_CONFIGURE_OPTS+= --with-pgsql=shared,"$(STAGING_DIR)/usr"
99 else
100 PKG_CONFIGURE_OPTS+= --without-pgsql
101 endif
102 ifneq ($(BR2_PACKAGE_PHP4_MOD_SQLITE),)
103 PKG_CONFIGURE_OPTS+= --with-sqlite=shared,"$(STAGING_DIR)/usr"
104 else
105 PKG_CONFIGURE_OPTS+= --without-sqlite
106 endif
107 ifneq ($(BR2_PACKAGE_PHP4_MOD_XML),)
108 PKG_CONFIGURE_OPTS+= --enable-xml=shared \
109         --with-expat-dir="$(STAGING_DIR)/usr"
110 else
111 PKG_CONFIGURE_OPTS+= --disable-xml
112 endif
113
114 $(eval $(call PKG_template,PHP4_CLI,php4-cli,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
115 $(eval $(call PKG_template,PHP4_CGI,php4-cgi,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
116 $(eval $(call PKG_template,PHP4_FASTCGI,php4-fastcgi,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
117
118 $(eval $(call PKG_template,PHP4_MOD_CURL,php4-mod-curl,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
119 $(eval $(call PKG_template,PHP4_MOD_FTP,php4-mod-ftp,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
120 $(eval $(call PKG_template,PHP4_MOD_GD,php4-mod-gd,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
121 $(eval $(call PKG_template,PHP4_MOD_GMP,php4-mod-gmp,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
122 $(eval $(call PKG_template,PHP4_MOD_LDAP,php4-mod-ldap,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
123 $(eval $(call PKG_template,PHP4_MOD_MYSQL,php4-mod-mysql,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
124 $(eval $(call PKG_template,PHP4_MOD_OPENSSL,php4-mod-openssl,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
125 $(eval $(call PKG_template,PHP4_MOD_PCRE,php4-mod-pcre,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
126 $(eval $(call PKG_template,PHP4_MOD_PGSQL,php4-mod-pgsql,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
127 $(eval $(call PKG_template,PHP4_MOD_SESSION,php4-mod-session,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
128 $(eval $(call PKG_template,PHP4_MOD_SOCKETS,php4-mod-sockets,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
129 $(eval $(call PKG_template,PHP4_MOD_SQLITE,php4-mod-sqlite,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
130 $(eval $(call PKG_template,PHP4_MOD_XML,php4-mod-xml,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
131
132 $(eval $(call PKG_mod_template,PHP4_MOD_CURL,curl))
133 $(eval $(call PKG_mod_template,PHP4_MOD_FTP,ftp))
134 $(eval $(call PKG_mod_template,PHP4_MOD_GD,gd))
135 $(eval $(call PKG_mod_template,PHP4_MOD_GMP,gmp))
136 $(eval $(call PKG_mod_template,PHP4_MOD_LDAP,ldap))
137 $(eval $(call PKG_mod_template,PHP4_MOD_MYSQL,mysql))
138 $(eval $(call PKG_mod_template,PHP4_MOD_OPENSSL,openssl))
139 $(eval $(call PKG_mod_template,PHP4_MOD_PCRE,pcre))
140 $(eval $(call PKG_mod_template,PHP4_MOD_PGSQL,pgsql))
141 $(eval $(call PKG_mod_template,PHP4_MOD_SESSION,session))
142 $(eval $(call PKG_mod_template,PHP4_MOD_SOCKETS,sockets))
143 $(eval $(call PKG_mod_template,PHP4_MOD_SQLITE,sqlite))
144 $(eval $(call PKG_mod_template,PHP4_MOD_XML,xml))
145
146
147 $(PKG_BUILD_DIR)/.configured:
148         touch $@
149
150 $(PKG_BUILD_DIR)/.built:
151         (cd $(PKG_BUILD_DIR); rm -rf config.{cache,status} ; \
152                 $(TARGET_CONFIGURE_OPTS) \
153                 CFLAGS="$(TARGET_CFLAGS)" \
154                 CPPFLAGS="-I$(STAGING_DIR)/usr/include" \
155                 LDFLAGS="-L$(STAGING_DIR)/lib -L$(STAGING_DIR)/usr/lib" \
156                 LIBS="-lcrypto -lssl" \
157                 php_cv_cc_rpath="no" \
158                 ./configure \
159                   --target=$(GNU_TARGET_NAME) \
160                   --host=$(GNU_TARGET_NAME) \
161                   --build=$(GNU_HOST_NAME) \
162                   --program-prefix="" \
163                   --program-suffix="" \
164                   --prefix=/usr \
165                   --exec-prefix=/usr \
166                   --bindir=/usr/bin \
167                   --datadir=/usr/share \
168                   --includedir=/usr/include \
169                   --infodir=/usr/share/info \
170                   --libdir=/usr/lib \
171                   --libexecdir=/usr/lib \
172                   --localstatedir=/var \
173                   --mandir=/usr/share/man \
174                   --sbindir=/usr/sbin \
175                   --sysconfdir=/etc \
176                   $(DISABLE_LARGEFILE) \
177                   $(DISABLE_NLS) \
178                   $(PKG_CONFIGURE_OPTS) \
179                   --enable-cli \
180                   --disable-cgi \
181                   --disable-fastcgi \
182                   --enable-force-cgi-redirect \
183                   --enable-discard-path \
184         );
185         $(MAKE) -C $(PKG_BUILD_DIR)
186         mv $(PKG_BUILD_DIR)/sapi/cli/php $(PKG_BUILD_DIR)/php-cli
187         (cd $(PKG_BUILD_DIR); rm -rf config.{cache,status} ; \
188                 $(TARGET_CONFIGURE_OPTS) \
189                 CFLAGS="$(TARGET_CFLAGS)" \
190                 CPPFLAGS="-I$(STAGING_DIR)/usr/include" \
191                 LDFLAGS="-L$(STAGING_DIR)/lib -L$(STAGING_DIR)/usr/lib" \
192                 LIBS="-lcrypto -lssl" \
193                 php_cv_cc_rpath="no" \
194                 ./configure \
195                   --target=$(GNU_TARGET_NAME) \
196                   --host=$(GNU_TARGET_NAME) \
197                   --build=$(GNU_HOST_NAME) \
198                   --program-prefix="" \
199                   --program-suffix="" \
200                   --prefix=/usr \
201                   --exec-prefix=/usr \
202                   --bindir=/usr/bin \
203                   --datadir=/usr/share \
204                   --includedir=/usr/include \
205                   --infodir=/usr/share/info \
206                   --libdir=/usr/lib \
207                   --libexecdir=/usr/lib \
208                   --localstatedir=/var \
209                   --mandir=/usr/share/man \
210                   --sbindir=/usr/sbin \
211                   --sysconfdir=/etc \
212                   $(DISABLE_LARGEFILE) \
213                   $(DISABLE_NLS) \
214                   $(PKG_CONFIGURE_OPTS) \
215                   --disable-cli \
216                   --enable-cgi \
217                   --disable-fastcgi \
218                   --enable-force-cgi-redirect \
219                   --enable-discard-path \
220         );
221         $(MAKE) -C $(PKG_BUILD_DIR)
222         mv $(PKG_BUILD_DIR)/sapi/cgi/php $(PKG_BUILD_DIR)/php-cgi
223         $(MAKE) -C $(PKG_BUILD_DIR) clean
224         (cd $(PKG_BUILD_DIR); rm -rf config.{cache,status} ; \
225                 $(TARGET_CONFIGURE_OPTS) \
226                 CFLAGS="$(TARGET_CFLAGS)" \
227                 CPPFLAGS="-I$(STAGING_DIR)/usr/include" \
228                 LDFLAGS="-L$(STAGING_DIR)/lib -L$(STAGING_DIR)/usr/lib" \
229                 LIBS="-lcrypto -lssl" \
230                 php_cv_cc_rpath="no" \
231                 ./configure \
232                   --target=$(GNU_TARGET_NAME) \
233                   --host=$(GNU_TARGET_NAME) \
234                   --build=$(GNU_HOST_NAME) \
235                   --program-prefix="" \
236                   --program-suffix="" \
237                   --prefix=/usr \
238                   --exec-prefix=/usr \
239                   --bindir=/usr/sbin \
240                   --datadir=/usr/share \
241                   --includedir=/usr/include \
242                   --infodir=/usr/share/info \
243                   --libdir=/usr/lib \
244                   --libexecdir=/usr/lib \
245                   --localstatedir=/var \
246                   --mandir=/usr/share/man \
247                   --sbindir=/usr/sbin \
248                   --sysconfdir=/etc \
249                   $(DISABLE_LARGEFILE) \
250                   $(DISABLE_NLS) \
251                   $(PKG_CONFIGURE_OPTS) \
252                   --disable-cli \
253                   --enable-cgi \
254                   --enable-fastcgi \
255                   --enable-force-cgi-redirect \
256                   --enable-discard-path \
257         );
258         $(MAKE) -C $(PKG_BUILD_DIR)
259         mv $(PKG_BUILD_DIR)/sapi/cgi/php $(PKG_BUILD_DIR)/php-fastcgi
260         touch $@
261
262 $(IPKG_PHP4_CLI):
263         install -m0755 -d $(IDIR_PHP4_CLI)/etc
264         install -m0644 ./files/php.ini $(IDIR_PHP4_CLI)/etc/
265         install -m0755 -d $(IDIR_PHP4_CLI)/usr/bin
266         $(CP) $(PKG_BUILD_DIR)/php-cli $(IDIR_PHP4_CLI)/usr/bin/php
267         $(RSTRIP) $(IDIR_PHP4_CLI)
268         $(IPKG_BUILD) $(IDIR_PHP4_CLI) $(PACKAGE_DIR)
269
270 $(IPKG_PHP4_CGI):
271         install -m0755 -d $(IDIR_PHP4_CGI)/etc
272         install -m0644 ./files/php.ini $(IDIR_PHP4_CGI)/etc/
273         install -m0755 -d $(IDIR_PHP4_CGI)/usr/bin
274         $(CP) $(PKG_BUILD_DIR)/php-cgi $(IDIR_PHP4_CGI)/usr/bin/php
275         $(RSTRIP) $(IDIR_PHP4_CGI)
276         $(IPKG_BUILD) $(IDIR_PHP4_CGI) $(PACKAGE_DIR)
277
278 $(IPKG_PHP4_FASTCGI):
279         install -m0755 -d $(IDIR_PHP4_FASTCGI)/etc
280         install -m0644 ./files/php.ini $(IDIR_PHP4_FASTCGI)/etc/
281         install -m0755 -d $(IDIR_PHP4_FASTCGI)/etc/init.d
282         install -m0755 ./files/php.init $(IDIR_PHP4_FASTCGI)/etc/init.d/php
283         install -m0755 -d $(IDIR_PHP4_FASTCGI)/usr/sbin
284         $(CP) $(PKG_BUILD_DIR)/php-fastcgi $(IDIR_PHP4_FASTCGI)/usr/sbin/php
285         $(RSTRIP) $(IDIR_PHP4_FASTCGI)
286         $(IPKG_BUILD) $(IDIR_PHP4_FASTCGI) $(PACKAGE_DIR)
287