blob: ff4c28e1337ae87a3826929755a597f507e3036b [file] [log] [blame]
Andrew Geissler82c905d2020-04-13 13:39:40 -05001SUMMARY = "A server-side, HTML-embedded scripting language"
2HOMEPAGE = "http://www.php.net"
3SECTION = "console/network"
4
5LICENSE = "PHP-3.0"
6LIC_FILES_CHKSUM = "file://LICENSE;md5=7e571b888d585b31f9ef5edcc647fa30"
7
8BBCLASSEXTEND = "native"
9DEPENDS = "zlib bzip2 libxml2 virtual/libiconv php-native lemon-native"
10DEPENDS_class-native = "zlib-native libxml2-native"
11
12PHP_MAJOR_VERSION = "${@d.getVar('PV').split('.')[0]}"
13
14SRC_URI = "http://php.net/distributions/php-${PV}.tar.bz2 \
15 file://0001-php-don-t-use-broken-wrapper-for-mkdir.patch \
16 file://debian-php-fixheader.patch \
17 file://0001-configure.ac-don-t-include-build-libtool.m4.patch \
18 file://0001-php.m4-don-t-unset-cache-variables.patch \
19 "
20
21SRC_URI_append_class-target = " \
22 file://iconv.patch \
23 file://imap-fix-autofoo.patch \
24 file://php_exec_native.patch \
25 file://php-fpm.conf \
26 file://php-fpm-apache.conf \
27 file://70_mod_php${PHP_MAJOR_VERSION}.conf \
28 file://php-fpm.service \
29 file://pear-makefile.patch \
30 file://phar-makefile.patch \
31 file://0001-opcache-config.m4-enable-opcache.patch \
32 file://xfail_two_bug_tests.patch \
33 "
34S = "${WORKDIR}/php-${PV}"
35SRC_URI[md5sum] = "262c258a3b8b5699fcca89a64e58758c"
36SRC_URI[sha256sum] = "308e8f4182ec8a2767b0b1b8e1e7c69fb149b37cfb98ee4a37475e082fa9829f"
37
38inherit autotools pkgconfig python3native gettext
39
40# phpize is not scanned for absolute paths by default (but php-config is).
41#
42SSTATE_SCAN_FILES += "phpize"
43SSTATE_SCAN_FILES += "build-defs.h"
44
45PHP_LIBDIR = "${libdir}/php${PHP_MAJOR_VERSION}"
46
47# Common EXTRA_OECONF
48COMMON_EXTRA_OECONF = "--enable-sockets \
49 --enable-pcntl \
50 --enable-shared \
51 --disable-rpath \
52 --with-pic \
53 --libdir=${PHP_LIBDIR} \
54"
55EXTRA_OECONF = "--enable-mbstring \
56 --enable-fpm \
57 --with-libdir=${baselib} \
58 --with-gettext=${STAGING_LIBDIR}/.. \
59 --with-zlib=${STAGING_LIBDIR}/.. \
60 --with-iconv=${STAGING_LIBDIR}/.. \
61 --with-bz2=${STAGING_DIR_TARGET}${exec_prefix} \
62 --with-config-file-path=${sysconfdir}/php/apache2-php${PHP_MAJOR_VERSION} \
63 ${@oe.utils.conditional('SITEINFO_ENDIANNESS', 'le', 'ac_cv_c_bigendian_php=no', 'ac_cv_c_bigendian_php=yes', d)} \
64 ${@bb.utils.contains('PACKAGECONFIG', 'pam', '', 'ac_cv_lib_pam_pam_start=no', d)} \
65 ${COMMON_EXTRA_OECONF} \
66"
67
68EXTRA_OECONF_append_riscv64 = " --with-pcre-jit=no"
69EXTRA_OECONF_append_riscv32 = " --with-pcre-jit=no"
70
71CACHED_CONFIGUREVARS += "ac_cv_func_dlopen=no ac_cv_lib_dl_dlopen=yes"
72
73EXTRA_OECONF_class-native = " \
74 --with-zlib=${STAGING_LIBDIR_NATIVE}/.. \
75 --without-iconv \
76 ${COMMON_EXTRA_OECONF} \
77"
78
79PACKAGECONFIG ??= "mysql sqlite3 imap opcache openssl \
80 ${@bb.utils.filter('DISTRO_FEATURES', 'ipv6 pam', d)} \
81"
82PACKAGECONFIG_class-native = ""
83
84PACKAGECONFIG[zip] = "--enable-zip --with-libzip=${STAGING_EXECPREFIXDIR},,libzip"
85
86PACKAGECONFIG[mysql] = "--with-mysqli=mysqlnd \
87 --with-pdo-mysql=mysqlnd \
88 ,--without-mysqli --without-pdo-mysql \
89 ,mysql5"
90
91PACKAGECONFIG[sqlite3] = "--with-sqlite3=${STAGING_LIBDIR}/.. \
92 --with-pdo-sqlite=${STAGING_LIBDIR}/.. \
93 ,--without-sqlite3 --without-pdo-sqlite \
94 ,sqlite3"
95PACKAGECONFIG[pgsql] = "--with-pgsql=${STAGING_DIR_TARGET}${exec_prefix},--without-pgsql,postgresql"
96PACKAGECONFIG[soap] = "--enable-libxml --enable-soap, --disable-soap, libxml2"
97PACKAGECONFIG[apache2] = "--with-apxs2=${STAGING_BINDIR_CROSS}/apxs,,apache2-native apache2"
98PACKAGECONFIG[pam] = ",,libpam"
99PACKAGECONFIG[imap] = "--with-imap=${STAGING_DIR_HOST} \
100 --with-imap-ssl=${STAGING_DIR_HOST} \
101 ,--without-imap --without-imap-ssl \
102 ,uw-imap"
103PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6,"
104PACKAGECONFIG[opcache] = "--enable-opcache,--disable-opcache"
105PACKAGECONFIG[openssl] = "--with-openssl,--without-openssl,openssl"
106PACKAGECONFIG[valgrind] = "--with-valgrind=${STAGING_DIR_TARGET}/usr,--with-valgrind=no,valgrind"
107PACKAGECONFIG[mbregex] = "--enable-mbregex, --disable-mbregex, oniguruma"
108
109export PHP_NATIVE_DIR = "${STAGING_BINDIR_NATIVE}"
110export PHP_PEAR_PHP_BIN = "${STAGING_BINDIR_NATIVE}/php"
111CFLAGS += " -D_GNU_SOURCE -g -DPTYS_ARE_GETPT -DPTYS_ARE_SEARCHED -I${STAGING_INCDIR}/apache2"
112
113EXTRA_OEMAKE = "INSTALL_ROOT=${D}"
114
115acpaths = ""
116
117do_configure_prepend () {
118 rm -f ${S}/build/libtool.m4 ${S}/ltmain.sh ${S}/aclocal.m4
119 find ${S} -name config.m4 | xargs -n1 sed -i 's!APXS_HTTPD=.*!APXS_HTTPD=${STAGING_SBINDIR_NATIVE}/httpd!'
120}
121
122do_configure_append() {
123 # No, libtool, we really don't want rpath set...
124 sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' ${HOST_SYS}-libtool
125 sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' ${HOST_SYS}-libtool
126}
127
128do_install_append_class-native() {
129 rm -rf ${D}/${PHP_LIBDIR}/php/.registry
130 rm -rf ${D}/${PHP_LIBDIR}/php/.channels
131 rm -rf ${D}/${PHP_LIBDIR}/php/.[a-z]*
132}
133
134do_install_prepend() {
135 cat ${ACLOCALDIR}/libtool.m4 ${ACLOCALDIR}/lt~obsolete.m4 ${ACLOCALDIR}/ltoptions.m4 \
136 ${ACLOCALDIR}/ltsugar.m4 ${ACLOCALDIR}/ltversion.m4 > ${S}/build/libtool.m4
137}
138
139do_install_prepend_class-target() {
140 if ${@bb.utils.contains('PACKAGECONFIG', 'apache2', 'true', 'false', d)}; then
141 # Install dummy config file so apxs doesn't fail
142 install -d ${D}${sysconfdir}/apache2
143 printf "\nLoadModule dummy_module modules/mod_dummy.so\n" > ${D}${sysconfdir}/apache2/httpd.conf
144 fi
145}
146
147# fixme
148do_install_append_class-target() {
149 install -d ${D}${sysconfdir}/
150 rm -rf ${D}/${TMPDIR}
151 rm -rf ${D}/.registry
152 rm -rf ${D}/.channels
153 rm -rf ${D}/.[a-z]*
154 rm -rf ${D}/var
155 rm -f ${D}/${sysconfdir}/php-fpm.conf.default
156 install -m 0644 ${WORKDIR}/php-fpm.conf ${D}/${sysconfdir}/php-fpm.conf
157 install -d ${D}/${sysconfdir}/apache2/conf.d
158 install -m 0644 ${WORKDIR}/php-fpm-apache.conf ${D}/${sysconfdir}/apache2/conf.d/php-fpm.conf
159 install -d ${D}${sysconfdir}/init.d
160 sed -i 's:=/usr/sbin:=${sbindir}:g' ${B}/sapi/fpm/init.d.php-fpm
161 sed -i 's:=/etc:=${sysconfdir}:g' ${B}/sapi/fpm/init.d.php-fpm
162 sed -i 's:=/var:=${localstatedir}:g' ${B}/sapi/fpm/init.d.php-fpm
163 install -m 0755 ${B}/sapi/fpm/init.d.php-fpm ${D}${sysconfdir}/init.d/php-fpm
164 install -m 0644 ${WORKDIR}/php-fpm-apache.conf ${D}/${sysconfdir}/apache2/conf.d/php-fpm.conf
165
166 if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)};then
167 install -d ${D}${systemd_unitdir}/system
168 install -m 0644 ${WORKDIR}/php-fpm.service ${D}${systemd_unitdir}/system/
169 sed -i -e 's,@SYSCONFDIR@,${sysconfdir},g' \
170 -e 's,@LOCALSTATEDIR@,${localstatedir},g' \
171 ${D}${systemd_unitdir}/system/php-fpm.service
172 fi
173
174 TMP=`dirname ${D}/${TMPDIR}`
175 while test ${TMP} != ${D}; do
176 if [ -d ${TMP} ]; then
177 rmdir ${TMP}
178 fi
179 TMP=`dirname ${TMP}`;
180 done
181
182 if ${@bb.utils.contains('PACKAGECONFIG', 'apache2', 'true', 'false', d)}; then
183 install -d ${D}${sysconfdir}/apache2/modules.d
184 install -d ${D}${sysconfdir}/php/apache2-php${PHP_MAJOR_VERSION}
185 install -m 644 ${WORKDIR}/70_mod_php${PHP_MAJOR_VERSION}.conf ${D}${sysconfdir}/apache2/modules.d
186 sed -i s,lib/,${libexecdir}/, ${D}${sysconfdir}/apache2/modules.d/70_mod_php${PHP_MAJOR_VERSION}.conf
187 cat ${S}/php.ini-production | \
188 sed -e 's,extension_dir = \"\./\",extension_dir = \"/usr/lib/extensions\",' \
189 > ${D}${sysconfdir}/php/apache2-php${PHP_MAJOR_VERSION}/php.ini
190 rm -f ${D}${sysconfdir}/apache2/httpd.conf*
191 fi
192}
193
194SYSROOT_PREPROCESS_FUNCS += "php_sysroot_preprocess"
195
196php_sysroot_preprocess () {
197 install -d ${SYSROOT_DESTDIR}${bindir_crossscripts}/
198 install -m 755 ${D}${bindir}/phpize ${SYSROOT_DESTDIR}${bindir_crossscripts}/
199 install -m 755 ${D}${bindir}/php-config ${SYSROOT_DESTDIR}${bindir_crossscripts}/
200
201 sed -i 's!eval echo /!eval echo ${STAGING_DIR_HOST}/!' ${SYSROOT_DESTDIR}${bindir_crossscripts}/phpize
202 sed -i 's!^include_dir=.*!include_dir=${STAGING_INCDIR}/php!' ${SYSROOT_DESTDIR}${bindir_crossscripts}/php-config
203}
204
205MODPHP_PACKAGE = "${@bb.utils.contains('PACKAGECONFIG', 'apache2', '${PN}-modphp', '', d)}"
206
207PACKAGES = "${PN}-dbg ${PN}-cli ${PN}-cgi ${PN}-fpm ${PN}-fpm-apache2 ${PN}-pear ${PN}-phar ${MODPHP_PACKAGE} ${PN}-dev ${PN}-staticdev ${PN}-doc ${PN}-opcache ${PN}"
208
209RDEPENDS_${PN} += "libgcc"
210RDEPENDS_${PN}-pear = "${PN}"
211RDEPENDS_${PN}-phar = "${PN}-cli"
212RDEPENDS_${PN}-cli = "${PN}"
213RDEPENDS_${PN}-modphp = "${PN} apache2"
214RDEPENDS_${PN}-opcache = "${PN}"
215
216INITSCRIPT_PACKAGES = "${PN}-fpm"
217inherit update-rc.d
218
219FILES_${PN}-dbg =+ "${bindir}/.debug \
220 ${libexecdir}/apache2/modules/.debug"
221FILES_${PN}-doc += "${PHP_LIBDIR}/php/doc"
222FILES_${PN}-cli = "${bindir}/php"
223FILES_${PN}-phar = "${bindir}/phar*"
224FILES_${PN}-cgi = "${bindir}/php-cgi"
225FILES_${PN}-fpm = "${sbindir}/php-fpm ${sysconfdir}/php-fpm.conf ${datadir}/fpm ${sysconfdir}/init.d/php-fpm ${systemd_unitdir}/system/php-fpm.service ${sysconfdir}/php-fpm.d/www.conf.default"
226FILES_${PN}-fpm-apache2 = "${sysconfdir}/apache2/conf.d/php-fpm.conf"
227CONFFILES_${PN}-fpm = "${sysconfdir}/php-fpm.conf"
228CONFFILES_${PN}-fpm-apache2 = "${sysconfdir}/apache2/conf.d/php-fpm.conf"
229INITSCRIPT_NAME_${PN}-fpm = "php-fpm"
230INITSCRIPT_PARAMS_${PN}-fpm = "defaults 60"
231FILES_${PN}-pear = "${bindir}/pear* ${bindir}/pecl ${PHP_LIBDIR}/php/PEAR \
232 ${PHP_LIBDIR}/php/PEAR*.php ${PHP_LIBDIR}/php/System.php \
233 ${PHP_LIBDIR}/php/peclcmd.php ${PHP_LIBDIR}/php/pearcmd.php \
234 ${PHP_LIBDIR}/php/.channels ${PHP_LIBDIR}/php/.channels/.alias \
235 ${PHP_LIBDIR}/php/.registry ${PHP_LIBDIR}/php/Archive/Tar.php \
236 ${PHP_LIBDIR}/php/Console/Getopt.php ${PHP_LIBDIR}/php/OS/Guess.php \
237 ${PHP_LIBDIR}/php/data/PEAR \
238 ${sysconfdir}/pear.conf"
239FILES_${PN}-dev = "${includedir}/php ${PHP_LIBDIR}/build ${bindir}/phpize \
240 ${bindir}/php-config ${PHP_LIBDIR}/php/.depdb \
241 ${PHP_LIBDIR}/php/.depdblock ${PHP_LIBDIR}/php/.filemap \
242 ${PHP_LIBDIR}/php/.lock ${PHP_LIBDIR}/php/test"
243FILES_${PN}-staticdev += "${PHP_LIBDIR}/extensions/*/*.a"
244FILES_${PN}-opcache = "${PHP_LIBDIR}/extensions/*/opcache${SOLIBSDEV}"
245FILES_${PN} = "${PHP_LIBDIR}/php"
246FILES_${PN} += "${bindir} ${libexecdir}/apache2"
247
248SUMMARY_${PN}-modphp = "PHP module for the Apache HTTP server"
249FILES_${PN}-modphp = "${libdir}/apache2 ${sysconfdir}"
250
251MODPHP_OLDPACKAGE = "${@bb.utils.contains('PACKAGECONFIG', 'apache2', 'modphp', '', d)}"
252RPROVIDES_${PN}-modphp = "${MODPHP_OLDPACKAGE}"
253RREPLACES_${PN}-modphp = "${MODPHP_OLDPACKAGE}"
254RCONFLICTS_${PN}-modphp = "${MODPHP_OLDPACKAGE}"
255
256do_install_append_class-native() {
257 create_wrapper ${D}${bindir}/php \
258 PHP_PEAR_SYSCONF_DIR=${sysconfdir}/
259}
260
261
262# Fails to build with thumb-1 (qemuarm)
263# | {standard input}: Assembler messages:
264# | {standard input}:3719: Error: selected processor does not support Thumb mode `smull r0,r2,r9,r3'
265# | {standard input}:3720: Error: unshifted register required -- `sub r2,r2,r0,asr#31'
266# | {standard input}:3796: Error: selected processor does not support Thumb mode `smull r0,r2,r3,r3'
267# | {standard input}:3797: Error: unshifted register required -- `sub r2,r2,r0,asr#31'
268# | make: *** [ext/standard/math.lo] Error 1
269ARM_INSTRUCTION_SET = "arm"