blob: abd8b1672376e91c6d8c236229c389996c48eef9 [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 "
Andrew Geisslerd688a012020-09-18 13:36:00 -050034
Andrew Geissler82c905d2020-04-13 13:39:40 -050035S = "${WORKDIR}/php-${PV}"
Andrew Geisslerd688a012020-09-18 13:36:00 -050036SRC_URI[md5sum] = "e68a66c54b080d108831f6dc2e1e403d"
37SRC_URI[sha256sum] = "2e270958a4216480da7886743438ccc92b6acf32ea96fefda88d07e0a5095deb"
Andrew Geissler82c905d2020-04-13 13:39:40 -050038
39inherit autotools pkgconfig python3native gettext
40
41# phpize is not scanned for absolute paths by default (but php-config is).
42#
43SSTATE_SCAN_FILES += "phpize"
44SSTATE_SCAN_FILES += "build-defs.h"
45
46PHP_LIBDIR = "${libdir}/php${PHP_MAJOR_VERSION}"
47
48# Common EXTRA_OECONF
49COMMON_EXTRA_OECONF = "--enable-sockets \
50 --enable-pcntl \
51 --enable-shared \
52 --disable-rpath \
53 --with-pic \
54 --libdir=${PHP_LIBDIR} \
55"
56EXTRA_OECONF = "--enable-mbstring \
57 --enable-fpm \
58 --with-libdir=${baselib} \
59 --with-gettext=${STAGING_LIBDIR}/.. \
60 --with-zlib=${STAGING_LIBDIR}/.. \
61 --with-iconv=${STAGING_LIBDIR}/.. \
62 --with-bz2=${STAGING_DIR_TARGET}${exec_prefix} \
63 --with-config-file-path=${sysconfdir}/php/apache2-php${PHP_MAJOR_VERSION} \
64 ${@oe.utils.conditional('SITEINFO_ENDIANNESS', 'le', 'ac_cv_c_bigendian_php=no', 'ac_cv_c_bigendian_php=yes', d)} \
65 ${@bb.utils.contains('PACKAGECONFIG', 'pam', '', 'ac_cv_lib_pam_pam_start=no', d)} \
66 ${COMMON_EXTRA_OECONF} \
67"
68
69EXTRA_OECONF_append_riscv64 = " --with-pcre-jit=no"
70EXTRA_OECONF_append_riscv32 = " --with-pcre-jit=no"
71
72CACHED_CONFIGUREVARS += "ac_cv_func_dlopen=no ac_cv_lib_dl_dlopen=yes"
73
74EXTRA_OECONF_class-native = " \
75 --with-zlib=${STAGING_LIBDIR_NATIVE}/.. \
76 --without-iconv \
77 ${COMMON_EXTRA_OECONF} \
78"
79
80PACKAGECONFIG ??= "mysql sqlite3 imap opcache openssl \
81 ${@bb.utils.filter('DISTRO_FEATURES', 'ipv6 pam', d)} \
82"
83PACKAGECONFIG_class-native = ""
84
Andrew Geissler7f40b712020-05-15 14:09:53 -050085PACKAGECONFIG[zip] = "--with-zip --with-zlib-dir=${STAGING_EXECPREFIXDIR},,libzip"
Andrew Geissler82c905d2020-04-13 13:39:40 -050086
87PACKAGECONFIG[mysql] = "--with-mysqli=mysqlnd \
88 --with-pdo-mysql=mysqlnd \
89 ,--without-mysqli --without-pdo-mysql \
90 ,mysql5"
91
92PACKAGECONFIG[sqlite3] = "--with-sqlite3=${STAGING_LIBDIR}/.. \
93 --with-pdo-sqlite=${STAGING_LIBDIR}/.. \
94 ,--without-sqlite3 --without-pdo-sqlite \
95 ,sqlite3"
96PACKAGECONFIG[pgsql] = "--with-pgsql=${STAGING_DIR_TARGET}${exec_prefix},--without-pgsql,postgresql"
Andrew Geissler7f40b712020-05-15 14:09:53 -050097PACKAGECONFIG[soap] = "--enable-soap, --disable-soap, libxml2"
Andrew Geissler82c905d2020-04-13 13:39:40 -050098PACKAGECONFIG[apache2] = "--with-apxs2=${STAGING_BINDIR_CROSS}/apxs,,apache2-native apache2"
99PACKAGECONFIG[pam] = ",,libpam"
100PACKAGECONFIG[imap] = "--with-imap=${STAGING_DIR_HOST} \
101 --with-imap-ssl=${STAGING_DIR_HOST} \
102 ,--without-imap --without-imap-ssl \
103 ,uw-imap"
104PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6,"
105PACKAGECONFIG[opcache] = "--enable-opcache,--disable-opcache"
106PACKAGECONFIG[openssl] = "--with-openssl,--without-openssl,openssl"
107PACKAGECONFIG[valgrind] = "--with-valgrind=${STAGING_DIR_TARGET}/usr,--with-valgrind=no,valgrind"
108PACKAGECONFIG[mbregex] = "--enable-mbregex, --disable-mbregex, oniguruma"
Andrew Geissler7f40b712020-05-15 14:09:53 -0500109PACKAGECONFIG[mbstring] = "--enable-mbstring,,"
Andrew Geissler82c905d2020-04-13 13:39:40 -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"
114
Andrew Geissler7f40b712020-05-15 14:09:53 -0500115# Adding these flags enables dynamic library support, which is disabled by
116# default when cross compiling
117# See https://bugs.php.net/bug.php?id=60109
118CFLAGS += " -DHAVE_LIBDL "
119LDFLAGS += " -ldl "
120
Andrew Geissler82c905d2020-04-13 13:39:40 -0500121EXTRA_OEMAKE = "INSTALL_ROOT=${D}"
122
123acpaths = ""
124
125do_configure_prepend () {
126 rm -f ${S}/build/libtool.m4 ${S}/ltmain.sh ${S}/aclocal.m4
127 find ${S} -name config.m4 | xargs -n1 sed -i 's!APXS_HTTPD=.*!APXS_HTTPD=${STAGING_SBINDIR_NATIVE}/httpd!'
128}
129
130do_configure_append() {
131 # No, libtool, we really don't want rpath set...
132 sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' ${HOST_SYS}-libtool
133 sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' ${HOST_SYS}-libtool
134}
135
136do_install_append_class-native() {
137 rm -rf ${D}/${PHP_LIBDIR}/php/.registry
138 rm -rf ${D}/${PHP_LIBDIR}/php/.channels
139 rm -rf ${D}/${PHP_LIBDIR}/php/.[a-z]*
140}
141
142do_install_prepend() {
143 cat ${ACLOCALDIR}/libtool.m4 ${ACLOCALDIR}/lt~obsolete.m4 ${ACLOCALDIR}/ltoptions.m4 \
144 ${ACLOCALDIR}/ltsugar.m4 ${ACLOCALDIR}/ltversion.m4 > ${S}/build/libtool.m4
145}
146
147do_install_prepend_class-target() {
148 if ${@bb.utils.contains('PACKAGECONFIG', 'apache2', 'true', 'false', d)}; then
149 # Install dummy config file so apxs doesn't fail
150 install -d ${D}${sysconfdir}/apache2
151 printf "\nLoadModule dummy_module modules/mod_dummy.so\n" > ${D}${sysconfdir}/apache2/httpd.conf
152 fi
153}
154
155# fixme
156do_install_append_class-target() {
157 install -d ${D}${sysconfdir}/
158 rm -rf ${D}/${TMPDIR}
159 rm -rf ${D}/.registry
160 rm -rf ${D}/.channels
161 rm -rf ${D}/.[a-z]*
162 rm -rf ${D}/var
163 rm -f ${D}/${sysconfdir}/php-fpm.conf.default
164 install -m 0644 ${WORKDIR}/php-fpm.conf ${D}/${sysconfdir}/php-fpm.conf
165 install -d ${D}/${sysconfdir}/apache2/conf.d
166 install -m 0644 ${WORKDIR}/php-fpm-apache.conf ${D}/${sysconfdir}/apache2/conf.d/php-fpm.conf
167 install -d ${D}${sysconfdir}/init.d
168 sed -i 's:=/usr/sbin:=${sbindir}:g' ${B}/sapi/fpm/init.d.php-fpm
169 sed -i 's:=/etc:=${sysconfdir}:g' ${B}/sapi/fpm/init.d.php-fpm
170 sed -i 's:=/var:=${localstatedir}:g' ${B}/sapi/fpm/init.d.php-fpm
171 install -m 0755 ${B}/sapi/fpm/init.d.php-fpm ${D}${sysconfdir}/init.d/php-fpm
172 install -m 0644 ${WORKDIR}/php-fpm-apache.conf ${D}/${sysconfdir}/apache2/conf.d/php-fpm.conf
173
174 if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)};then
175 install -d ${D}${systemd_unitdir}/system
176 install -m 0644 ${WORKDIR}/php-fpm.service ${D}${systemd_unitdir}/system/
177 sed -i -e 's,@SYSCONFDIR@,${sysconfdir},g' \
178 -e 's,@LOCALSTATEDIR@,${localstatedir},g' \
179 ${D}${systemd_unitdir}/system/php-fpm.service
180 fi
181
182 TMP=`dirname ${D}/${TMPDIR}`
183 while test ${TMP} != ${D}; do
184 if [ -d ${TMP} ]; then
185 rmdir ${TMP}
186 fi
187 TMP=`dirname ${TMP}`;
188 done
189
190 if ${@bb.utils.contains('PACKAGECONFIG', 'apache2', 'true', 'false', d)}; then
191 install -d ${D}${sysconfdir}/apache2/modules.d
192 install -d ${D}${sysconfdir}/php/apache2-php${PHP_MAJOR_VERSION}
193 install -m 644 ${WORKDIR}/70_mod_php${PHP_MAJOR_VERSION}.conf ${D}${sysconfdir}/apache2/modules.d
194 sed -i s,lib/,${libexecdir}/, ${D}${sysconfdir}/apache2/modules.d/70_mod_php${PHP_MAJOR_VERSION}.conf
195 cat ${S}/php.ini-production | \
196 sed -e 's,extension_dir = \"\./\",extension_dir = \"/usr/lib/extensions\",' \
197 > ${D}${sysconfdir}/php/apache2-php${PHP_MAJOR_VERSION}/php.ini
198 rm -f ${D}${sysconfdir}/apache2/httpd.conf*
199 fi
200}
201
202SYSROOT_PREPROCESS_FUNCS += "php_sysroot_preprocess"
203
204php_sysroot_preprocess () {
205 install -d ${SYSROOT_DESTDIR}${bindir_crossscripts}/
206 install -m 755 ${D}${bindir}/phpize ${SYSROOT_DESTDIR}${bindir_crossscripts}/
207 install -m 755 ${D}${bindir}/php-config ${SYSROOT_DESTDIR}${bindir_crossscripts}/
208
209 sed -i 's!eval echo /!eval echo ${STAGING_DIR_HOST}/!' ${SYSROOT_DESTDIR}${bindir_crossscripts}/phpize
210 sed -i 's!^include_dir=.*!include_dir=${STAGING_INCDIR}/php!' ${SYSROOT_DESTDIR}${bindir_crossscripts}/php-config
211}
212
213MODPHP_PACKAGE = "${@bb.utils.contains('PACKAGECONFIG', 'apache2', '${PN}-modphp', '', d)}"
214
215PACKAGES = "${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}"
216
217RDEPENDS_${PN} += "libgcc"
218RDEPENDS_${PN}-pear = "${PN}"
219RDEPENDS_${PN}-phar = "${PN}-cli"
220RDEPENDS_${PN}-cli = "${PN}"
221RDEPENDS_${PN}-modphp = "${PN} apache2"
222RDEPENDS_${PN}-opcache = "${PN}"
223
224INITSCRIPT_PACKAGES = "${PN}-fpm"
225inherit update-rc.d
226
227FILES_${PN}-dbg =+ "${bindir}/.debug \
228 ${libexecdir}/apache2/modules/.debug"
229FILES_${PN}-doc += "${PHP_LIBDIR}/php/doc"
230FILES_${PN}-cli = "${bindir}/php"
231FILES_${PN}-phar = "${bindir}/phar*"
232FILES_${PN}-cgi = "${bindir}/php-cgi"
233FILES_${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"
234FILES_${PN}-fpm-apache2 = "${sysconfdir}/apache2/conf.d/php-fpm.conf"
235CONFFILES_${PN}-fpm = "${sysconfdir}/php-fpm.conf"
236CONFFILES_${PN}-fpm-apache2 = "${sysconfdir}/apache2/conf.d/php-fpm.conf"
237INITSCRIPT_NAME_${PN}-fpm = "php-fpm"
238INITSCRIPT_PARAMS_${PN}-fpm = "defaults 60"
239FILES_${PN}-pear = "${bindir}/pear* ${bindir}/pecl ${PHP_LIBDIR}/php/PEAR \
240 ${PHP_LIBDIR}/php/PEAR*.php ${PHP_LIBDIR}/php/System.php \
241 ${PHP_LIBDIR}/php/peclcmd.php ${PHP_LIBDIR}/php/pearcmd.php \
242 ${PHP_LIBDIR}/php/.channels ${PHP_LIBDIR}/php/.channels/.alias \
243 ${PHP_LIBDIR}/php/.registry ${PHP_LIBDIR}/php/Archive/Tar.php \
244 ${PHP_LIBDIR}/php/Console/Getopt.php ${PHP_LIBDIR}/php/OS/Guess.php \
245 ${PHP_LIBDIR}/php/data/PEAR \
246 ${sysconfdir}/pear.conf"
247FILES_${PN}-dev = "${includedir}/php ${PHP_LIBDIR}/build ${bindir}/phpize \
248 ${bindir}/php-config ${PHP_LIBDIR}/php/.depdb \
249 ${PHP_LIBDIR}/php/.depdblock ${PHP_LIBDIR}/php/.filemap \
250 ${PHP_LIBDIR}/php/.lock ${PHP_LIBDIR}/php/test"
251FILES_${PN}-staticdev += "${PHP_LIBDIR}/extensions/*/*.a"
252FILES_${PN}-opcache = "${PHP_LIBDIR}/extensions/*/opcache${SOLIBSDEV}"
253FILES_${PN} = "${PHP_LIBDIR}/php"
254FILES_${PN} += "${bindir} ${libexecdir}/apache2"
255
256SUMMARY_${PN}-modphp = "PHP module for the Apache HTTP server"
257FILES_${PN}-modphp = "${libdir}/apache2 ${sysconfdir}"
258
259MODPHP_OLDPACKAGE = "${@bb.utils.contains('PACKAGECONFIG', 'apache2', 'modphp', '', d)}"
260RPROVIDES_${PN}-modphp = "${MODPHP_OLDPACKAGE}"
261RREPLACES_${PN}-modphp = "${MODPHP_OLDPACKAGE}"
262RCONFLICTS_${PN}-modphp = "${MODPHP_OLDPACKAGE}"
263
264do_install_append_class-native() {
265 create_wrapper ${D}${bindir}/php \
266 PHP_PEAR_SYSCONF_DIR=${sysconfdir}/
267}
268
269
270# Fails to build with thumb-1 (qemuarm)
271# | {standard input}: Assembler messages:
272# | {standard input}:3719: Error: selected processor does not support Thumb mode `smull r0,r2,r9,r3'
273# | {standard input}:3720: Error: unshifted register required -- `sub r2,r2,r0,asr#31'
274# | {standard input}:3796: Error: selected processor does not support Thumb mode `smull r0,r2,r3,r3'
275# | {standard input}:3797: Error: unshifted register required -- `sub r2,r2,r0,asr#31'
276# | make: *** [ext/standard/math.lo] Error 1
277ARM_INSTRUCTION_SET = "arm"