@@ -4,6 +4,8 @@ ARG VRZNO_FLAG="--disable-vrzno"
44ENV VRZNO_FLAG ${VRZNO_FLAG}
55ARG PHP_VERSION=8.0.24
66ENV PHP_VERSION ${PHP_VERSION}
7+ ARG WITH_LIBXML=no
8+ ENV WITH_LIBXML ${WITH_LIBXML}
79
810WORKDIR /root
911RUN mkdir lib
@@ -14,8 +16,8 @@ RUN set -euxo pipefail;\
1416 apt-get --no-install-recommends -y install \
1517 build-essential \
1618 automake-1.15 \
17- libxml2-dev \
1819 autoconf \
20+ libxml2-dev \
1921 libtool \
2022 pkgconf \
2123 bison \
@@ -45,7 +47,6 @@ RUN git clone https://github.com/php/php-src.git php-src \
4547 && cp php-src/Zend/bench.php php-src/preload/Zend \
4648 && touch php-src/patched
4749
48-
4950# Get and patch Sqlite3
5051COPY ./docker-build-files/sqlite3-wasm.patch /root/
5152RUN set -euxo pipefail;\
@@ -64,34 +65,37 @@ RUN git clone https://github.com/seanmorris/vrzno.git php-src/ext/vrzno \
6465 --depth 1
6566
6667# Get and build Libxml2
67- RUN env GIT_SSL_NO_VERIFY=true git clone https://gitlab.gnome.org/GNOME/libxml2.git libxml2 \
68+ RUN if [ "$WITH_LIBXML" = "yes" ]; \
69+ then env GIT_SSL_NO_VERIFY=true git clone https://gitlab.gnome.org/GNOME/libxml2.git libxml2 \
6870 --branch v2.9.10 \
6971 --single-branch \
70- --depth 1;
71-
72- RUN cd libxml2 && ./autogen.sh
73- RUN cd libxml2 && emconfigure ./configure --with-http=no --with-ftp=no --with-python=no --with-threads=no --enable-shared=no --prefix=/root/lib/
74- RUN cd libxml2 && emmake make
75- RUN cd libxml2 && emmake make install
72+ --depth 1 && \
73+ cd libxml2 && \
74+ ./autogen.sh && \
75+ emconfigure ./configure --with-http=no --with-ftp=no --with-python=no --with-threads=no --enable-shared=no --prefix=/root/lib/ &&\
76+ emmake make && \
77+ emmake make install; \
78+ fi
7679
7780# Build the patched PHP
7881RUN cd php-src/ && PKG_CONFIG_PATH=$PKG_CONFIG_PATH ./buildconf --force
7982
80- # RUN ls /root/lib/lib/; sleep 50
83+ RUN if [ "$WITH_LIBXML" = "yes" ]; \
84+ then export LIBXML_FLAGS=(--with-libxml --enable-dom --enable-xml --enable-simplexml); \
85+ else export LIBXML_FLAGS=(--without-libxml --disable-dom --disable-xml --disable-simplexml); \
86+ fi
8187
8288RUN cd php-src/ && PKG_CONFIG_PATH=$PKG_CONFIG_PATH emconfigure ./configure \
8389 PKG_CONFIG_PATH=$PKG_CONFIG_PATH \
8490 --enable-embed=static \
8591 --with-layout=GNU \
86- --with-libxml \
8792 --disable-cgi \
8893 --disable-cli \
8994 --disable-all \
9095 --with-sqlite3 \
9196 --enable-session \
9297 --enable-filter \
9398 --enable-calendar \
94- --enable-dom \
9599 --enable-pdo \
96100 --with-pdo-sqlite \
97101 --disable-rpath \
@@ -105,28 +109,35 @@ RUN cd php-src/ && PKG_CONFIG_PATH=$PKG_CONFIG_PATH emconfigure ./configure \
105109 --enable-mbstring \
106110 --disable-mbregex \
107111 --enable-tokenizer \
108- $VRZNO_FLAG \
109- --enable-xml \
110- --enable-simplexml \
112+ "${LIBXML_FLAGS[@]}" \
113+ $VRZNO_FLAG \
111114 --with-gd
112115
116+
113117RUN cd php-src/ && emmake make -j8
114118
115119RUN cp -v php-src/.libs/libphp.la /root/lib/libphp7.la
116- RUN cp -v php-src/.libs/libphp.a /root/lib// libphp7.a
120+ RUN cp -v php-src/.libs/libphp.a /root/lib/libphp7.a
117121
118122COPY ./docker-build-files/pib_eval.c /root/
123+
124+ RUN if [ "$WITH_LIBXML" = "yes" ]; \
125+ then export LIBXML_EMCC_FLAGS=(-I /root/libxml2); \
126+ else export LIBXML_EMCC_FLAGS="" ; \
127+ fi
128+
119129RUN if [ "$VRZNO_FLAG" = "--enable-vrzno" ]; \
120130 then export DEFINES='-DWITH_VRZNO=1' ; \
121131 else export DEFINES='' ; \
122- fi && \
123- cd php-src/ && \
132+ fi
133+
134+ RUN cd php-src/ && \
124135 emcc -Oz \
125136 -I . \
126137 -I Zend \
127138 -I main \
128139 -I TSRM/ \
129- -I /root/libxml2 \
140+ "${LIBXML_EMCC_FLAGS[@]}" \
130141 $DEFINES \
131142 /root/pib_eval.c \
132143 -o /root/lib/pib_eval.o;
0 commit comments