fix depends dir
[buildroot.git] / package / php / php.mk
blobf30bd87be06541db15dcda3f8293b513eb730882
1 #############################################################
3 # php
5 #############################################################
6 PHP_VER:=5.2.3
7 PHP_SOURCE:=php-$(PHP_VER).tar.bz2
8 PHP_SITE:=http://us.php.net/get/${PHP_SOURCE}/from/us2.php.net/mirror
9 PHP_DIR:=$(BUILD_DIR)/php-$(PHP_VER)
10 PHP_CAT=$(BZCAT)
11 PHP_DEPS=
12 PHP_TARGET_DEPS=
14 ifneq ($(BR2_PACKAGE_PHP_CLI),y)
15 PHP_CLI="--disable-cli"
16 else
17 PHP_CLI="--enable-cli"
18 PHP_TARGET_DEPS+=$(TARGET_DIR)/usr/bin/php
19 endif
21 ifneq ($(BR2_PACKAGE_PHP_CGI),y)
22 PHP_CGI=--disable-cgi
23 else
24 PHP_CGI=--enable-cgi
25 PHP_TARGET_DEPS+=$(TARGET_DIR)/usr/bin/php-cgi
26 ifeq ($(BR2_PACKAGE_PHP_FASTCGI),y)
27 PHP_CGI+=--enable-fastcgi
28 endif
29 endif
31 ifeq ($(BR2_PACKAGE_PHP_OPENSSL),y)
32 PHP_OPENSSL="--with-openssl=$(STAGING_DIR)/usr"
33 PHP_DEPS+=openssl
34 endif
36 ifeq ($(BR2_PACKAGE_PHP_XML2),y)
37 PHP_XML=--enable-libxml \
38 --with-libxml-dir=${STAGING_DIR}/usr \
39 --enable-xml \
40 --enable-xmlreader \
41 --enable-xmlwriter
42 PHP_DEPS+=libxml2
43 endif
45 ifeq ($(BR2_PACKAGE_PHP_ZLIB),y)
46 PHP_ZLIB="--with-zlib=$(STAGING_DIR)/usr"
47 PHP_DEPS+=zlib
48 endif
51 $(DL_DIR)/$(PHP_SOURCE):
52 $(WGET) -P $(DL_DIR) $(PHP_SITE)
54 php-source: $(DL_DIR)/$(PHP_SOURCE)
56 $(PHP_DIR)/.unpacked: $(DL_DIR)/$(PHP_SOURCE)
57 $(PHP_CAT) $(DL_DIR)/$(PHP_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
58 touch $@
60 $(PHP_DIR)/.configured: $(PHP_DIR)/.unpacked
61 (cd $(PHP_DIR); rm -rf config.cache; \
62 $(TARGET_CONFIGURE_OPTS) \
63 $(TARGET_CONFIGURE_ARGS) \
64 CC=$(TARGET_CC) \
65 ./configure \
66 --target=$(GNU_TARGET_NAME) \
67 --host=$(GNU_TARGET_NAME) \
68 --build=$(GNU_HOST_NAME) \
69 --prefix=/usr \
70 --exec-prefix=/ \
71 --bindir=/usr/bin \
72 --sbindir=/usr/sbin \
73 --libexecdir=/usr/lib \
74 --sysconfdir=/etc \
75 --with-config-file-path=/etc \
76 --datadir=/usr/share/misc \
77 --localstatedir=/var \
78 --mandir=/usr/man \
79 --infodir=/usr/info \
80 --disable-all \
81 --enable-spl \
82 --enable-session \
83 --enable-sockets \
84 --enable-posix \
85 --with-pcre-regex \
86 --without-pear \
87 $(DISABLE_IPV6) \
88 $(DISABLE_NLS) \
89 $(PHP_OPENSSL) \
90 $(PHP_XML) \
91 $(PHP_CLI) \
92 $(PHP_CGI) \
93 $(PHP_ZLIB) \
95 touch $@
97 $(PHP_DIR)/.built: $(PHP_DIR)/.configured
98 $(MAKE) CC=$(TARGET_CC) -C $(PHP_DIR)
99 touch $@
101 $(PHP_DIR)/.staged: $(PHP_DIR)/.built
102 $(MAKE) DESTDIR=$(STAGING_DIR) INSTALL_ROOT=$(STAGING_DIR) CC=$(TARGET_CC) -C $(PHP_DIR) install
103 touch $@
105 $(TARGET_DIR)/usr/bin/php: $(PHP_DIR)/.staged
106 cp -dpf $(STAGING_DIR)/usr/bin/php $(TARGET_DIR)/usr/bin/php
107 chmod 755 $(TARGET_DIR)/usr/bin/php
108 $(STRIPCMD) $(STRIP_STRIP_UNNEEDED) $(TARGET_DIR)/usr/bin/php
110 $(TARGET_DIR)/usr/bin/php-cgi: $(PHP_DIR)/.staged
111 cp -dpf $(STAGING_DIR)/usr/bin/php-cgi $(TARGET_DIR)/usr/bin/php-cgi
112 chmod 755 $(TARGET_DIR)/usr/bin/php-cgi
113 $(STRIPCMD) $(STRIP_STRIP_UNNEEDED) $(TARGET_DIR)/usr/bin/php-cgi
115 $(TARGET_DIR)/etc/php.ini: $(PHP_DIR)/.staged
116 cp -f $(PHP_DIR)/php.ini-dist $(TARGET_DIR)/etc/php.ini
118 php: uclibc $(PHP_DEPS) $(PHP_TARGET_DEPS) $(TARGET_DIR)/etc/php.ini
120 php-clean:
121 rm -f $(PHP_DIR)/.configured $(PHP_DIR)/.built $(PHP_DIR)/.staged
122 rm -f $(TARGET_DIR)/usr/bin/php $(TARGET_DIR)/usr/bin/php-cgi
123 rm -f $(STAGING_DIR)/usr/bin/php* $(STAGING_DIR)/usr/man/man1/php*
124 rm -rf $(STAGING_DIR)/usr/include/php
125 -$(MAKE) -C $(PHP_DIR) clean
127 php-dirclean:
128 rm -rf $(PHP_DIR)
130 #############################################################
132 # Toplevel Makefile options
134 #############################################################
135 ifeq ($(BR2_PACKAGE_PHP),y)
136 TARGETS+=php
137 endif