Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -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 | f103a7f | 2021-05-07 16:09:40 -0500 | [diff] [blame] | 6 | LIC_FILES_CHKSUM = "file://LICENSE;md5=99532e0f6620bc9bca34f12fadaee33c" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 7 | |
| 8 | BBCLASSEXTEND = "native" |
| 9 | DEPENDS = "zlib bzip2 libxml2 virtual/libiconv php-native lemon-native" |
| 10 | DEPENDS_class-native = "zlib-native libxml2-native" |
| 11 | |
| 12 | PHP_MAJOR_VERSION = "${@d.getVar('PV').split('.')[0]}" |
| 13 | |
| 14 | SRC_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 | |
| 21 | SRC_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 | " |
Andrew Geissler | d688a01 | 2020-09-18 13:36:00 -0500 | [diff] [blame] | 34 | |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 35 | S = "${WORKDIR}/php-${PV}" |
Andrew Geissler | f103a7f | 2021-05-07 16:09:40 -0500 | [diff] [blame] | 36 | SRC_URI[sha256sum] = "85710f007cfd0fae94e13a02a3a036f4e81ef43693260cae8a2e1ca93659ce3e" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 37 | |
| 38 | inherit autotools pkgconfig python3native gettext |
| 39 | |
| 40 | # phpize is not scanned for absolute paths by default (but php-config is). |
| 41 | # |
| 42 | SSTATE_SCAN_FILES += "phpize" |
| 43 | SSTATE_SCAN_FILES += "build-defs.h" |
| 44 | |
| 45 | PHP_LIBDIR = "${libdir}/php${PHP_MAJOR_VERSION}" |
| 46 | |
| 47 | # Common EXTRA_OECONF |
| 48 | COMMON_EXTRA_OECONF = "--enable-sockets \ |
| 49 | --enable-pcntl \ |
| 50 | --enable-shared \ |
| 51 | --disable-rpath \ |
| 52 | --with-pic \ |
| 53 | --libdir=${PHP_LIBDIR} \ |
| 54 | " |
| 55 | EXTRA_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 | |
| 68 | EXTRA_OECONF_append_riscv64 = " --with-pcre-jit=no" |
| 69 | EXTRA_OECONF_append_riscv32 = " --with-pcre-jit=no" |
| 70 | |
| 71 | CACHED_CONFIGUREVARS += "ac_cv_func_dlopen=no ac_cv_lib_dl_dlopen=yes" |
| 72 | |
| 73 | EXTRA_OECONF_class-native = " \ |
| 74 | --with-zlib=${STAGING_LIBDIR_NATIVE}/.. \ |
| 75 | --without-iconv \ |
| 76 | ${COMMON_EXTRA_OECONF} \ |
| 77 | " |
| 78 | |
| 79 | PACKAGECONFIG ??= "mysql sqlite3 imap opcache openssl \ |
| 80 | ${@bb.utils.filter('DISTRO_FEATURES', 'ipv6 pam', d)} \ |
| 81 | " |
| 82 | PACKAGECONFIG_class-native = "" |
| 83 | |
Andrew Geissler | 7f40b71 | 2020-05-15 14:09:53 -0500 | [diff] [blame] | 84 | PACKAGECONFIG[zip] = "--with-zip --with-zlib-dir=${STAGING_EXECPREFIXDIR},,libzip" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 85 | |
| 86 | PACKAGECONFIG[mysql] = "--with-mysqli=mysqlnd \ |
| 87 | --with-pdo-mysql=mysqlnd \ |
| 88 | ,--without-mysqli --without-pdo-mysql \ |
| 89 | ,mysql5" |
| 90 | |
| 91 | PACKAGECONFIG[sqlite3] = "--with-sqlite3=${STAGING_LIBDIR}/.. \ |
| 92 | --with-pdo-sqlite=${STAGING_LIBDIR}/.. \ |
| 93 | ,--without-sqlite3 --without-pdo-sqlite \ |
| 94 | ,sqlite3" |
| 95 | PACKAGECONFIG[pgsql] = "--with-pgsql=${STAGING_DIR_TARGET}${exec_prefix},--without-pgsql,postgresql" |
Andrew Geissler | 7f40b71 | 2020-05-15 14:09:53 -0500 | [diff] [blame] | 96 | PACKAGECONFIG[soap] = "--enable-soap, --disable-soap, libxml2" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 97 | PACKAGECONFIG[apache2] = "--with-apxs2=${STAGING_BINDIR_CROSS}/apxs,,apache2-native apache2" |
| 98 | PACKAGECONFIG[pam] = ",,libpam" |
| 99 | PACKAGECONFIG[imap] = "--with-imap=${STAGING_DIR_HOST} \ |
| 100 | --with-imap-ssl=${STAGING_DIR_HOST} \ |
| 101 | ,--without-imap --without-imap-ssl \ |
| 102 | ,uw-imap" |
| 103 | PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6," |
| 104 | PACKAGECONFIG[opcache] = "--enable-opcache,--disable-opcache" |
| 105 | PACKAGECONFIG[openssl] = "--with-openssl,--without-openssl,openssl" |
| 106 | PACKAGECONFIG[valgrind] = "--with-valgrind=${STAGING_DIR_TARGET}/usr,--with-valgrind=no,valgrind" |
| 107 | PACKAGECONFIG[mbregex] = "--enable-mbregex, --disable-mbregex, oniguruma" |
Andrew Geissler | 7f40b71 | 2020-05-15 14:09:53 -0500 | [diff] [blame] | 108 | PACKAGECONFIG[mbstring] = "--enable-mbstring,," |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 109 | |
| 110 | export PHP_NATIVE_DIR = "${STAGING_BINDIR_NATIVE}" |
| 111 | export PHP_PEAR_PHP_BIN = "${STAGING_BINDIR_NATIVE}/php" |
| 112 | CFLAGS += " -D_GNU_SOURCE -g -DPTYS_ARE_GETPT -DPTYS_ARE_SEARCHED -I${STAGING_INCDIR}/apache2" |
| 113 | |
Andrew Geissler | 7f40b71 | 2020-05-15 14:09:53 -0500 | [diff] [blame] | 114 | # Adding these flags enables dynamic library support, which is disabled by |
| 115 | # default when cross compiling |
| 116 | # See https://bugs.php.net/bug.php?id=60109 |
| 117 | CFLAGS += " -DHAVE_LIBDL " |
| 118 | LDFLAGS += " -ldl " |
| 119 | |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 120 | EXTRA_OEMAKE = "INSTALL_ROOT=${D}" |
| 121 | |
| 122 | acpaths = "" |
| 123 | |
| 124 | do_configure_prepend () { |
| 125 | rm -f ${S}/build/libtool.m4 ${S}/ltmain.sh ${S}/aclocal.m4 |
| 126 | find ${S} -name config.m4 | xargs -n1 sed -i 's!APXS_HTTPD=.*!APXS_HTTPD=${STAGING_SBINDIR_NATIVE}/httpd!' |
| 127 | } |
| 128 | |
| 129 | do_configure_append() { |
| 130 | # No, libtool, we really don't want rpath set... |
| 131 | sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' ${HOST_SYS}-libtool |
| 132 | sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' ${HOST_SYS}-libtool |
| 133 | } |
| 134 | |
| 135 | do_install_append_class-native() { |
| 136 | rm -rf ${D}/${PHP_LIBDIR}/php/.registry |
| 137 | rm -rf ${D}/${PHP_LIBDIR}/php/.channels |
| 138 | rm -rf ${D}/${PHP_LIBDIR}/php/.[a-z]* |
| 139 | } |
| 140 | |
| 141 | do_install_prepend() { |
| 142 | cat ${ACLOCALDIR}/libtool.m4 ${ACLOCALDIR}/lt~obsolete.m4 ${ACLOCALDIR}/ltoptions.m4 \ |
| 143 | ${ACLOCALDIR}/ltsugar.m4 ${ACLOCALDIR}/ltversion.m4 > ${S}/build/libtool.m4 |
| 144 | } |
| 145 | |
| 146 | do_install_prepend_class-target() { |
| 147 | if ${@bb.utils.contains('PACKAGECONFIG', 'apache2', 'true', 'false', d)}; then |
| 148 | # Install dummy config file so apxs doesn't fail |
| 149 | install -d ${D}${sysconfdir}/apache2 |
| 150 | printf "\nLoadModule dummy_module modules/mod_dummy.so\n" > ${D}${sysconfdir}/apache2/httpd.conf |
| 151 | fi |
| 152 | } |
| 153 | |
| 154 | # fixme |
| 155 | do_install_append_class-target() { |
| 156 | install -d ${D}${sysconfdir}/ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 157 | rm -rf ${D}/.registry |
| 158 | rm -rf ${D}/.channels |
| 159 | rm -rf ${D}/.[a-z]* |
| 160 | rm -rf ${D}/var |
| 161 | rm -f ${D}/${sysconfdir}/php-fpm.conf.default |
| 162 | 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 | |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 180 | if ${@bb.utils.contains('PACKAGECONFIG', 'apache2', 'true', 'false', d)}; then |
| 181 | install -d ${D}${sysconfdir}/apache2/modules.d |
| 182 | install -d ${D}${sysconfdir}/php/apache2-php${PHP_MAJOR_VERSION} |
| 183 | install -m 644 ${WORKDIR}/70_mod_php${PHP_MAJOR_VERSION}.conf ${D}${sysconfdir}/apache2/modules.d |
| 184 | sed -i s,lib/,${libexecdir}/, ${D}${sysconfdir}/apache2/modules.d/70_mod_php${PHP_MAJOR_VERSION}.conf |
| 185 | cat ${S}/php.ini-production | \ |
| 186 | sed -e 's,extension_dir = \"\./\",extension_dir = \"/usr/lib/extensions\",' \ |
| 187 | > ${D}${sysconfdir}/php/apache2-php${PHP_MAJOR_VERSION}/php.ini |
| 188 | rm -f ${D}${sysconfdir}/apache2/httpd.conf* |
| 189 | fi |
| 190 | } |
| 191 | |
| 192 | SYSROOT_PREPROCESS_FUNCS += "php_sysroot_preprocess" |
| 193 | |
| 194 | php_sysroot_preprocess () { |
| 195 | install -d ${SYSROOT_DESTDIR}${bindir_crossscripts}/ |
| 196 | install -m 755 ${D}${bindir}/phpize ${SYSROOT_DESTDIR}${bindir_crossscripts}/ |
| 197 | install -m 755 ${D}${bindir}/php-config ${SYSROOT_DESTDIR}${bindir_crossscripts}/ |
| 198 | |
| 199 | sed -i 's!eval echo /!eval echo ${STAGING_DIR_HOST}/!' ${SYSROOT_DESTDIR}${bindir_crossscripts}/phpize |
| 200 | sed -i 's!^include_dir=.*!include_dir=${STAGING_INCDIR}/php!' ${SYSROOT_DESTDIR}${bindir_crossscripts}/php-config |
| 201 | } |
| 202 | |
| 203 | MODPHP_PACKAGE = "${@bb.utils.contains('PACKAGECONFIG', 'apache2', '${PN}-modphp', '', d)}" |
| 204 | |
Andrew Geissler | 97771a3 | 2021-03-05 15:23:11 -0600 | [diff] [blame] | 205 | 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}" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 206 | |
| 207 | RDEPENDS_${PN} += "libgcc" |
| 208 | RDEPENDS_${PN}-pear = "${PN}" |
| 209 | RDEPENDS_${PN}-phar = "${PN}-cli" |
| 210 | RDEPENDS_${PN}-cli = "${PN}" |
| 211 | RDEPENDS_${PN}-modphp = "${PN} apache2" |
| 212 | RDEPENDS_${PN}-opcache = "${PN}" |
| 213 | |
Andrew Geissler | 32b1199 | 2021-03-31 13:37:05 -0500 | [diff] [blame] | 214 | ALLOW_EMPTY_${PN} = "1" |
| 215 | |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 216 | INITSCRIPT_PACKAGES = "${PN}-fpm" |
| 217 | inherit update-rc.d |
| 218 | |
| 219 | FILES_${PN}-dbg =+ "${bindir}/.debug \ |
| 220 | ${libexecdir}/apache2/modules/.debug" |
| 221 | FILES_${PN}-doc += "${PHP_LIBDIR}/php/doc" |
| 222 | FILES_${PN}-cli = "${bindir}/php" |
Andrew Geissler | 97771a3 | 2021-03-05 15:23:11 -0600 | [diff] [blame] | 223 | FILES_${PN}-phpdbg = "${bindir}/phpdbg" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 224 | FILES_${PN}-phar = "${bindir}/phar*" |
| 225 | FILES_${PN}-cgi = "${bindir}/php-cgi" |
| 226 | 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" |
| 227 | FILES_${PN}-fpm-apache2 = "${sysconfdir}/apache2/conf.d/php-fpm.conf" |
| 228 | CONFFILES_${PN}-fpm = "${sysconfdir}/php-fpm.conf" |
| 229 | CONFFILES_${PN}-fpm-apache2 = "${sysconfdir}/apache2/conf.d/php-fpm.conf" |
| 230 | INITSCRIPT_NAME_${PN}-fpm = "php-fpm" |
| 231 | INITSCRIPT_PARAMS_${PN}-fpm = "defaults 60" |
| 232 | FILES_${PN}-pear = "${bindir}/pear* ${bindir}/pecl ${PHP_LIBDIR}/php/PEAR \ |
| 233 | ${PHP_LIBDIR}/php/PEAR*.php ${PHP_LIBDIR}/php/System.php \ |
| 234 | ${PHP_LIBDIR}/php/peclcmd.php ${PHP_LIBDIR}/php/pearcmd.php \ |
| 235 | ${PHP_LIBDIR}/php/.channels ${PHP_LIBDIR}/php/.channels/.alias \ |
| 236 | ${PHP_LIBDIR}/php/.registry ${PHP_LIBDIR}/php/Archive/Tar.php \ |
| 237 | ${PHP_LIBDIR}/php/Console/Getopt.php ${PHP_LIBDIR}/php/OS/Guess.php \ |
| 238 | ${PHP_LIBDIR}/php/data/PEAR \ |
| 239 | ${sysconfdir}/pear.conf" |
| 240 | FILES_${PN}-dev = "${includedir}/php ${PHP_LIBDIR}/build ${bindir}/phpize \ |
| 241 | ${bindir}/php-config ${PHP_LIBDIR}/php/.depdb \ |
| 242 | ${PHP_LIBDIR}/php/.depdblock ${PHP_LIBDIR}/php/.filemap \ |
| 243 | ${PHP_LIBDIR}/php/.lock ${PHP_LIBDIR}/php/test" |
| 244 | FILES_${PN}-staticdev += "${PHP_LIBDIR}/extensions/*/*.a" |
| 245 | FILES_${PN}-opcache = "${PHP_LIBDIR}/extensions/*/opcache${SOLIBSDEV}" |
| 246 | FILES_${PN} = "${PHP_LIBDIR}/php" |
| 247 | FILES_${PN} += "${bindir} ${libexecdir}/apache2" |
| 248 | |
| 249 | SUMMARY_${PN}-modphp = "PHP module for the Apache HTTP server" |
| 250 | FILES_${PN}-modphp = "${libdir}/apache2 ${sysconfdir}" |
| 251 | |
| 252 | MODPHP_OLDPACKAGE = "${@bb.utils.contains('PACKAGECONFIG', 'apache2', 'modphp', '', d)}" |
| 253 | RPROVIDES_${PN}-modphp = "${MODPHP_OLDPACKAGE}" |
| 254 | RREPLACES_${PN}-modphp = "${MODPHP_OLDPACKAGE}" |
| 255 | RCONFLICTS_${PN}-modphp = "${MODPHP_OLDPACKAGE}" |
| 256 | |
| 257 | do_install_append_class-native() { |
| 258 | create_wrapper ${D}${bindir}/php \ |
| 259 | PHP_PEAR_SYSCONF_DIR=${sysconfdir}/ |
| 260 | } |
| 261 | |
| 262 | |
| 263 | # Fails to build with thumb-1 (qemuarm) |
| 264 | # | {standard input}: Assembler messages: |
| 265 | # | {standard input}:3719: Error: selected processor does not support Thumb mode `smull r0,r2,r9,r3' |
| 266 | # | {standard input}:3720: Error: unshifted register required -- `sub r2,r2,r0,asr#31' |
| 267 | # | {standard input}:3796: Error: selected processor does not support Thumb mode `smull r0,r2,r3,r3' |
| 268 | # | {standard input}:3797: Error: unshifted register required -- `sub r2,r2,r0,asr#31' |
| 269 | # | make: *** [ext/standard/math.lo] Error 1 |
| 270 | ARM_INSTRUCTION_SET = "arm" |