php-zts

Source

FROM scratch AS build
ARG VERSION
ARG SOURCE_DATE_EPOCH=1

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-llvm . /
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-libedit . /
COPY --from=stagex/core-linux-headers . /
COPY --from=stagex/core-sqlite3 . /
COPY --from=stagex/user-argon2 . /
COPY --from=stagex/user-libsodium . /
COPY --from=stagex/user-libiconv . /

ADD fetch/php-${VERSION}.tar.gz .

WORKDIR /php-${VERSION}
COPY *.patch .

ENV SOURCE_DATE_EPOCH=$SOURCE_DATE_EPOCH
ENV PHP_UNAME="Linux stagex"
ENV PHP_BUILD_PROVIDER="stagex"
ENV PHP_BUILD_SYSTEM="${PHP_UNAME}"
ENV CC=clang
ENV CXX=clang++
ENV EXTENSION_DIR=/usr/lib/php-modules
ENV CFLAGS="-march=x86-64 -mtune=generic -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
ENV CXXFLAGS="$CFLAGS"
ENV LDFLAGS="-Wl,-O1, -pie"

RUN --network=none <<-EOF
	set -eux
	patch -p1 < remove-timestamps-from-phar.patch
	patch -p1 < file-order-phar-pack.patch
	./buildconf --force
	./configure \
		--with-config-file-path=/etc/php \
		--with-config-file-scan-dir=/etc/php/conf.d \
		--enable-option-checking=fatal \
		--libdir=/usr/lib \
		--datadir=/usr/share/php \
		--localstatedir=/var \
		--with-layout=GNU \
		--prefix=/usr \
		\
		--with-pic \
		\
		--enable-mysqlnd \
		--with-password-argon2 \
		--with-sodium=shared \
		--with-pdo-sqlite=/usr \
		--with-iconv=/usr \
		--with-curl=shared \
		--with-openssl \
		--with-zlib \
		\
		--enable-phpdbg \
		--enable-embed \
		--enable-zts \
		--disable-zend-signals
	make -j "$(nproc)"
	make INSTALL_ROOT=/rootfs install
	rm -rf /rootfs/var/run
	install -vDm644 -t /rootfs/usr/share/licenses/php-zts LICENSE
EOF
FROM stagex/core-filesystem AS package
COPY --from=build /rootfs/ /

Copied to clipboard!