xref: /OK3568_Linux_fs/buildroot/package/php/php.mk (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun################################################################################
2*4882a593Smuzhiyun#
3*4882a593Smuzhiyun# php
4*4882a593Smuzhiyun#
5*4882a593Smuzhiyun################################################################################
6*4882a593Smuzhiyun
7*4882a593SmuzhiyunPHP_VERSION = 8.0.13
8*4882a593SmuzhiyunPHP_SITE = https://www.php.net/distributions
9*4882a593SmuzhiyunPHP_SOURCE = php-$(PHP_VERSION).tar.xz
10*4882a593SmuzhiyunPHP_INSTALL_STAGING = YES
11*4882a593SmuzhiyunPHP_INSTALL_STAGING_OPTS = INSTALL_ROOT=$(STAGING_DIR) install
12*4882a593SmuzhiyunPHP_INSTALL_TARGET_OPTS = INSTALL_ROOT=$(TARGET_DIR) install
13*4882a593SmuzhiyunPHP_DEPENDENCIES = host-pkgconf pcre2
14*4882a593SmuzhiyunPHP_LICENSE = PHP-3.01
15*4882a593SmuzhiyunPHP_LICENSE_FILES = LICENSE
16*4882a593SmuzhiyunPHP_CPE_ID_VENDOR = php
17*4882a593SmuzhiyunPHP_CONF_OPTS = \
18*4882a593Smuzhiyun	--mandir=/usr/share/man \
19*4882a593Smuzhiyun	--infodir=/usr/share/info \
20*4882a593Smuzhiyun	--with-config-file-scan-dir=/etc/php.d \
21*4882a593Smuzhiyun	--disable-all \
22*4882a593Smuzhiyun	--with-external-pcre \
23*4882a593Smuzhiyun	--without-pear \
24*4882a593Smuzhiyun	--with-config-file-path=/etc \
25*4882a593Smuzhiyun	--disable-phpdbg \
26*4882a593Smuzhiyun	--disable-rpath
27*4882a593SmuzhiyunPHP_CONF_ENV = \
28*4882a593Smuzhiyun	EXTRA_LIBS="$(PHP_EXTRA_LIBS)"
29*4882a593Smuzhiyun
30*4882a593Smuzhiyunifeq ($(BR2_STATIC_LIBS),y)
31*4882a593SmuzhiyunPHP_CONF_ENV += LIBS="$(PHP_STATIC_LIBS)"
32*4882a593Smuzhiyunendif
33*4882a593Smuzhiyun
34*4882a593Smuzhiyunifeq ($(BR2_STATIC_LIBS)$(BR2_TOOLCHAIN_HAS_THREADS),yy)
35*4882a593SmuzhiyunPHP_STATIC_LIBS += -lpthread
36*4882a593Smuzhiyunendif
37*4882a593Smuzhiyun
38*4882a593Smuzhiyunifeq ($(call qstrip,$(BR2_TARGET_LOCALTIME)),)
39*4882a593SmuzhiyunPHP_LOCALTIME = UTC
40*4882a593Smuzhiyunelse
41*4882a593Smuzhiyun# Not q-stripping this value, as we need quotes in the php.ini file
42*4882a593SmuzhiyunPHP_LOCALTIME = $(BR2_TARGET_LOCALTIME)
43*4882a593Smuzhiyunendif
44*4882a593Smuzhiyun
45*4882a593Smuzhiyun# PHP can't be AUTORECONFed the standard way unfortunately
46*4882a593SmuzhiyunPHP_DEPENDENCIES += host-autoconf host-automake host-libtool
47*4882a593Smuzhiyundefine PHP_BUILDCONF
48*4882a593Smuzhiyun	cd $(@D) ; $(TARGET_MAKE_ENV) ./buildconf --force
49*4882a593Smuzhiyunendef
50*4882a593SmuzhiyunPHP_PRE_CONFIGURE_HOOKS += PHP_BUILDCONF
51*4882a593Smuzhiyun
52*4882a593Smuzhiyunifeq ($(BR2_ENDIAN),"BIG")
53*4882a593SmuzhiyunPHP_CONF_ENV += ac_cv_c_bigendian_php=yes
54*4882a593Smuzhiyunelse
55*4882a593SmuzhiyunPHP_CONF_ENV += ac_cv_c_bigendian_php=no
56*4882a593Smuzhiyunendif
57*4882a593SmuzhiyunPHP_CONFIG_SCRIPTS = php-config
58*4882a593Smuzhiyun
59*4882a593SmuzhiyunPHP_CFLAGS = $(TARGET_CFLAGS)
60*4882a593SmuzhiyunPHP_CXXFLAGS = $(TARGET_CXXFLAGS)
61*4882a593Smuzhiyun
62*4882a593Smuzhiyun# The OPcache extension isn't cross-compile friendly
63*4882a593Smuzhiyun# Throw some defines here to avoid patching heavily
64*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_PHP_EXT_OPCACHE),y)
65*4882a593SmuzhiyunPHP_CONF_OPTS += --enable-opcache --disable-opcache-jit
66*4882a593SmuzhiyunPHP_CONF_ENV += ac_cv_func_mprotect=yes
67*4882a593SmuzhiyunPHP_CFLAGS += \
68*4882a593Smuzhiyun	-DHAVE_SHM_IPC \
69*4882a593Smuzhiyun	-DHAVE_SHM_MMAP_ANON \
70*4882a593Smuzhiyun	-DHAVE_SHM_MMAP_ZERO \
71*4882a593Smuzhiyun	-DHAVE_SHM_MMAP_POSIX \
72*4882a593Smuzhiyun	-DHAVE_SHM_MMAP_FILE
73*4882a593Smuzhiyunendif
74*4882a593Smuzhiyun
75*4882a593Smuzhiyun# We need to force dl "detection"
76*4882a593Smuzhiyunifeq ($(BR2_STATIC_LIBS),)
77*4882a593SmuzhiyunPHP_CONF_ENV += ac_cv_func_dlopen=yes ac_cv_lib_dl_dlopen=yes
78*4882a593SmuzhiyunPHP_EXTRA_LIBS += -ldl
79*4882a593Smuzhiyunelse
80*4882a593SmuzhiyunPHP_CONF_ENV += ac_cv_func_dlopen=no ac_cv_lib_dl_dlopen=no
81*4882a593Smuzhiyunendif
82*4882a593Smuzhiyun
83*4882a593SmuzhiyunPHP_CONF_OPTS += $(if $(BR2_PACKAGE_PHP_SAPI_CLI),--enable-cli,--disable-cli)
84*4882a593SmuzhiyunPHP_CONF_OPTS += $(if $(BR2_PACKAGE_PHP_SAPI_CGI),--enable-cgi,--disable-cgi)
85*4882a593SmuzhiyunPHP_CONF_OPTS += $(if $(BR2_PACKAGE_PHP_SAPI_FPM),--enable-fpm,--disable-fpm)
86*4882a593Smuzhiyun
87*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_PHP_SAPI_APACHE),y)
88*4882a593SmuzhiyunPHP_DEPENDENCIES += apache
89*4882a593SmuzhiyunPHP_CONF_OPTS += --with-apxs2=$(STAGING_DIR)/usr/bin/apxs
90*4882a593Smuzhiyun
91*4882a593Smuzhiyun# Enable thread safety option if Apache MPM is event or worker
92*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_APACHE_MPM_EVENT)$(BR2_PACKAGE_APACHE_MPM_WORKER),y)
93*4882a593SmuzhiyunPHP_CONF_OPTS += --enable-zts
94*4882a593Smuzhiyunendif
95*4882a593Smuzhiyunendif
96*4882a593Smuzhiyun
97*4882a593Smuzhiyun### Extensions
98*4882a593SmuzhiyunPHP_CONF_OPTS += \
99*4882a593Smuzhiyun	$(if $(BR2_PACKAGE_PHP_EXT_SOCKETS),--enable-sockets) \
100*4882a593Smuzhiyun	$(if $(BR2_PACKAGE_PHP_EXT_POSIX),--enable-posix) \
101*4882a593Smuzhiyun	$(if $(BR2_PACKAGE_PHP_EXT_SESSION),--enable-session) \
102*4882a593Smuzhiyun	$(if $(BR2_PACKAGE_PHP_EXT_DOM),--enable-dom) \
103*4882a593Smuzhiyun	$(if $(BR2_PACKAGE_PHP_EXT_SIMPLEXML),--enable-simplexml) \
104*4882a593Smuzhiyun	$(if $(BR2_PACKAGE_PHP_EXT_SOAP),--enable-soap) \
105*4882a593Smuzhiyun	$(if $(BR2_PACKAGE_PHP_EXT_XML),--enable-xml) \
106*4882a593Smuzhiyun	$(if $(BR2_PACKAGE_PHP_EXT_XMLREADER),--enable-xmlreader) \
107*4882a593Smuzhiyun	$(if $(BR2_PACKAGE_PHP_EXT_XMLWRITER),--enable-xmlwriter) \
108*4882a593Smuzhiyun	$(if $(BR2_PACKAGE_PHP_EXT_EXIF),--enable-exif) \
109*4882a593Smuzhiyun	$(if $(BR2_PACKAGE_PHP_EXT_FTP),--enable-ftp) \
110*4882a593Smuzhiyun	$(if $(BR2_PACKAGE_PHP_EXT_TOKENIZER),--enable-tokenizer) \
111*4882a593Smuzhiyun	$(if $(BR2_PACKAGE_PHP_EXT_PCNTL),--enable-pcntl) \
112*4882a593Smuzhiyun	$(if $(BR2_PACKAGE_PHP_EXT_SHMOP),--enable-shmop) \
113*4882a593Smuzhiyun	$(if $(BR2_PACKAGE_PHP_EXT_SYSVMSG),--enable-sysvmsg) \
114*4882a593Smuzhiyun	$(if $(BR2_PACKAGE_PHP_EXT_SYSVSEM),--enable-sysvsem) \
115*4882a593Smuzhiyun	$(if $(BR2_PACKAGE_PHP_EXT_SYSVSHM),--enable-sysvshm) \
116*4882a593Smuzhiyun	$(if $(BR2_PACKAGE_PHP_EXT_ZIP),--with-zip) \
117*4882a593Smuzhiyun	$(if $(BR2_PACKAGE_PHP_EXT_CTYPE),--enable-ctype) \
118*4882a593Smuzhiyun	$(if $(BR2_PACKAGE_PHP_EXT_FILTER),--enable-filter) \
119*4882a593Smuzhiyun	$(if $(BR2_PACKAGE_PHP_EXT_CALENDAR),--enable-calendar) \
120*4882a593Smuzhiyun	$(if $(BR2_PACKAGE_PHP_EXT_FILEINFO),--enable-fileinfo) \
121*4882a593Smuzhiyun	$(if $(BR2_PACKAGE_PHP_EXT_BCMATH),--enable-bcmath) \
122*4882a593Smuzhiyun	$(if $(BR2_PACKAGE_PHP_EXT_PHAR),--enable-phar)
123*4882a593Smuzhiyun
124*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_PHP_EXT_LIBARGON2),y)
125*4882a593SmuzhiyunPHP_CONF_OPTS += --with-password-argon2=$(STAGING_DIR)/usr
126*4882a593SmuzhiyunPHP_DEPENDENCIES += libargon2
127*4882a593Smuzhiyunendif
128*4882a593Smuzhiyun
129*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_PHP_EXT_LIBSODIUM),y)
130*4882a593SmuzhiyunPHP_CONF_OPTS += --with-sodium=$(STAGING_DIR)/usr
131*4882a593SmuzhiyunPHP_DEPENDENCIES += libsodium
132*4882a593Smuzhiyunendif
133*4882a593Smuzhiyun
134*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_PHP_EXT_MBSTRING),y)
135*4882a593SmuzhiyunPHP_CONF_OPTS += --enable-mbstring
136*4882a593SmuzhiyunPHP_DEPENDENCIES += oniguruma
137*4882a593Smuzhiyunendif
138*4882a593Smuzhiyun
139*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_PHP_EXT_OPENSSL),y)
140*4882a593SmuzhiyunPHP_CONF_OPTS += --with-openssl=$(STAGING_DIR)/usr
141*4882a593SmuzhiyunPHP_DEPENDENCIES += openssl
142*4882a593Smuzhiyun# openssl needs zlib, but the configure script forgets to link against
143*4882a593Smuzhiyun# it causing detection failures with static linking
144*4882a593SmuzhiyunPHP_STATIC_LIBS += `$(PKG_CONFIG_HOST_BINARY) --libs openssl`
145*4882a593Smuzhiyunendif
146*4882a593Smuzhiyun
147*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_PHP_EXT_LIBXML2),y)
148*4882a593SmuzhiyunPHP_CONF_ENV += php_cv_libxml_build_works=yes
149*4882a593SmuzhiyunPHP_CONF_OPTS += --with-libxml
150*4882a593SmuzhiyunPHP_DEPENDENCIES += libxml2
151*4882a593Smuzhiyunendif
152*4882a593Smuzhiyun
153*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_PHP_EXT_WDDX),y)
154*4882a593SmuzhiyunPHP_CONF_OPTS += --enable-wddx --with-libexpat-dir=$(STAGING_DIR)/usr
155*4882a593SmuzhiyunPHP_DEPENDENCIES += expat
156*4882a593Smuzhiyunendif
157*4882a593Smuzhiyun
158*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_PHP_EXT_ZIP),y)
159*4882a593SmuzhiyunPHP_DEPENDENCIES += libzip
160*4882a593Smuzhiyunendif
161*4882a593Smuzhiyun
162*4882a593Smuzhiyunifneq ($(BR2_PACKAGE_PHP_EXT_ZLIB)$(BR2_PACKAGE_PHP_EXT_ZIP),)
163*4882a593SmuzhiyunPHP_CONF_OPTS += --with-zlib=$(STAGING_DIR)/usr
164*4882a593SmuzhiyunPHP_DEPENDENCIES += zlib
165*4882a593Smuzhiyunelse
166*4882a593SmuzhiyunPHP_CONF_OPTS += --disable-mysqlnd_compression_support
167*4882a593Smuzhiyunendif
168*4882a593Smuzhiyun
169*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_PHP_EXT_GETTEXT),y)
170*4882a593SmuzhiyunPHP_CONF_OPTS += --with-gettext=$(STAGING_DIR)/usr
171*4882a593SmuzhiyunPHP_DEPENDENCIES += $(TARGET_NLS_DEPENDENCIES)
172*4882a593Smuzhiyunendif
173*4882a593Smuzhiyun
174*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_PHP_EXT_ICONV),y)
175*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_LIBICONV),y)
176*4882a593SmuzhiyunPHP_CONF_OPTS += --with-iconv=$(STAGING_DIR)/usr
177*4882a593SmuzhiyunPHP_DEPENDENCIES += libiconv
178*4882a593Smuzhiyunelse
179*4882a593SmuzhiyunPHP_CONF_OPTS += --with-iconv
180*4882a593Smuzhiyunendif
181*4882a593Smuzhiyunendif
182*4882a593Smuzhiyun
183*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_PHP_EXT_INTL),y)
184*4882a593SmuzhiyunPHP_CONF_OPTS += --enable-intl --with-icu-dir=$(STAGING_DIR)/usr
185*4882a593SmuzhiyunPHP_CXXFLAGS += "`$(STAGING_DIR)/usr/bin/icu-config --cxxflags`"
186*4882a593SmuzhiyunPHP_DEPENDENCIES += icu
187*4882a593Smuzhiyun# The intl module is implemented in C++, but PHP fails to use
188*4882a593Smuzhiyun# g++ as the compiler for the final link. As a workaround,
189*4882a593Smuzhiyun# tell it to link libstdc++.
190*4882a593SmuzhiyunPHP_EXTRA_LIBS += -lstdc++
191*4882a593Smuzhiyunendif
192*4882a593Smuzhiyun
193*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_PHP_EXT_GMP),y)
194*4882a593SmuzhiyunPHP_CONF_OPTS += --with-gmp=$(STAGING_DIR)/usr
195*4882a593SmuzhiyunPHP_DEPENDENCIES += gmp
196*4882a593Smuzhiyunendif
197*4882a593Smuzhiyun
198*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_PHP_EXT_READLINE),y)
199*4882a593SmuzhiyunPHP_CONF_OPTS += --with-readline=$(STAGING_DIR)/usr
200*4882a593SmuzhiyunPHP_DEPENDENCIES += readline
201*4882a593Smuzhiyunendif
202*4882a593Smuzhiyun
203*4882a593Smuzhiyun### Native SQL extensions
204*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_PHP_EXT_MYSQLI),y)
205*4882a593SmuzhiyunPHP_CONF_OPTS += --with-mysqli
206*4882a593Smuzhiyunendif
207*4882a593Smuzhiyun
208*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_PHP_EXT_PGSQL),y)
209*4882a593SmuzhiyunPHP_CONF_OPTS += --with-pgsql=$(STAGING_DIR)/usr
210*4882a593SmuzhiyunPHP_DEPENDENCIES += postgresql
211*4882a593Smuzhiyunendif
212*4882a593Smuzhiyun
213*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_PHP_EXT_SQLITE),y)
214*4882a593SmuzhiyunPHP_CONF_OPTS += --with-sqlite3=$(STAGING_DIR)/usr
215*4882a593SmuzhiyunPHP_DEPENDENCIES += sqlite
216*4882a593SmuzhiyunPHP_STATIC_LIBS += `$(PKG_CONFIG_HOST_BINARY) --libs sqlite3`
217*4882a593Smuzhiyunendif
218*4882a593Smuzhiyun
219*4882a593Smuzhiyun### PDO
220*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_PHP_EXT_PDO),y)
221*4882a593SmuzhiyunPHP_CONF_OPTS += --enable-pdo
222*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_PHP_EXT_PDO_SQLITE),y)
223*4882a593SmuzhiyunPHP_CONF_OPTS += --with-pdo-sqlite=$(STAGING_DIR)/usr
224*4882a593SmuzhiyunPHP_DEPENDENCIES += sqlite
225*4882a593SmuzhiyunPHP_CFLAGS += -DSQLITE_OMIT_LOAD_EXTENSION
226*4882a593Smuzhiyunendif
227*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_PHP_EXT_PDO_MYSQL),y)
228*4882a593SmuzhiyunPHP_CONF_OPTS += --with-pdo-mysql
229*4882a593Smuzhiyunendif
230*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_PHP_EXT_PDO_POSTGRESQL),y)
231*4882a593SmuzhiyunPHP_CONF_OPTS += --with-pdo-pgsql=$(STAGING_DIR)/usr
232*4882a593SmuzhiyunPHP_DEPENDENCIES += postgresql
233*4882a593Smuzhiyunendif
234*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_PHP_EXT_PDO_UNIXODBC),y)
235*4882a593SmuzhiyunPHP_CONF_OPTS += --with-pdo-odbc=unixODBC,$(STAGING_DIR)/usr
236*4882a593SmuzhiyunPHP_DEPENDENCIES += unixodbc
237*4882a593Smuzhiyunendif
238*4882a593Smuzhiyunendif
239*4882a593Smuzhiyun
240*4882a593Smuzhiyunifneq ($(BR2_PACKAGE_PHP_EXT_MYSQLI)$(BR2_PACKAGE_PHP_EXT_PDO_MYSQL),)
241*4882a593Smuzhiyun# Set default MySQL unix socket to what the MySQL server is using by default
242*4882a593SmuzhiyunPHP_CONF_OPTS += --with-mysql-sock=$(MYSQL_SOCKET)
243*4882a593Smuzhiyunendif
244*4882a593Smuzhiyun
245*4882a593Smuzhiyundefine PHP_DISABLE_VALGRIND
246*4882a593Smuzhiyun	$(SED) '/^#define HAVE_VALGRIND/d' $(@D)/main/php_config.h
247*4882a593Smuzhiyunendef
248*4882a593SmuzhiyunPHP_POST_CONFIGURE_HOOKS += PHP_DISABLE_VALGRIND
249*4882a593Smuzhiyun
250*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_PCRE2_JIT),y)
251*4882a593SmuzhiyunPHP_CONF_OPTS += --with-pcre-jit=yes
252*4882a593SmuzhiyunPHP_CONF_ENV += ac_cv_have_pcre2_jit=yes
253*4882a593Smuzhiyunelse
254*4882a593SmuzhiyunPHP_CONF_OPTS += --with-pcre-jit=no
255*4882a593SmuzhiyunPHP_CONF_ENV += ac_cv_have_pcre2_jit=no
256*4882a593Smuzhiyunendif
257*4882a593Smuzhiyun
258*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_PHP_EXT_CURL),y)
259*4882a593SmuzhiyunPHP_CONF_OPTS += --with-curl
260*4882a593SmuzhiyunPHP_DEPENDENCIES += libcurl
261*4882a593Smuzhiyunendif
262*4882a593Smuzhiyun
263*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_PHP_EXT_XSL),y)
264*4882a593SmuzhiyunPHP_CONF_OPTS += --with-xsl=$(STAGING_DIR)/usr
265*4882a593SmuzhiyunPHP_DEPENDENCIES += libxslt
266*4882a593Smuzhiyunendif
267*4882a593Smuzhiyun
268*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_PHP_EXT_BZIP2),y)
269*4882a593SmuzhiyunPHP_CONF_OPTS += --with-bz2=$(STAGING_DIR)/usr
270*4882a593SmuzhiyunPHP_DEPENDENCIES += bzip2
271*4882a593Smuzhiyunendif
272*4882a593Smuzhiyun
273*4882a593Smuzhiyun### DBA
274*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_PHP_EXT_DBA),y)
275*4882a593SmuzhiyunPHP_CONF_OPTS += --enable-dba
276*4882a593Smuzhiyunifneq ($(BR2_PACKAGE_PHP_EXT_DBA_CDB),y)
277*4882a593SmuzhiyunPHP_CONF_OPTS += --without-cdb
278*4882a593Smuzhiyunendif
279*4882a593Smuzhiyunifneq ($(BR2_PACKAGE_PHP_EXT_DBA_FLAT),y)
280*4882a593SmuzhiyunPHP_CONF_OPTS += --without-flatfile
281*4882a593Smuzhiyunendif
282*4882a593Smuzhiyunifneq ($(BR2_PACKAGE_PHP_EXT_DBA_INI),y)
283*4882a593SmuzhiyunPHP_CONF_OPTS += --without-inifile
284*4882a593Smuzhiyunendif
285*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_PHP_EXT_DBA_DB4),y)
286*4882a593SmuzhiyunPHP_CONF_OPTS += --with-db4=$(STAGING_DIR)/usr
287*4882a593SmuzhiyunPHP_DEPENDENCIES += berkeleydb
288*4882a593Smuzhiyunendif
289*4882a593Smuzhiyunendif
290*4882a593Smuzhiyun
291*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_PHP_EXT_SNMP),y)
292*4882a593SmuzhiyunPHP_CONF_OPTS += --with-snmp=$(STAGING_DIR)/usr
293*4882a593SmuzhiyunPHP_DEPENDENCIES += netsnmp
294*4882a593Smuzhiyunendif
295*4882a593Smuzhiyun
296*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_PHP_EXT_GD),y)
297*4882a593SmuzhiyunPHP_CONF_OPTS += \
298*4882a593Smuzhiyun	--enable-gd \
299*4882a593Smuzhiyun	--with-jpeg \
300*4882a593Smuzhiyun	--with-freetype
301*4882a593SmuzhiyunPHP_DEPENDENCIES += jpeg libpng freetype zlib
302*4882a593Smuzhiyunendif
303*4882a593Smuzhiyun
304*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_PHP_EXT_FFI),y)
305*4882a593SmuzhiyunPHP_CONF_OPTS += --with-ffi
306*4882a593SmuzhiyunPHP_DEPENDENCIES += libffi
307*4882a593Smuzhiyunendif
308*4882a593Smuzhiyun
309*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_PHP_SAPI_FPM),y)
310*4882a593Smuzhiyundefine PHP_INSTALL_INIT_SYSV
311*4882a593Smuzhiyun	$(INSTALL) -D -m 0755 $(@D)/sapi/fpm/init.d.php-fpm \
312*4882a593Smuzhiyun		$(TARGET_DIR)/etc/init.d/S49php-fpm
313*4882a593Smuzhiyunendef
314*4882a593Smuzhiyun
315*4882a593Smuzhiyundefine PHP_INSTALL_INIT_SYSTEMD
316*4882a593Smuzhiyun	$(INSTALL) -D -m 0644 $(@D)/sapi/fpm/php-fpm.service \
317*4882a593Smuzhiyun		$(TARGET_DIR)/usr/lib/systemd/system/php-fpm.service
318*4882a593Smuzhiyunendef
319*4882a593Smuzhiyun
320*4882a593Smuzhiyundefine PHP_INSTALL_FPM_CONF
321*4882a593Smuzhiyun	$(INSTALL) -D -m 0644 package/php/php-fpm.conf \
322*4882a593Smuzhiyun		$(TARGET_DIR)/etc/php-fpm.conf
323*4882a593Smuzhiyun	rm -f $(TARGET_DIR)/etc/php-fpm.d/www.conf.default
324*4882a593Smuzhiyun	# remove unused sample status page /usr/php/php/fpm/status.html
325*4882a593Smuzhiyun	rm -rf $(TARGET_DIR)/usr/php
326*4882a593Smuzhiyunendef
327*4882a593Smuzhiyun
328*4882a593SmuzhiyunPHP_POST_INSTALL_TARGET_HOOKS += PHP_INSTALL_FPM_CONF
329*4882a593Smuzhiyunendif
330*4882a593Smuzhiyun
331*4882a593Smuzhiyundefine PHP_EXTENSIONS_FIXUP
332*4882a593Smuzhiyun	$(SED) "/prefix/ s:/usr:$(STAGING_DIR)/usr:" \
333*4882a593Smuzhiyun		$(STAGING_DIR)/usr/bin/phpize
334*4882a593Smuzhiyun	$(SED) "/extension_dir/ s:/usr:$(TARGET_DIR)/usr:" \
335*4882a593Smuzhiyun		$(STAGING_DIR)/usr/bin/php-config
336*4882a593Smuzhiyunendef
337*4882a593Smuzhiyun
338*4882a593SmuzhiyunPHP_POST_INSTALL_TARGET_HOOKS += PHP_EXTENSIONS_FIXUP
339*4882a593Smuzhiyun
340*4882a593Smuzhiyundefine PHP_INSTALL_FIXUP
341*4882a593Smuzhiyun	rm -rf $(TARGET_DIR)/usr/lib/php/build
342*4882a593Smuzhiyun	rm -f $(TARGET_DIR)/usr/bin/phpize
343*4882a593Smuzhiyun	$(INSTALL) -D -m 0755 $(PHP_DIR)/php.ini-production \
344*4882a593Smuzhiyun		$(TARGET_DIR)/etc/php.ini
345*4882a593Smuzhiyun	$(SED) 's%;date.timezone =.*%date.timezone = $(PHP_LOCALTIME)%' \
346*4882a593Smuzhiyun		$(TARGET_DIR)/etc/php.ini
347*4882a593Smuzhiyun	$(if $(BR2_PACKAGE_PHP_EXT_OPCACHE),
348*4882a593Smuzhiyun		$(SED) '/;extension=php_xsl.dll/azend_extension=opcache.so' \
349*4882a593Smuzhiyun		$(TARGET_DIR)/etc/php.ini)
350*4882a593Smuzhiyunendef
351*4882a593Smuzhiyun
352*4882a593SmuzhiyunPHP_POST_INSTALL_TARGET_HOOKS += PHP_INSTALL_FIXUP
353*4882a593Smuzhiyun
354*4882a593SmuzhiyunPHP_CONF_ENV += CFLAGS="$(PHP_CFLAGS)" CXXFLAGS="$(PHP_CXXFLAGS)"
355*4882a593Smuzhiyun
356*4882a593Smuzhiyun$(eval $(autotools-package))
357