Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 1 | SUMMARY = "A server-side, HTML-embedded scripting language" |
| 2 | HOMEPAGE = "http://www.php.net" |
| 3 | SECTION = "console/network" |
| 4 | |
| 5 | LICENSE = "PHP-3.0" |
Andrew Geissler | fc113ea | 2023-03-31 09:59:46 -0500 | [diff] [blame] | 6 | LIC_FILES_CHKSUM = "file://LICENSE;md5=5ebd5be8e2a89f634486445bd164bef0" |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 7 | |
| 8 | BBCLASSEXTEND = "native" |
| 9 | DEPENDS = "zlib bzip2 libxml2 virtual/libiconv php-native lemon-native" |
| 10 | DEPENDS:append:libc-musl = " libucontext" |
| 11 | DEPENDS:class-native = "zlib-native libxml2-native" |
| 12 | |
| 13 | PHP_MAJOR_VERSION = "${@d.getVar('PV').split('.')[0]}" |
| 14 | |
| 15 | SRC_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 \ |
Patrick Williams | 8e7b46e | 2023-05-01 14:19:06 -0500 | [diff] [blame] | 22 | file://0001-Change-whether-to-inline-XXH3_hashLong_withSecret-to.patch \ |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 23 | " |
| 24 | |
| 25 | SRC_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 | |
| 36 | S = "${WORKDIR}/php-${PV}" |
Andrew Geissler | 3eeda90 | 2023-05-19 10:14:02 -0500 | [diff] [blame] | 37 | SRC_URI[sha256sum] = "44a70c52f537662c10d91eedbf51fd765c9961be6ba2508ed63bf7a26cdd3100" |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 38 | |
| 39 | CVE_CHECK_IGNORE += "\ |
| 40 | CVE-2007-2728 \ |
| 41 | CVE-2007-3205 \ |
| 42 | CVE-2007-4596 \ |
| 43 | " |
| 44 | |
| 45 | inherit autotools pkgconfig python3native gettext |
| 46 | |
| 47 | # phpize is not scanned for absolute paths by default (but php-config is). |
| 48 | # |
| 49 | SSTATE_SCAN_FILES += "phpize" |
| 50 | SSTATE_SCAN_FILES += "build-defs.h" |
| 51 | |
| 52 | PHP_LIBDIR = "${libdir}/php${PHP_MAJOR_VERSION}" |
| 53 | |
| 54 | # Common EXTRA_OECONF |
| 55 | COMMON_EXTRA_OECONF = "--enable-sockets \ |
| 56 | --enable-pcntl \ |
| 57 | --enable-shared \ |
| 58 | --disable-rpath \ |
| 59 | --with-pic \ |
| 60 | --libdir=${PHP_LIBDIR} \ |
| 61 | " |
| 62 | EXTRA_OECONF = "--enable-mbstring \ |
| 63 | --enable-fpm \ |
| 64 | --with-libdir=${baselib} \ |
| 65 | --with-gettext=${STAGING_LIBDIR}/.. \ |
| 66 | --with-zlib=${STAGING_LIBDIR}/.. \ |
| 67 | --with-iconv=${STAGING_LIBDIR}/.. \ |
| 68 | --with-bz2=${STAGING_DIR_TARGET}${exec_prefix} \ |
| 69 | --with-config-file-path=${sysconfdir}/php/apache2-php${PHP_MAJOR_VERSION} \ |
| 70 | ${@oe.utils.conditional('SITEINFO_ENDIANNESS', 'le', 'ac_cv_c_bigendian_php=no', 'ac_cv_c_bigendian_php=yes', d)} \ |
| 71 | ${@bb.utils.contains('PACKAGECONFIG', 'pam', '', 'ac_cv_lib_pam_pam_start=no', d)} \ |
| 72 | ${COMMON_EXTRA_OECONF} \ |
| 73 | " |
| 74 | |
| 75 | EXTRA_OECONF:append:riscv64 = " --with-pcre-jit=no" |
| 76 | EXTRA_OECONF:append:riscv32 = " --with-pcre-jit=no" |
| 77 | # Needs fibers assembly implemented for rv32 |
| 78 | # for example rv64 implementation is below |
| 79 | # see https://github.com/php/php-src/commit/70b02d75f2abe3a292d49c4a4e9e4f850c2fee68 |
| 80 | EXTRA_OECONF:append:riscv32:libc-musl = " --disable-fiber-asm" |
| 81 | |
| 82 | CACHED_CONFIGUREVARS += "ac_cv_func_dlopen=no ac_cv_lib_dl_dlopen=yes" |
| 83 | |
| 84 | EXTRA_OECONF:class-native = " \ |
| 85 | --with-zlib=${STAGING_LIBDIR_NATIVE}/.. \ |
| 86 | --without-iconv \ |
| 87 | ${COMMON_EXTRA_OECONF} \ |
| 88 | " |
| 89 | |
| 90 | PACKAGECONFIG ??= "mysql sqlite3 imap opcache openssl \ |
| 91 | ${@bb.utils.filter('DISTRO_FEATURES', 'ipv6 pam', d)} \ |
| 92 | " |
| 93 | PACKAGECONFIG:class-native = "" |
| 94 | |
| 95 | PACKAGECONFIG[zip] = "--with-zip --with-zlib-dir=${STAGING_EXECPREFIXDIR},,libzip" |
| 96 | |
| 97 | PACKAGECONFIG[mysql] = "--with-mysqli=mysqlnd \ |
| 98 | --with-pdo-mysql=mysqlnd \ |
| 99 | ,--without-mysqli --without-pdo-mysql \ |
| 100 | ,mysql5" |
| 101 | |
| 102 | PACKAGECONFIG[sqlite3] = "--with-sqlite3=${STAGING_LIBDIR}/.. \ |
| 103 | --with-pdo-sqlite=${STAGING_LIBDIR}/.. \ |
| 104 | ,--without-sqlite3 --without-pdo-sqlite \ |
| 105 | ,sqlite3" |
| 106 | PACKAGECONFIG[pgsql] = "--with-pgsql=${STAGING_DIR_TARGET}${exec_prefix},--without-pgsql,postgresql" |
| 107 | PACKAGECONFIG[soap] = "--enable-soap, --disable-soap, libxml2" |
| 108 | PACKAGECONFIG[apache2] = "--with-apxs2=${STAGING_BINDIR_CROSS}/apxs,,apache2-native apache2" |
| 109 | PACKAGECONFIG[pam] = ",,libpam" |
| 110 | PACKAGECONFIG[imap] = "--with-imap=${STAGING_DIR_HOST} \ |
| 111 | --with-imap-ssl=${STAGING_DIR_HOST} \ |
| 112 | ,--without-imap --without-imap-ssl \ |
| 113 | ,uw-imap" |
| 114 | PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6," |
| 115 | PACKAGECONFIG[opcache] = "--enable-opcache,--disable-opcache" |
| 116 | PACKAGECONFIG[openssl] = "--with-openssl,--without-openssl,openssl" |
| 117 | PACKAGECONFIG[valgrind] = "--with-valgrind=${STAGING_DIR_TARGET}/usr,--with-valgrind=no,valgrind" |
| 118 | PACKAGECONFIG[mbregex] = "--enable-mbregex, --disable-mbregex, oniguruma" |
| 119 | PACKAGECONFIG[mbstring] = "--enable-mbstring,," |
| 120 | |
| 121 | export HOSTCC = "${BUILD_CC}" |
| 122 | export PHP_NATIVE_DIR = "${STAGING_BINDIR_NATIVE}" |
| 123 | export PHP_PEAR_PHP_BIN = "${STAGING_BINDIR_NATIVE}/php" |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 124 | CFLAGS += " -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -g -DPTYS_ARE_GETPT -DPTYS_ARE_SEARCHED -I${STAGING_INCDIR}/apache2" |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 125 | |
| 126 | # Adding these flags enables dynamic library support, which is disabled by |
| 127 | # default when cross compiling |
| 128 | # See https://bugs.php.net/bug.php?id=60109 |
| 129 | CFLAGS += " -DHAVE_LIBDL " |
| 130 | LDFLAGS += " -ldl " |
| 131 | LDFLAGS:append:libc-musl = " -lucontext " |
Patrick Williams | e760df8 | 2023-05-26 11:10:49 -0500 | [diff] [blame] | 132 | LDFLAGS:append:riscv64 = " -latomic" |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 133 | |
| 134 | EXTRA_OEMAKE = "INSTALL_ROOT=${D}" |
| 135 | |
| 136 | acpaths = "" |
| 137 | |
| 138 | do_configure:prepend () { |
| 139 | rm -f ${S}/build/libtool.m4 ${S}/ltmain.sh ${S}/aclocal.m4 |
| 140 | find ${S} -name config.m4 | xargs -n1 sed -i 's!APXS_HTTPD=.*!APXS_HTTPD=${STAGING_SBINDIR_NATIVE}/httpd!' |
| 141 | } |
| 142 | |
| 143 | do_configure:append() { |
| 144 | # No, libtool, we really don't want rpath set... |
| 145 | sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool |
| 146 | sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool |
Andrew Geissler | 3eeda90 | 2023-05-19 10:14:02 -0500 | [diff] [blame] | 147 | sed -i -e's@${RECIPE_SYSROOT}@@g' \ |
| 148 | -e's@-ffile-prefix-map=[^ ]*[ ]*@@g' \ |
| 149 | -e's@-fdebug-prefix-map=[^ ]*[ ]*@@g' \ |
| 150 | -e's@-ffile-prefix-map=[^ ]*[ ]*@@g' \ |
| 151 | -e's@-fmacro-prefix-map=[^ ]*[ ]*@@g' \ |
| 152 | ${B}/main/build-defs.h \ |
| 153 | ${B}/scripts/php-config |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 154 | } |
| 155 | |
| 156 | do_install:append:class-native() { |
| 157 | rm -rf ${D}/${PHP_LIBDIR}/php/.registry |
| 158 | rm -rf ${D}/${PHP_LIBDIR}/php/.channels |
| 159 | rm -rf ${D}/${PHP_LIBDIR}/php/.[a-z]* |
| 160 | } |
| 161 | |
| 162 | do_install:prepend() { |
| 163 | cat ${ACLOCALDIR}/libtool.m4 ${ACLOCALDIR}/lt~obsolete.m4 ${ACLOCALDIR}/ltoptions.m4 \ |
| 164 | ${ACLOCALDIR}/ltsugar.m4 ${ACLOCALDIR}/ltversion.m4 > ${S}/build/libtool.m4 |
| 165 | } |
| 166 | |
| 167 | do_install:prepend:class-target() { |
| 168 | if ${@bb.utils.contains('PACKAGECONFIG', 'apache2', 'true', 'false', d)}; then |
| 169 | # Install dummy config file so apxs doesn't fail |
| 170 | install -d ${D}${sysconfdir}/apache2 |
| 171 | printf "\nLoadModule dummy_module modules/mod_dummy.so\n" > ${D}${sysconfdir}/apache2/httpd.conf |
| 172 | fi |
| 173 | } |
| 174 | |
| 175 | # fixme |
| 176 | do_install:append:class-target() { |
| 177 | install -d ${D}${sysconfdir}/ |
| 178 | rm -rf ${D}/.registry |
| 179 | rm -rf ${D}/.channels |
| 180 | rm -rf ${D}/.[a-z]* |
| 181 | rm -rf ${D}/var |
| 182 | rm -f ${D}/${sysconfdir}/php-fpm.conf.default |
| 183 | install -m 0644 ${WORKDIR}/php-fpm.conf ${D}/${sysconfdir}/php-fpm.conf |
| 184 | install -d ${D}/${sysconfdir}/apache2/conf.d |
| 185 | install -m 0644 ${WORKDIR}/php-fpm-apache.conf ${D}/${sysconfdir}/apache2/conf.d/php-fpm.conf |
| 186 | install -d ${D}${sysconfdir}/init.d |
| 187 | sed -i 's:=/usr/sbin:=${sbindir}:g' ${B}/sapi/fpm/init.d.php-fpm |
| 188 | sed -i 's:=/etc:=${sysconfdir}:g' ${B}/sapi/fpm/init.d.php-fpm |
| 189 | sed -i 's:=/var:=${localstatedir}:g' ${B}/sapi/fpm/init.d.php-fpm |
| 190 | install -m 0755 ${B}/sapi/fpm/init.d.php-fpm ${D}${sysconfdir}/init.d/php-fpm |
| 191 | install -m 0644 ${WORKDIR}/php-fpm-apache.conf ${D}/${sysconfdir}/apache2/conf.d/php-fpm.conf |
| 192 | |
| 193 | if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)};then |
| 194 | install -d ${D}${systemd_unitdir}/system |
| 195 | install -m 0644 ${WORKDIR}/php-fpm.service ${D}${systemd_unitdir}/system/ |
| 196 | sed -i -e 's,@SYSCONFDIR@,${sysconfdir},g' \ |
| 197 | -e 's,@LOCALSTATEDIR@,${localstatedir},g' \ |
| 198 | ${D}${systemd_unitdir}/system/php-fpm.service |
| 199 | fi |
| 200 | |
| 201 | if ${@bb.utils.contains('PACKAGECONFIG', 'apache2', 'true', 'false', d)}; then |
| 202 | install -d ${D}${sysconfdir}/apache2/modules.d |
| 203 | install -d ${D}${sysconfdir}/php/apache2-php${PHP_MAJOR_VERSION} |
| 204 | install -m 644 ${WORKDIR}/70_mod_php${PHP_MAJOR_VERSION}.conf ${D}${sysconfdir}/apache2/modules.d |
| 205 | sed -i s,lib/,${libexecdir}/, ${D}${sysconfdir}/apache2/modules.d/70_mod_php${PHP_MAJOR_VERSION}.conf |
| 206 | cat ${S}/php.ini-production | \ |
| 207 | sed -e 's,extension_dir = \"\./\",extension_dir = \"/usr/lib/extensions\",' \ |
| 208 | > ${D}${sysconfdir}/php/apache2-php${PHP_MAJOR_VERSION}/php.ini |
| 209 | rm -f ${D}${sysconfdir}/apache2/httpd.conf* |
| 210 | fi |
| 211 | } |
| 212 | |
| 213 | SYSROOT_PREPROCESS_FUNCS += "php_sysroot_preprocess" |
| 214 | |
| 215 | php_sysroot_preprocess () { |
| 216 | install -d ${SYSROOT_DESTDIR}${bindir_crossscripts}/ |
| 217 | install -m 755 ${D}${bindir}/phpize ${SYSROOT_DESTDIR}${bindir_crossscripts}/ |
| 218 | install -m 755 ${D}${bindir}/php-config ${SYSROOT_DESTDIR}${bindir_crossscripts}/ |
| 219 | |
| 220 | sed -i 's!eval echo /!eval echo ${STAGING_DIR_HOST}/!' ${SYSROOT_DESTDIR}${bindir_crossscripts}/phpize |
| 221 | sed -i 's!^include_dir=.*!include_dir=${STAGING_INCDIR}/php!' ${SYSROOT_DESTDIR}${bindir_crossscripts}/php-config |
| 222 | } |
| 223 | |
| 224 | MODPHP_PACKAGE = "${@bb.utils.contains('PACKAGECONFIG', 'apache2', '${PN}-modphp', '', d)}" |
| 225 | |
| 226 | PACKAGES = "${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}" |
| 227 | |
| 228 | RDEPENDS:${PN} += "libgcc" |
| 229 | RDEPENDS:${PN}-pear = "${PN}" |
| 230 | RDEPENDS:${PN}-phar = "${PN}-cli" |
| 231 | RDEPENDS:${PN}-cli = "${PN}" |
| 232 | RDEPENDS:${PN}-modphp = "${PN} apache2" |
| 233 | RDEPENDS:${PN}-opcache = "${PN}" |
| 234 | |
| 235 | ALLOW_EMPTY:${PN} = "1" |
| 236 | |
| 237 | INITSCRIPT_PACKAGES = "${PN}-fpm" |
| 238 | inherit update-rc.d |
| 239 | |
| 240 | # 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] |
| 241 | #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] |
| 242 | INSANE_SKIP:${PN}:append:x86 = " textrel" |
| 243 | INSANE_SKIP:${PN}-opcache:append:x86 = " textrel" |
| 244 | |
| 245 | FILES:${PN}-dbg =+ "${bindir}/.debug \ |
| 246 | ${libexecdir}/apache2/modules/.debug" |
| 247 | FILES:${PN}-doc += "${PHP_LIBDIR}/php/doc" |
| 248 | FILES:${PN}-cli = "${bindir}/php" |
| 249 | FILES:${PN}-phpdbg = "${bindir}/phpdbg" |
| 250 | FILES:${PN}-phar = "${bindir}/phar*" |
| 251 | FILES:${PN}-cgi = "${bindir}/php-cgi" |
| 252 | FILES:${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" |
| 253 | FILES:${PN}-fpm-apache2 = "${sysconfdir}/apache2/conf.d/php-fpm.conf" |
| 254 | CONFFILES:${PN}-fpm = "${sysconfdir}/php-fpm.conf" |
| 255 | CONFFILES:${PN}-fpm-apache2 = "${sysconfdir}/apache2/conf.d/php-fpm.conf" |
| 256 | INITSCRIPT_NAME:${PN}-fpm = "php-fpm" |
| 257 | INITSCRIPT_PARAMS:${PN}-fpm = "defaults 60" |
| 258 | FILES:${PN}-pear = "${bindir}/pear* ${bindir}/pecl ${PHP_LIBDIR}/php/PEAR \ |
| 259 | ${PHP_LIBDIR}/php/PEAR*.php ${PHP_LIBDIR}/php/System.php \ |
| 260 | ${PHP_LIBDIR}/php/peclcmd.php ${PHP_LIBDIR}/php/pearcmd.php \ |
| 261 | ${PHP_LIBDIR}/php/.channels ${PHP_LIBDIR}/php/.channels/.alias \ |
| 262 | ${PHP_LIBDIR}/php/.registry ${PHP_LIBDIR}/php/Archive/Tar.php \ |
| 263 | ${PHP_LIBDIR}/php/Console/Getopt.php ${PHP_LIBDIR}/php/OS/Guess.php \ |
| 264 | ${PHP_LIBDIR}/php/data/PEAR \ |
| 265 | ${sysconfdir}/pear.conf" |
| 266 | FILES:${PN}-dev = "${includedir}/php ${PHP_LIBDIR}/build ${bindir}/phpize \ |
| 267 | ${bindir}/php-config ${PHP_LIBDIR}/php/.depdb \ |
| 268 | ${PHP_LIBDIR}/php/.depdblock ${PHP_LIBDIR}/php/.filemap \ |
| 269 | ${PHP_LIBDIR}/php/.lock ${PHP_LIBDIR}/php/test" |
| 270 | FILES:${PN}-staticdev += "${PHP_LIBDIR}/extensions/*/*.a" |
| 271 | FILES:${PN}-opcache = "${PHP_LIBDIR}/extensions/*/opcache${SOLIBSDEV}" |
| 272 | FILES:${PN} = "${PHP_LIBDIR}/php" |
| 273 | FILES:${PN} += "${bindir} ${libexecdir}/apache2" |
| 274 | |
| 275 | SUMMARY:${PN}-modphp = "PHP module for the Apache HTTP server" |
| 276 | FILES:${PN}-modphp = "${libdir}/apache2 ${sysconfdir}" |
| 277 | |
| 278 | MODPHP_OLDPACKAGE = "${@bb.utils.contains('PACKAGECONFIG', 'apache2', 'modphp', '', d)}" |
| 279 | RPROVIDES:${PN}-modphp = "${MODPHP_OLDPACKAGE}" |
| 280 | RREPLACES:${PN}-modphp = "${MODPHP_OLDPACKAGE}" |
| 281 | RCONFLICTS:${PN}-modphp = "${MODPHP_OLDPACKAGE}" |
| 282 | |
| 283 | do_install:append:class-native() { |
| 284 | create_wrapper ${D}${bindir}/php \ |
| 285 | PHP_PEAR_SYSCONF_DIR=${sysconfdir}/ |
| 286 | } |
| 287 | |
| 288 | # Fails to build with thumb-1 (qemuarm) |
| 289 | # | {standard input}: Assembler messages: |
| 290 | # | {standard input}:3719: Error: selected processor does not support Thumb mode `smull r0,r2,r9,r3' |
| 291 | # | {standard input}:3720: Error: unshifted register required -- `sub r2,r2,r0,asr#31' |
| 292 | # | {standard input}:3796: Error: selected processor does not support Thumb mode `smull r0,r2,r3,r3' |
| 293 | # | {standard input}:3797: Error: unshifted register required -- `sub r2,r2,r0,asr#31' |
| 294 | # | make: *** [ext/standard/math.lo] Error 1 |
| 295 | ARM_INSTRUCTION_SET = "arm" |