Source
FROM scratch AS build
ARG VERSION
ENV PKG_NAME=php84
COPY --from=stagex/core-libunwind . /
COPY --from=stagex/core-acl . /
COPY --from=stagex/core-automake . /
COPY --from=stagex/core-bash . /
COPY --from=stagex/core-bc . /
COPY --from=stagex/core-busybox . /
COPY --from=stagex/core-libzstd . /
COPY --from=stagex/core-lld . /
COPY --from=stagex/core-binutils . /
COPY --from=stagex/core-llvm . /
COPY --from=stagex/core-curl . /
COPY --from=stagex/core-clang . /
COPY --from=stagex/core-bison . /
COPY --from=stagex/core-gdbm . /
COPY --from=stagex/core-lmdb . /
COPY --from=stagex/core-pkgconf . /
COPY --from=stagex/core-autoconf . /
COPY --from=stagex/core-make . /
COPY --from=stagex/core-gcc . /
COPY --from=stagex/core-gmp . /
COPY --from=stagex/core-icu . /
COPY --from=stagex/core-gettext . /
COPY --from=stagex/core-openssl . /
COPY --from=stagex/core-expat . /
COPY --from=stagex/core-libxml2 . /
COPY --from=stagex/core-re2c . /
COPY --from=stagex/core-musl . /
COPY --from=stagex/core-libffi . /
COPY --from=stagex/core-perl . /
COPY --from=stagex/core-m4 . /
COPY --from=stagex/core-zlib . /
COPY --from=stagex/core-lzip . /
COPY --from=stagex/core-pcre2 . /
COPY --from=stagex/core-bzip2 . /
COPY --from=stagex/core-python . /
COPY --from=stagex/core-libedit . /
COPY --from=stagex/core-linux-headers . /
COPY --from=stagex/core-sqlite3 . /
ADD fetch/php-${VERSION}.tar.gz .
WORKDIR /php-src-php-${VERSION}
COPY *.patch .
ENV SOURCE_DATE_EPOCH=1
ENV PHP_UNAME="Linux stagex"
ENV PHP_BUILD_SYSTEM="${PHP_UNAME}"
ENV CC=clang
ENV CXX=clang++
ENV EXTENSION_DIR=/usr/lib/modules
ENV CFLAGS="-O2"
ENV CXXFLAGS="-O2"
RUN --network=none <<-EOF
set -eux
patch -p1 fix-lfs64-2.patch
patch -p1 fix-tests-devserver.patch
patch -p1 includedir.patch
patch -p1 install-pear.patch
patch -p1 php83-fpm-verison-suffix.patch
patch -p1 phpinfo-avif.patch
patch -p1 sharedir.patch
./buildconf --force
./configure \
--prefix=/usr \
--program-suffix=php83#php \
--libdir=/usr/lib \
--datadir=/usr/share/php83 \
--sysconfdir=/etc/php83 \
--localstatedir=/var \
--with-layout=GNU \
--with-pic \
--with-config-file-path=/etc/php83 \
--with-config-file-scan-dir=/etc/php83/conf.d \
--disable-rpath \
--disable-short-tags \
--disable-all \
--enable-bcmath=shared \
--with-bz2=shared \
--enable-calendar=shared \
--enable-ctype=shared \
--with-curl=shared
make -j "$(nproc)"
make INSTALL_ROOT=/rootfs install
rm -rf /rootfs/var/run
EOF
FROM stagex/core-filesystem AS package
COPY --from=build /rootfs/ /