blob: e7fb847fa94b8612dc3b076bd22066e6bee5215a [file] [log] [blame]
Patrick Williamsb48b7b42016-08-17 15:04:38 -05001SUMMARY = "A server-side, HTML-embedded scripting language"
2HOMEPAGE = "http://www.php.net"
3SECTION = "console/network"
4
5LICENSE = "PHP-3.0"
Brad Bishop868407c2019-11-04 13:24:47 -05006LIC_FILES_CHKSUM = "file://LICENSE;md5=fb07bfc51f6d5e0c30b65d9701233b2e"
Patrick Williamsb48b7b42016-08-17 15:04:38 -05007
8BBCLASSEXTEND = "native"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08009DEPENDS = "zlib bzip2 libxml2 virtual/libiconv php-native lemon-native"
Patrick Williamsb48b7b42016-08-17 15:04:38 -050010DEPENDS_class-native = "zlib-native libxml2-native"
11
Brad Bishop19323692019-04-05 15:28:33 -040012PHP_MAJOR_VERSION = "${@d.getVar('PV').split('.')[0]}"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050013
Patrick Williamsb48b7b42016-08-17 15:04:38 -050014SRC_URI = "http://php.net/distributions/php-${PV}.tar.bz2 \
Patrick Williamsb48b7b42016-08-17 15:04:38 -050015 file://0001-php-don-t-use-broken-wrapper-for-mkdir.patch \
Brad Bishop868407c2019-11-04 13:24:47 -050016 file://0001-acinclude.m4-don-t-unset-cache-variables.patch \
17 file://0048-Use-pkg-config-for-FreeType2-detection.patch \
18 file://0001-Use-pkg-config-for-libxml2-detection.patch \
19 file://debian-php-fixheader.patch \
20 file://CVE-2019-6978.patch \
Patrick Williamsb48b7b42016-08-17 15:04:38 -050021 "
22
Patrick Williamsddad1a12017-02-23 20:36:32 -060023SRC_URI_append_class-target = " \
Patrick Williamsb48b7b42016-08-17 15:04:38 -050024 file://iconv.patch \
25 file://imap-fix-autofoo.patch \
Patrick Williamsb48b7b42016-08-17 15:04:38 -050026 file://php_exec_native.patch \
27 file://php-fpm.conf \
28 file://php-fpm-apache.conf \
Brad Bishop6e60e8b2018-02-01 10:27:11 -050029 file://70_mod_php${PHP_MAJOR_VERSION}.conf \
Patrick Williamsb48b7b42016-08-17 15:04:38 -050030 file://php-fpm.service \
Brad Bishop868407c2019-11-04 13:24:47 -050031 file://pear-makefile.patch \
32 file://phar-makefile.patch \
33 file://0001-opcache-config.m4-enable-opcache.patch \
34 file://xfail_two_bug_tests.patch \
Patrick Williamsb48b7b42016-08-17 15:04:38 -050035 "
36S = "${WORKDIR}/php-${PV}"
Brad Bishop868407c2019-11-04 13:24:47 -050037SRC_URI[md5sum] = "21b710b4126d4d54714de9693a6c7b0d"
38SRC_URI[sha256sum] = "92d1ff4b13c7093635f1ec338a5e6891ca99b10e65fbcadd527e5bb84d11b5e7"
Patrick Williamsb48b7b42016-08-17 15:04:38 -050039
40inherit autotools pkgconfig pythonnative gettext
41
42# phpize is not scanned for absolute paths by default (but php-config is).
43#
44SSTATE_SCAN_FILES += "phpize"
45SSTATE_SCAN_FILES += "build-defs.h"
46
Brad Bishop6e60e8b2018-02-01 10:27:11 -050047PHP_LIBDIR = "${libdir}/php${PHP_MAJOR_VERSION}"
Patrick Williamsb48b7b42016-08-17 15:04:38 -050048
49# Common EXTRA_OECONF
50COMMON_EXTRA_OECONF = "--enable-sockets \
51 --enable-pcntl \
52 --enable-shared \
Patrick Williamsb48b7b42016-08-17 15:04:38 -050053 --disable-rpath \
54 --with-pic \
55 --libdir=${PHP_LIBDIR} \
56"
57EXTRA_OECONF = "--enable-mbstring \
58 --enable-wddx \
59 --enable-fpm \
Patrick Williamsb48b7b42016-08-17 15:04:38 -050060 --with-libdir=${baselib} \
61 --with-gettext=${STAGING_LIBDIR}/.. \
Brad Bishop90ca7472019-08-20 09:15:15 -040062 --with-zlib=${STAGING_LIBDIR}/.. \
Patrick Williamsb48b7b42016-08-17 15:04:38 -050063 --with-iconv=${STAGING_LIBDIR}/.. \
Patrick Williamsb48b7b42016-08-17 15:04:38 -050064 --with-bz2=${STAGING_DIR_TARGET}${exec_prefix} \
Brad Bishop6e60e8b2018-02-01 10:27:11 -050065 --with-config-file-path=${sysconfdir}/php/apache2-php${PHP_MAJOR_VERSION} \
Brad Bishop316dfdd2018-06-25 12:45:53 -040066 ${@oe.utils.conditional('SITEINFO_ENDIANNESS', 'le', 'ac_cv_c_bigendian_php=no', 'ac_cv_c_bigendian_php=yes', d)} \
Patrick Williamsb48b7b42016-08-17 15:04:38 -050067 ${@bb.utils.contains('PACKAGECONFIG', 'pam', '', 'ac_cv_lib_pam_pam_start=no', d)} \
68 ${COMMON_EXTRA_OECONF} \
69"
Brad Bishop316dfdd2018-06-25 12:45:53 -040070
Brad Bishopa891d152019-09-13 06:17:45 -040071EXTRA_OECONF_append_riscv64 = " --with-pcre-jit=no"
72EXTRA_OECONF_append_riscv32 = " --with-pcre-jit=no"
73
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080074CACHED_CONFIGUREVARS += "ac_cv_func_dlopen=no ac_cv_lib_dl_dlopen=yes"
Brad Bishop316dfdd2018-06-25 12:45:53 -040075
Patrick Williamsb48b7b42016-08-17 15:04:38 -050076EXTRA_OECONF_class-native = " \
77 --with-zlib=${STAGING_LIBDIR_NATIVE}/.. \
78 --without-iconv \
79 ${COMMON_EXTRA_OECONF} \
80"
81
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080082PACKAGECONFIG ??= "mysql sqlite3 imap opcache openssl \
Brad Bishop6e60e8b2018-02-01 10:27:11 -050083 ${@bb.utils.filter('DISTRO_FEATURES', 'ipv6 pam', d)} \
Patrick Williamsddad1a12017-02-23 20:36:32 -060084"
Patrick Williamsb48b7b42016-08-17 15:04:38 -050085PACKAGECONFIG_class-native = ""
86
Brad Bishop90ca7472019-08-20 09:15:15 -040087PACKAGECONFIG[zip] = "--enable-zip --with-libzip=${STAGING_EXECPREFIXDIR},,libzip"
88
Brad Bishopa891d152019-09-13 06:17:45 -040089PACKAGECONFIG[mysql] = "--with-mysqli=mysqlnd \
90 --with-pdo-mysql=mysqlnd \
91 ,--without-mysqli --without-pdo-mysql \
Patrick Williamsb48b7b42016-08-17 15:04:38 -050092 ,mysql5"
93
94PACKAGECONFIG[sqlite3] = "--with-sqlite3=${STAGING_LIBDIR}/.. \
95 --with-pdo-sqlite=${STAGING_LIBDIR}/.. \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080096 ,--without-sqlite3 --without-pdo-sqlite \
Patrick Williamsb48b7b42016-08-17 15:04:38 -050097 ,sqlite3"
98PACKAGECONFIG[pgsql] = "--with-pgsql=${STAGING_DIR_TARGET}${exec_prefix},--without-pgsql,postgresql"
99PACKAGECONFIG[soap] = "--enable-libxml --enable-soap, --disable-soap, libxml2"
100PACKAGECONFIG[apache2] = "--with-apxs2=${STAGING_BINDIR_CROSS}/apxs,,apache2-native apache2"
101PACKAGECONFIG[pam] = ",,libpam"
102PACKAGECONFIG[imap] = "--with-imap=${STAGING_DIR_HOST} \
103 --with-imap-ssl=${STAGING_DIR_HOST} \
104 ,--without-imap --without-imap-ssl \
105 ,uw-imap"
Patrick Williamsddad1a12017-02-23 20:36:32 -0600106PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6,"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800107PACKAGECONFIG[opcache] = "--enable-opcache,--disable-opcache"
108PACKAGECONFIG[openssl] = "--with-openssl,--without-openssl,openssl"
Brad Bishopa891d152019-09-13 06:17:45 -0400109PACKAGECONFIG[valgrind] = "--with-valgrind=${STAGING_DIR_TARGET}/usr,--with-valgrind=no,valgrind"
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500110
111export PHP_NATIVE_DIR = "${STAGING_BINDIR_NATIVE}"
112export PHP_PEAR_PHP_BIN = "${STAGING_BINDIR_NATIVE}/php"
113CFLAGS += " -D_GNU_SOURCE -g -DPTYS_ARE_GETPT -DPTYS_ARE_SEARCHED -I${STAGING_INCDIR}/apache2"
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500114
115EXTRA_OEMAKE = "INSTALL_ROOT=${D}"
116
117acpaths = ""
118
119do_configure_prepend () {
120 rm -f ${S}/build/libtool.m4 ${S}/ltmain.sh ${S}/aclocal.m4
Brad Bishopc342db32019-05-15 21:57:59 -0400121 find ${S} -name config.m4 | xargs -n1 sed -i 's!APXS_HTTPD=.*!APXS_HTTPD=${STAGING_SBINDIR_NATIVE}/httpd!'
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500122}
123
124do_configure_append() {
125 # No, libtool, we really don't want rpath set...
126 sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' ${HOST_SYS}-libtool
127 sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' ${HOST_SYS}-libtool
128}
129
130do_install_append_class-native() {
131 rm -rf ${D}/${PHP_LIBDIR}/php/.registry
132 rm -rf ${D}/${PHP_LIBDIR}/php/.channels
133 rm -rf ${D}/${PHP_LIBDIR}/php/.[a-z]*
134}
135
136do_install_prepend() {
Patrick Williamsddad1a12017-02-23 20:36:32 -0600137 cat ${ACLOCALDIR}/libtool.m4 ${ACLOCALDIR}/lt~obsolete.m4 ${ACLOCALDIR}/ltoptions.m4 \
138 ${ACLOCALDIR}/ltsugar.m4 ${ACLOCALDIR}/ltversion.m4 > ${S}/build/libtool.m4
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500139}
140
141do_install_prepend_class-target() {
142 if ${@bb.utils.contains('PACKAGECONFIG', 'apache2', 'true', 'false', d)}; then
143 # Install dummy config file so apxs doesn't fail
144 install -d ${D}${sysconfdir}/apache2
145 printf "\nLoadModule dummy_module modules/mod_dummy.so\n" > ${D}${sysconfdir}/apache2/httpd.conf
146 fi
147}
148
149# fixme
150do_install_append_class-target() {
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500151 install -d ${D}${sysconfdir}/
152 if [ -d ${RECIPE_SYSROOT_NATIVE}${sysconfdir} ];then
153 install -m 0644 ${RECIPE_SYSROOT_NATIVE}${sysconfdir}/pear.conf ${D}${sysconfdir}/
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500154 fi
155 rm -rf ${D}/${TMPDIR}
156 rm -rf ${D}/.registry
157 rm -rf ${D}/.channels
158 rm -rf ${D}/.[a-z]*
159 rm -rf ${D}/var
160 rm -f ${D}/${sysconfdir}/php-fpm.conf.default
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500161 sed -i 's:${STAGING_DIR_NATIVE}::g' ${D}${sysconfdir}/pear.conf
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500162 install -m 0644 ${WORKDIR}/php-fpm.conf ${D}/${sysconfdir}/php-fpm.conf
163 install -d ${D}/${sysconfdir}/apache2/conf.d
164 install -m 0644 ${WORKDIR}/php-fpm-apache.conf ${D}/${sysconfdir}/apache2/conf.d/php-fpm.conf
165 install -d ${D}${sysconfdir}/init.d
166 sed -i 's:=/usr/sbin:=${sbindir}:g' ${B}/sapi/fpm/init.d.php-fpm
167 sed -i 's:=/etc:=${sysconfdir}:g' ${B}/sapi/fpm/init.d.php-fpm
168 sed -i 's:=/var:=${localstatedir}:g' ${B}/sapi/fpm/init.d.php-fpm
169 install -m 0755 ${B}/sapi/fpm/init.d.php-fpm ${D}${sysconfdir}/init.d/php-fpm
170 install -m 0644 ${WORKDIR}/php-fpm-apache.conf ${D}/${sysconfdir}/apache2/conf.d/php-fpm.conf
171
172 if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)};then
173 install -d ${D}${systemd_unitdir}/system
174 install -m 0644 ${WORKDIR}/php-fpm.service ${D}${systemd_unitdir}/system/
175 sed -i -e 's,@SYSCONFDIR@,${sysconfdir},g' \
176 -e 's,@LOCALSTATEDIR@,${localstatedir},g' \
177 ${D}${systemd_unitdir}/system/php-fpm.service
178 fi
179
180 TMP=`dirname ${D}/${TMPDIR}`
181 while test ${TMP} != ${D}; do
182 if [ -d ${TMP} ]; then
183 rmdir ${TMP}
184 fi
185 TMP=`dirname ${TMP}`;
186 done
187
188 if ${@bb.utils.contains('PACKAGECONFIG', 'apache2', 'true', 'false', d)}; then
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500189 install -d ${D}${sysconfdir}/apache2/modules.d
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500190 install -d ${D}${sysconfdir}/php/apache2-php${PHP_MAJOR_VERSION}
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500191 install -m 644 ${WORKDIR}/70_mod_php${PHP_MAJOR_VERSION}.conf ${D}${sysconfdir}/apache2/modules.d
Brad Bishopa891d152019-09-13 06:17:45 -0400192 sed -i s,lib/,${libexecdir}/, ${D}${sysconfdir}/apache2/modules.d/70_mod_php${PHP_MAJOR_VERSION}.conf
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500193 cat ${S}/php.ini-production | \
194 sed -e 's,extension_dir = \"\./\",extension_dir = \"/usr/lib/extensions\",' \
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500195 > ${D}${sysconfdir}/php/apache2-php${PHP_MAJOR_VERSION}/php.ini
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500196 rm -f ${D}${sysconfdir}/apache2/httpd.conf*
197 fi
198}
199
200SYSROOT_PREPROCESS_FUNCS += "php_sysroot_preprocess"
201
202php_sysroot_preprocess () {
203 install -d ${SYSROOT_DESTDIR}${bindir_crossscripts}/
204 install -m 755 ${D}${bindir}/phpize ${SYSROOT_DESTDIR}${bindir_crossscripts}/
205 install -m 755 ${D}${bindir}/php-config ${SYSROOT_DESTDIR}${bindir_crossscripts}/
206
207 sed -i 's!eval echo /!eval echo ${STAGING_DIR_HOST}/!' ${SYSROOT_DESTDIR}${bindir_crossscripts}/phpize
208 sed -i 's!^include_dir=.*!include_dir=${STAGING_INCDIR}/php!' ${SYSROOT_DESTDIR}${bindir_crossscripts}/php-config
209}
210
211MODPHP_PACKAGE = "${@bb.utils.contains('PACKAGECONFIG', 'apache2', '${PN}-modphp', '', d)}"
212
Brad Bishop316dfdd2018-06-25 12:45:53 -0400213PACKAGES = "${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}"
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500214
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500215RDEPENDS_${PN} += "libgcc"
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500216RDEPENDS_${PN}-pear = "${PN}"
217RDEPENDS_${PN}-phar = "${PN}-cli"
218RDEPENDS_${PN}-cli = "${PN}"
219RDEPENDS_${PN}-modphp = "${PN} apache2"
Brad Bishop316dfdd2018-06-25 12:45:53 -0400220RDEPENDS_${PN}-opcache = "${PN}"
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500221
222INITSCRIPT_PACKAGES = "${PN}-fpm"
223inherit update-rc.d
224
225FILES_${PN}-dbg =+ "${bindir}/.debug \
Brad Bishopc1d34332019-09-09 14:56:00 -0400226 ${libexecdir}/apache2/modules/.debug"
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500227FILES_${PN}-doc += "${PHP_LIBDIR}/php/doc"
228FILES_${PN}-cli = "${bindir}/php"
229FILES_${PN}-phar = "${bindir}/phar*"
230FILES_${PN}-cgi = "${bindir}/php-cgi"
Brad Bishopa891d152019-09-13 06:17:45 -0400231FILES_${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"
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500232FILES_${PN}-fpm-apache2 = "${sysconfdir}/apache2/conf.d/php-fpm.conf"
233CONFFILES_${PN}-fpm = "${sysconfdir}/php-fpm.conf"
234CONFFILES_${PN}-fpm-apache2 = "${sysconfdir}/apache2/conf.d/php-fpm.conf"
235INITSCRIPT_NAME_${PN}-fpm = "php-fpm"
236INITSCRIPT_PARAMS_${PN}-fpm = "defaults 60"
237FILES_${PN}-pear = "${bindir}/pear* ${bindir}/pecl ${PHP_LIBDIR}/php/PEAR \
238 ${PHP_LIBDIR}/php/PEAR*.php ${PHP_LIBDIR}/php/System.php \
239 ${PHP_LIBDIR}/php/peclcmd.php ${PHP_LIBDIR}/php/pearcmd.php \
240 ${PHP_LIBDIR}/php/.channels ${PHP_LIBDIR}/php/.channels/.alias \
241 ${PHP_LIBDIR}/php/.registry ${PHP_LIBDIR}/php/Archive/Tar.php \
242 ${PHP_LIBDIR}/php/Console/Getopt.php ${PHP_LIBDIR}/php/OS/Guess.php \
243 ${PHP_LIBDIR}/php/data/PEAR \
244 ${sysconfdir}/pear.conf"
245FILES_${PN}-dev = "${includedir}/php ${PHP_LIBDIR}/build ${bindir}/phpize \
246 ${bindir}/php-config ${PHP_LIBDIR}/php/.depdb \
247 ${PHP_LIBDIR}/php/.depdblock ${PHP_LIBDIR}/php/.filemap \
248 ${PHP_LIBDIR}/php/.lock ${PHP_LIBDIR}/php/test"
Brad Bishop316dfdd2018-06-25 12:45:53 -0400249FILES_${PN}-staticdev += "${PHP_LIBDIR}/extensions/*/*.a"
250FILES_${PN}-opcache = "${PHP_LIBDIR}/extensions/*/opcache${SOLIBSDEV}"
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500251FILES_${PN} = "${PHP_LIBDIR}/php"
Brad Bishopc1d34332019-09-09 14:56:00 -0400252FILES_${PN} += "${bindir} ${libexecdir}/apache2"
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500253
254SUMMARY_${PN}-modphp = "PHP module for the Apache HTTP server"
255FILES_${PN}-modphp = "${libdir}/apache2 ${sysconfdir}"
256
257MODPHP_OLDPACKAGE = "${@bb.utils.contains('PACKAGECONFIG', 'apache2', 'modphp', '', d)}"
258RPROVIDES_${PN}-modphp = "${MODPHP_OLDPACKAGE}"
259RREPLACES_${PN}-modphp = "${MODPHP_OLDPACKAGE}"
260RCONFLICTS_${PN}-modphp = "${MODPHP_OLDPACKAGE}"
261
262do_install_append_class-native() {
263 create_wrapper ${D}${bindir}/php \
264 PHP_PEAR_SYSCONF_DIR=${sysconfdir}/
265}
266
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500267
268# Fails to build with thumb-1 (qemuarm)
269# | {standard input}: Assembler messages:
270# | {standard input}:3719: Error: selected processor does not support Thumb mode `smull r0,r2,r9,r3'
271# | {standard input}:3720: Error: unshifted register required -- `sub r2,r2,r0,asr#31'
272# | {standard input}:3796: Error: selected processor does not support Thumb mode `smull r0,r2,r3,r3'
273# | {standard input}:3797: Error: unshifted register required -- `sub r2,r2,r0,asr#31'
274# | make: *** [ext/standard/math.lo] Error 1
275ARM_INSTRUCTION_SET = "arm"