Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Provide PHP Bison 2.7 dep for non-ARM64 arch
Browse files Browse the repository at this point in the history
The prebuilt bison 2.7 files are for arm64 architecture and do not work
for other architectures such as x86_64.  In these cases, we can at least
build bison 2.7 from source.  We could be more efficient and build a
version that is cached across all PHP builds that need it, but let's get
the builds working again first.
  • Loading branch information
brandonpayton committed Mar 19, 2024
1 parent 2ca5891 commit f6b2bd4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/php-wasm/compile/bison2.7/bison27.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Subject: Use Bison 2.7 to compile PHP 5.6

This workaround enables building Bison 2.7 on arm64 architecture
This workaround enables building Bison 2.7
so that it can be used to compile PHP 5.6.

Derived from the OpenWRT project:
Expand Down
23 changes: 20 additions & 3 deletions packages/php-wasm/compile/php/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,30 @@ RUN touch /root/.configure-flags && \
touch /root/.emcc-php-wasm-flags && \
touch /root/.EXPORTED_FUNCTIONS

# Grab Bison 2.7 patch in case we need it
COPY ./bison2.7/bison27.patch /root/bison27.patch

# PHP <= 7.3 requires Bison 2.7
# PHP >= 7.4 and Bison 3.0
RUN if [[ "${PHP_VERSION:0:1}" -le "7" && "${PHP_VERSION:2:1}" -le "3" ]]; then \
mv /libs/bison2.7/usr/local/bison /usr/local/bison && \
ln -s /usr/local/bison/bin/bison /usr/bin/bison && \
ln -s /usr/local/bison/bin/yacc /usr/bin/yacc; \
if /libs/bison2.7/usr/local/bison/bin/bison -h >/dev/null; then \
mv /libs/bison2.7/usr/local/bison /usr/local/bison && \
ln -s /usr/local/bison/bin/bison /usr/bin/bison && \
ln -s /usr/local/bison/bin/yacc /usr/bin/yacc; \
else \
wget https://ftp.gnu.org/gnu/bison/bison-2.7.tar.gz && \
tar -xvf bison-2.7.tar.gz && \
rm bison-2.7.tar.gz && \
cd bison-2.7 && \
git apply --no-index /root/bison27.patch && \
./configure --prefix=/usr/local --with-libiconv-prefix=/usr/local/libiconv/ && \
make && \
make install; \
if [[ $? -ne 0 ]]; then \
echo 'Failed to build Bison 2.7 dependency.'; \
exit -1; \
fi; \
fi; \
else \
apt install -y bison; \
fi;
Expand Down

0 comments on commit f6b2bd4

Please sign in to comment.