1SUMMARY = "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=fd469cce1a919f0cc95bab7afb28d19d" 7 8BBCLASSEXTEND = "native" 9DEPENDS = "zlib bzip2 libxml2 virtual/libiconv php-native" 10DEPENDS:append:libc-musl = " libucontext" 11DEPENDS:class-native = "zlib-native libxml2-native" 12 13PHP_MAJOR_VERSION = "${@d.getVar('PV').split('.')[0]}" 14 15SRC_URI = "http://php.net/distributions/php-${PV}.tar.bz2 \ 16 file://0002-build-php.m4-don-t-unset-cache-variables.patch \ 17 file://0003-php-remove-host-specific-info-from-header-file.patch \ 18 file://0004-configure.ac-don-t-include-build-libtool.m4.patch \ 19 file://0006-ext-phar-Makefile.frag-Fix-phar-packaging.patch \ 20 file://0009-php-don-t-use-broken-wrapper-for-mkdir.patch \ 21 file://0010-iconv-fix-detection.patch \ 22 file://0001-Change-whether-to-inline-XXH3_hashLong_withSecret-to.patch \ 23 " 24 25SRC_URI:append:class-target = " \ 26 file://0001-ext-opcache-config.m4-enable-opcache.patch \ 27 file://0005-pear-fix-Makefile.frag-for-Yocto.patch \ 28 file://0007-sapi-cli-config.m4-fix-build-directory.patch \ 29 file://0008-ext-imap-config.m4-fix-include-paths.patch \ 30 file://php-fpm.conf \ 31 file://php-fpm-apache.conf \ 32 file://70_mod_php${PHP_MAJOR_VERSION}.conf \ 33 file://php-fpm.service \ 34 " 35 36S = "${WORKDIR}/php-${PV}" 37SRC_URI[sha256sum] = "2658c1b8935ab6b53a7f209354602761ab07066e66920bc472b8815fd1b43f71" 38 39CVE_STATUS_GROUPS += "CVE_STATUS_PHP" 40CVE_STATUS_PHP[status] = "fixed-version: The name of this product is exactly the same as github.com/emlog/emlog. CVE can be safely ignored." 41CVE_STATUS_PHP = " \ 42 CVE-2007-2728 \ 43 CVE-2007-3205 \ 44 CVE-2007-4596 \ 45" 46 47inherit autotools pkgconfig python3native gettext multilib_header multilib_script systemd 48 49# phpize is not scanned for absolute paths by default (but php-config is). 50# 51SSTATE_SCAN_FILES += "phpize" 52SSTATE_SCAN_FILES += "build-defs.h" 53 54PHP_LIBDIR = "${libdir}/php${PHP_MAJOR_VERSION}" 55 56# Common EXTRA_OECONF 57COMMON_EXTRA_OECONF = "--enable-sockets \ 58 --enable-pcntl \ 59 --enable-shared \ 60 --disable-rpath \ 61 --with-pic \ 62 --libdir=${PHP_LIBDIR} \ 63" 64EXTRA_OECONF = "--enable-mbstring \ 65 --enable-fpm \ 66 --with-libdir=${baselib} \ 67 --with-gettext=${STAGING_LIBDIR}/.. \ 68 --with-zlib=${STAGING_LIBDIR}/.. \ 69 --with-iconv=${STAGING_LIBDIR}/.. \ 70 --with-bz2=${STAGING_DIR_TARGET}${exec_prefix} \ 71 --with-config-file-path=${sysconfdir}/php/apache2-php${PHP_MAJOR_VERSION} \ 72 ${@oe.utils.conditional('SITEINFO_ENDIANNESS', 'le', 'ac_cv_c_bigendian_php=no', 'ac_cv_c_bigendian_php=yes', d)} \ 73 ${@bb.utils.contains('PACKAGECONFIG', 'pam', '', 'ac_cv_lib_pam_pam_start=no', d)} \ 74 ${COMMON_EXTRA_OECONF} \ 75" 76 77EXTRA_OECONF:append:riscv64 = " --with-pcre-jit=no" 78EXTRA_OECONF:append:riscv32 = " --with-pcre-jit=no" 79# Needs fibers assembly implemented for rv32 80# for example rv64 implementation is below 81# see https://github.com/php/php-src/commit/70b02d75f2abe3a292d49c4a4e9e4f850c2fee68 82EXTRA_OECONF:append:riscv32:libc-musl = " --disable-fiber-asm" 83 84CACHED_CONFIGUREVARS += "ac_cv_func_dlopen=no ac_cv_lib_dl_dlopen=yes" 85 86EXTRA_OECONF:class-native = " \ 87 --with-zlib=${STAGING_LIBDIR_NATIVE}/.. \ 88 --without-iconv \ 89 ${COMMON_EXTRA_OECONF} \ 90" 91 92PACKAGECONFIG ??= "mysql sqlite3 imap opcache openssl \ 93 ${@bb.utils.filter('DISTRO_FEATURES', 'ipv6 pam', d)} \ 94" 95PACKAGECONFIG:class-native = "" 96 97PACKAGECONFIG[zip] = "--with-zip --with-zlib-dir=${STAGING_EXECPREFIXDIR},,libzip" 98 99PACKAGECONFIG[mysql] = "--with-mysqli=mysqlnd \ 100 --with-pdo-mysql=mysqlnd \ 101 ,--without-mysqli --without-pdo-mysql \ 102 ,mysql5" 103 104PACKAGECONFIG[sqlite3] = "--with-sqlite3=${STAGING_LIBDIR}/.. \ 105 --with-pdo-sqlite=${STAGING_LIBDIR}/.. \ 106 ,--without-sqlite3 --without-pdo-sqlite \ 107 ,sqlite3" 108PACKAGECONFIG[pgsql] = "--with-pgsql=${STAGING_DIR_TARGET}${exec_prefix},--without-pgsql,postgresql" 109PACKAGECONFIG[soap] = "--enable-soap, --disable-soap, libxml2" 110PACKAGECONFIG[apache2] = "--with-apxs2=${STAGING_BINDIR_CROSS}/apxs,,apache2-native apache2" 111PACKAGECONFIG[pam] = ",,libpam" 112PACKAGECONFIG[imap] = "--with-imap=${STAGING_DIR_HOST} \ 113 --with-imap-ssl=${STAGING_DIR_HOST} \ 114 ,--without-imap --without-imap-ssl \ 115 ,uw-imap" 116PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6," 117PACKAGECONFIG[opcache] = "--enable-opcache,--disable-opcache" 118PACKAGECONFIG[openssl] = "--with-openssl,--without-openssl,openssl" 119PACKAGECONFIG[valgrind] = "--with-valgrind=${STAGING_DIR_TARGET}/usr,--with-valgrind=no,valgrind" 120PACKAGECONFIG[mbregex] = "--enable-mbregex, --disable-mbregex, oniguruma" 121PACKAGECONFIG[mbstring] = "--enable-mbstring,," 122 123export HOSTCC = "${BUILD_CC}" 124export PHP_NATIVE_DIR = "${STAGING_BINDIR_NATIVE}" 125export PHP_PEAR_PHP_BIN = "${STAGING_BINDIR_NATIVE}/php" 126CFLAGS += " -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -g -DPTYS_ARE_GETPT -DPTYS_ARE_SEARCHED -I${STAGING_INCDIR}/apache2" 127 128# Adding these flags enables dynamic library support, which is disabled by 129# default when cross compiling 130# See https://bugs.php.net/bug.php?id=60109 131CFLAGS += " -DHAVE_LIBDL " 132LDFLAGS += " -ldl " 133LDFLAGS:append:libc-musl = " -lucontext " 134LDFLAGS:append:riscv64 = " -latomic" 135 136EXTRA_OEMAKE = "INSTALL_ROOT=${D}" 137 138acpaths = "" 139 140do_configure:prepend () { 141 rm -f ${S}/build/libtool.m4 ${S}/ltmain.sh ${S}/aclocal.m4 142 find ${S} -name config.m4 | xargs -n1 sed -i 's!APXS_HTTPD=.*!APXS_HTTPD=${STAGING_SBINDIR_NATIVE}/httpd!' 143} 144 145do_configure:append() { 146 # No, libtool, we really don't want rpath set... 147 sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool 148 sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool 149 sed -i -e's@${RECIPE_SYSROOT}@@g' \ 150 -e's@-ffile-prefix-map=[^ ]*[ ]*@@g' \ 151 -e's@-fdebug-prefix-map=[^ ]*[ ]*@@g' \ 152 -e's@-ffile-prefix-map=[^ ]*[ ]*@@g' \ 153 -e's@-fmacro-prefix-map=[^ ]*[ ]*@@g' \ 154 ${B}/main/build-defs.h \ 155 ${B}/scripts/php-config 156} 157 158do_install:append:class-native() { 159 rm -rf ${D}/${PHP_LIBDIR}/php/.registry 160 rm -rf ${D}/${PHP_LIBDIR}/php/.channels 161 rm -rf ${D}/${PHP_LIBDIR}/php/.[a-z]* 162} 163 164do_install:prepend() { 165 cat ${ACLOCALDIR}/libtool.m4 ${ACLOCALDIR}/lt~obsolete.m4 ${ACLOCALDIR}/ltoptions.m4 \ 166 ${ACLOCALDIR}/ltsugar.m4 ${ACLOCALDIR}/ltversion.m4 > ${S}/build/libtool.m4 167} 168 169do_install:prepend:class-target() { 170 if ${@bb.utils.contains('PACKAGECONFIG', 'apache2', 'true', 'false', d)}; then 171 # Install dummy config file so apxs doesn't fail 172 install -d ${D}${sysconfdir}/apache2 173 printf "\nLoadModule dummy_module modules/mod_dummy.so\n" > ${D}${sysconfdir}/apache2/httpd.conf 174 fi 175} 176 177# fixme 178do_install:append:class-target() { 179 install -d ${D}${sysconfdir}/ 180 rm -rf ${D}/.registry 181 rm -rf ${D}/.channels 182 rm -rf ${D}/.[a-z]* 183 rm -rf ${D}/var 184 rm -f ${D}/${sysconfdir}/php-fpm.conf.default 185 install -m 0644 ${WORKDIR}/php-fpm.conf ${D}/${sysconfdir}/php-fpm.conf 186 install -d ${D}/${sysconfdir}/apache2/conf.d 187 install -m 0644 ${WORKDIR}/php-fpm-apache.conf ${D}/${sysconfdir}/apache2/conf.d/php-fpm.conf 188 install -d ${D}${sysconfdir}/init.d 189 sed -i 's:=/usr/sbin:=${sbindir}:g' ${B}/sapi/fpm/init.d.php-fpm 190 sed -i 's:=/etc:=${sysconfdir}:g' ${B}/sapi/fpm/init.d.php-fpm 191 sed -i 's:=/var:=${localstatedir}:g' ${B}/sapi/fpm/init.d.php-fpm 192 install -m 0755 ${B}/sapi/fpm/init.d.php-fpm ${D}${sysconfdir}/init.d/php-fpm 193 install -m 0644 ${WORKDIR}/php-fpm-apache.conf ${D}/${sysconfdir}/apache2/conf.d/php-fpm.conf 194 195 if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)};then 196 install -d ${D}${systemd_system_unitdir} 197 install -m 0644 ${WORKDIR}/php-fpm.service ${D}${systemd_system_unitdir}/php-fpm.service 198 sed -i -e 's,@LOCALSTATEDIR@,${localstatedir},g' ${D}${systemd_system_unitdir}/php-fpm.service 199 sed -i -e 's,@SBINDIR@,${sbindir},g' ${D}${systemd_system_unitdir}/php-fpm.service 200 sed -i -e 's,@BINDIR@,${bindir},g' ${D}${systemd_system_unitdir}/php-fpm.service 201 fi 202 203 if ${@bb.utils.contains('PACKAGECONFIG', 'apache2', 'true', 'false', d)}; then 204 install -d ${D}${sysconfdir}/apache2/modules.d 205 install -d ${D}${sysconfdir}/php/apache2-php${PHP_MAJOR_VERSION} 206 install -m 644 ${WORKDIR}/70_mod_php${PHP_MAJOR_VERSION}.conf ${D}${sysconfdir}/apache2/modules.d 207 sed -i s,lib/,${libexecdir}/, ${D}${sysconfdir}/apache2/modules.d/70_mod_php${PHP_MAJOR_VERSION}.conf 208 cat ${S}/php.ini-production | \ 209 sed -e 's,extension_dir = \"\./\",extension_dir = \"/usr/lib/extensions\",' \ 210 > ${D}${sysconfdir}/php/apache2-php${PHP_MAJOR_VERSION}/php.ini 211 rm -f ${D}${sysconfdir}/apache2/httpd.conf* 212 fi 213} 214 215MULTILIB_SCRIPTS += "${PN}:${bindir}/php-config \ 216 ${PN}:${bindir}/phpize \ 217" 218 219do_install:append () { 220 oe_multilib_header php/main/build-defs.h php/main/php_config.h 221} 222 223SYSROOT_PREPROCESS_FUNCS += "php_sysroot_preprocess" 224 225php_sysroot_preprocess () { 226 install -d ${SYSROOT_DESTDIR}${bindir_crossscripts}/ 227 install -m 755 ${D}${bindir}/phpize ${SYSROOT_DESTDIR}${bindir_crossscripts}/ 228 install -m 755 ${D}${bindir}/php-config ${SYSROOT_DESTDIR}${bindir_crossscripts}/ 229 230 sed -i 's!eval echo /!eval echo ${STAGING_DIR_HOST}/!' ${SYSROOT_DESTDIR}${bindir_crossscripts}/phpize 231 sed -i 's!^include_dir=.*!include_dir=${STAGING_INCDIR}/php!' ${SYSROOT_DESTDIR}${bindir_crossscripts}/php-config 232} 233 234MODPHP_PACKAGE = "${@bb.utils.contains('PACKAGECONFIG', 'apache2', '${PN}-modphp', '', d)}" 235 236PACKAGES = "${PN}-dbg ${PN}-cli ${PN}-phpdbg ${PN}-cgi ${PN}-fpm ${PN}-fpm-apache2 ${PN}-pear ${PN}-phar ${MODPHP_PACKAGE} ${PN}-dev ${PN}-staticdev ${PN}-doc ${PN}-opcache ${PN}" 237 238RDEPENDS:${PN} += "libgcc" 239RDEPENDS:${PN}-pear = "${PN}" 240RDEPENDS:${PN}-phar = "${PN}-cli" 241RDEPENDS:${PN}-cli = "${PN}" 242RDEPENDS:${PN}-modphp = "${PN} apache2" 243RDEPENDS:${PN}-opcache = "${PN}" 244 245ALLOW_EMPTY:${PN} = "1" 246 247INITSCRIPT_PACKAGES = "${PN}-fpm" 248inherit update-rc.d 249 250# WARNING: lib32-php-8.0.12-r0 do_package_qa: QA Issue: lib32-php: ELF binary /usr/libexec/apache2/modules/libphp.so has relocations in .text [textrel] 251#WARNING: lib32-php-8.0.12-r0 do_package_qa: QA Issue: lib32-php-opcache: ELF binary /usr/lib/php8/extensions/no-debug-zts-20200930/opcache.so has relocations in .text [textrel] 252INSANE_SKIP:${PN}:append:x86 = " textrel" 253INSANE_SKIP:${PN}-opcache:append:x86 = " textrel" 254 255FILES:${PN}-dbg =+ "${bindir}/.debug \ 256 ${libexecdir}/apache2/modules/.debug" 257FILES:${PN}-doc += "${PHP_LIBDIR}/php/doc" 258FILES:${PN}-cli = "${bindir}/php" 259FILES:${PN}-phpdbg = "${bindir}/phpdbg" 260FILES:${PN}-phar = "${bindir}/phar*" 261FILES:${PN}-cgi = "${bindir}/php-cgi" 262FILES:${PN}-fpm = "${sbindir}/php-fpm ${sysconfdir}/php-fpm.conf ${datadir}/fpm ${sysconfdir}/init.d/php-fpm ${sysconfdir}/php-fpm.d/www.conf.default" 263FILES:${PN}-fpm-apache2 = "${sysconfdir}/apache2/conf.d/php-fpm.conf" 264CONFFILES:${PN}-fpm = "${sysconfdir}/php-fpm.conf" 265CONFFILES:${PN}-fpm-apache2 = "${sysconfdir}/apache2/conf.d/php-fpm.conf" 266INITSCRIPT_NAME:${PN}-fpm = "php-fpm" 267INITSCRIPT_PARAMS:${PN}-fpm = "defaults 60" 268FILES:${PN}-pear = "${bindir}/pear* ${bindir}/pecl ${PHP_LIBDIR}/php/PEAR \ 269 ${PHP_LIBDIR}/php/PEAR*.php ${PHP_LIBDIR}/php/System.php \ 270 ${PHP_LIBDIR}/php/peclcmd.php ${PHP_LIBDIR}/php/pearcmd.php \ 271 ${PHP_LIBDIR}/php/.channels ${PHP_LIBDIR}/php/.channels/.alias \ 272 ${PHP_LIBDIR}/php/.registry ${PHP_LIBDIR}/php/Archive/Tar.php \ 273 ${PHP_LIBDIR}/php/Console/Getopt.php ${PHP_LIBDIR}/php/OS/Guess.php \ 274 ${PHP_LIBDIR}/php/data/PEAR \ 275 ${sysconfdir}/pear.conf" 276FILES:${PN}-dev = "${includedir}/php ${PHP_LIBDIR}/build ${bindir}/phpize \ 277 ${bindir}/php-config ${PHP_LIBDIR}/php/.depdb \ 278 ${PHP_LIBDIR}/php/.depdblock ${PHP_LIBDIR}/php/.filemap \ 279 ${PHP_LIBDIR}/php/.lock ${PHP_LIBDIR}/php/test" 280FILES:${PN}-staticdev += "${PHP_LIBDIR}/extensions/*/*.a" 281FILES:${PN}-opcache = "${PHP_LIBDIR}/extensions/*/opcache${SOLIBSDEV}" 282FILES:${PN} = "${PHP_LIBDIR}/php" 283FILES:${PN} += "${bindir} ${libexecdir}/apache2" 284 285SUMMARY:${PN}-modphp = "PHP module for the Apache HTTP server" 286FILES:${PN}-modphp = "${libdir}/apache2 ${sysconfdir}" 287 288MODPHP_OLDPACKAGE = "${@bb.utils.contains('PACKAGECONFIG', 'apache2', 'modphp', '', d)}" 289RPROVIDES:${PN}-modphp = "${MODPHP_OLDPACKAGE}" 290RREPLACES:${PN}-modphp = "${MODPHP_OLDPACKAGE}" 291RCONFLICTS:${PN}-modphp = "${MODPHP_OLDPACKAGE}" 292 293SYSTEMD_SERVICE:${PN}-fpm = "php-fpm.service" 294SYSTEMD_PACKAGES += "${PN}-fpm" 295 296do_install:append:class-native() { 297 create_wrapper ${D}${bindir}/php \ 298 PHP_PEAR_SYSCONF_DIR=${sysconfdir}/ 299} 300