Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix php bison dep for building on non-arm64 architectures #1115

Merged
merged 2 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 && \
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
Loading