Skip to content

Commit 95e5ef7

Browse files
committed
refactor(build): extract libxml2 dependency installation into separate function
1 parent 9136da4 commit 95e5ef7

File tree

4 files changed

+39
-20
lines changed

4 files changed

+39
-20
lines changed

build-alpine

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,19 @@ install_deps() {
4242

4343
install_dev_deps() {
4444
apk add gmp-dev judy-dev bsd-compat-headers m4
45+
}
4546

46-
install_libxml2
47+
install_libxml2_deps() {
48+
test -d libxml2-2.10.3 && rm -fr libxml2-2.10.3
49+
curl -sSL https://github.com/GNOME/libxml2/archive/refs/tags/v2.10.3.tar.gz | tar -xzf -
50+
cd libxml2-2.10.3 && mkdir -p build && cd build
51+
cmake -DBUILD_SHARED_LIBS=OFF -DLIBXML2_WITH_LZMA=OFF -DLIBXML2_WITH_PYTHON=OFF -DLIBXML2_WITH_ICONV=OFF -DCMAKE_BUILD_TYPE=Release ..
52+
make -j4 && make install
53+
cd ../..
54+
rm -fr libxml2-2.10.3
4755
}
4856

49-
export -f install_deps install_dev_deps install_rust
57+
export -f install_deps install_dev_deps install_libxml2_deps install_rust
5058
. build-bash-base.sh "$@"
5159

5260
if [ "$BUILD_DEV" -eq 1 ]; then

build-bash-base.sh

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ fi
2727
if [[ -z "$SKIP_SYSTEM_DEPS" || "$SKIP_SYSTEM_DEPS" == 0 ]]; then
2828
install_deps
2929

30+
install_libxml2_deps
31+
3032
if [[ "$BUILD_DEV" == "1" ]]; then
3133
install_dev_deps
3234
fi
@@ -97,10 +99,7 @@ if [ "$(uname)" == "Darwin" ]; then
9799
fi
98100
cd ../..
99101

100-
BUILD_EXTRA=()
101-
if [[ "$BUILD_DEV" == "1" ]]; then
102-
BUILD_STATIC=0
103-
BUILD_EXTRA=(
102+
BUILD_EXTRA=(
104103
"--enable-dom"
105104
"--with-libxml"
106105
"--enable-tokenizer"
@@ -109,20 +108,24 @@ if [[ "$BUILD_DEV" == "1" ]]; then
109108
"--enable-xmlreader"
110109
"--enable-simplexml"
111110
"--enable-phar"
112-
# Little extra exts in case we will need it
113-
"--enable-bcmath"
114-
"--enable-ctype"
115-
"--with-gmp"
116-
# Profiling extensions
117-
"--enable-debug"
118-
# "--enable-memprof"
119-
# "--enable-memprof-debug"
111+
)
112+
if [[ "$BUILD_DEV" == "1" ]]; then
113+
BUILD_STATIC=0
114+
BUILD_EXTRA+=(
115+
# Little extra exts in case we will need it
116+
"--enable-bcmath"
117+
"--enable-ctype"
118+
"--with-gmp"
119+
# Profiling extensions
120+
"--enable-debug"
121+
# "--enable-memprof"
122+
# "--enable-memprof-debug"
120123
#
121124
# It does not work with PHP 8.4.18
122-
# "--enable-tideways-xhprof"
123-
# "--enable-xdebug"
124-
)
125-
fi
125+
# "--enable-tideways-xhprof"
126+
# "--enable-xdebug"
127+
)
128+
fi
126129

127130
# Build main php
128131
mkdir dist

build-linux

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@ install_dev_deps() {
3434
sudo apt-get install -y libonig-dev libgmp-dev libxml2-dev
3535
}
3636

37-
export -f install_deps install_dev_deps install_rust
37+
install_libxml2_deps() {
38+
sudo apt-get install -y libxml2-dev
39+
}
40+
41+
export -f install_deps install_dev_deps install_libxml2_deps install_rust
3842
. build-bash-base.sh "$@"
3943

4044

build-osx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,11 @@ install_dev_deps() {
3838
brew install libxml2 oniguruma libgmp
3939
}
4040

41-
export -f install_deps install_dev_deps install_rust
41+
install_libxml2_deps() {
42+
brew install libxml2
43+
}
44+
45+
export -f install_deps install_dev_deps install_libxml2_deps install_rust
4246
. ./build-bash-base.sh "$@"
4347

4448
MAKE_LDFLAGS=

0 commit comments

Comments
 (0)