Skip to content

Commit bb5b31f

Browse files
committed
add xml2 lib
1 parent 450e2b1 commit bb5b31f

File tree

6 files changed

+126
-14
lines changed

6 files changed

+126
-14
lines changed

.github/workflows/install-dependencies.sh

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,17 @@ case $LIB_NAME in
2121
fi
2222
;;
2323
bluray)
24-
if [[ $PLAT == android || $PLAT == all ]];then
25-
./main.sh install -p android -l 'fontconfig'
24+
if [[ $PLAT == all ]];then
25+
./main.sh install -l 'xml2' -p ios
26+
./main.sh install -l 'xml2' -p tvos
27+
./main.sh install -l 'xml2' -p macos
28+
./main.sh install -l 'xml2' -p android
29+
elif [[ $PLAT == apple ]];then
30+
./main.sh install -l 'xml2' -p ios
31+
./main.sh install -l 'xml2' -p tvos
32+
./main.sh install -l 'xml2' -p macos
33+
else
34+
./main.sh install -l 'xml2' -p $PLAT
2635
fi
2736
;;
2837
dav1d)
@@ -58,6 +67,18 @@ case $LIB_NAME in
5867
fi
5968
;;
6069
fontconfig)
70+
if [[ $PLAT == all ]];then
71+
./main.sh install -l 'xml2' -p ios
72+
./main.sh install -l 'xml2' -p tvos
73+
./main.sh install -l 'xml2' -p macos
74+
./main.sh install -l 'xml2' -p android
75+
elif [[ $PLAT == apple ]];then
76+
./main.sh install -l 'xml2' -p ios
77+
./main.sh install -l 'xml2' -p tvos
78+
./main.sh install -l 'xml2' -p macos
79+
else
80+
./main.sh install -l 'xml2' -p $PLAT
81+
fi
6182
if [[ $PLAT == android || $PLAT == all ]];then
6283
./main.sh install -p android -l 'freetype'
6384
fi

configs/libs/xml2.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#! /usr/bin/env bash
2+
#
3+
# Copyright (C) 2021 Matt Reach<qianlongxu@gmail.com>
4+
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
#
18+
#
19+
# brew install nasm
20+
# If you really want to compile without asm, configure with --disable-asm.
21+
22+
# LIB_DEPENDS_BIN using string because bash can't export array chttps://stackoverflow.com/questions/5564418/exporting-an-array-in-bash-script
23+
# configure: error: Package requirements (openssl) were not met
24+
25+
export LIB_NAME='xml2'
26+
export LIPO_LIBS="libxml2"
27+
export LIB_DEPENDS_BIN="cmake"
28+
export CMAKE_TARGET_NAME=LibXml2
29+
export GIT_LOCAL_REPO=extra/xml2
30+
export GIT_COMMIT=v2.13.6
31+
export REPO_DIR=xml2
32+
export GIT_REPO_VERSION=2.13.6
33+
export PRE_COMPILE_TAG=
34+
35+
# you can export GIT_XML2_UPSTREAM=git@xx:yy/xml2.git use your mirror
36+
if [[ "$GIT_XML2_UPSTREAM" != "" ]] ;then
37+
export GIT_UPSTREAM="$GIT_XML2_UPSTREAM"
38+
else
39+
export GIT_UPSTREAM=https://github.com/GNOME/libxml2.git
40+
fi

do-compile/android/cmake-compatible.sh

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,16 @@
2222

2323
set -e
2424

25+
CMAKE_OTHER_OPTS="$1"
26+
CMAKE_COMPONENT="$2"
27+
2528
THIS_DIR=$(DIRNAME=$(dirname "$0"); cd "$DIRNAME"; pwd)
2629
cd "$THIS_DIR"
27-
CMAKE_OTHER_FLAGS="$1"
2830

2931
echo "----------------------"
3032
echo "[*] configurate $LIB_NAME"
31-
echo "[*] other cmake flags: $CMAKE_OTHER_FLAGS"
33+
echo "[*] cmake options: $CMAKE_OTHER_OPTS"
34+
echo "[*] cmake component: $CMAKE_COMPONENT"
3235
echo "----------------------"
3336

3437
build="${MR_BUILD_SOURCE}/camke_wksp"
@@ -49,11 +52,20 @@ cmake -S ${MR_BUILD_SOURCE} \
4952
-DANDROID_STL=c++_shared \
5053
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=${MR_BUILD_PREFIX}/libs/${MR_ANDROID_ABI} \
5154
-DCMAKE_TOOLCHAIN_FILE=${MR_ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake \
52-
${CMAKE_OTHER_FLAGS}
55+
${CMAKE_OTHER_OPTS}
5356

5457
echo "----------------------"
5558
echo "[*] compile $LIB_NAME"
5659
echo "----------------------"
5760

58-
cmake --build . --target $CMAKE_TARGET_NAME --config Release -- CODE_SIGNING_ALLOWED=NO
59-
cmake --install .
61+
if [[ "$MR_DEBUG" == "debug" ]];then
62+
cmake --build . --target $CMAKE_TARGET_NAME --config Debug -- CODE_SIGNING_ALLOWED=NO
63+
else
64+
cmake --build . --target $CMAKE_TARGET_NAME --config Release -- CODE_SIGNING_ALLOWED=NO
65+
fi
66+
67+
if [[ -n $CMAKE_COMPONENT ]];then
68+
cmake --install . --component "$CMAKE_COMPONENT"
69+
else
70+
cmake --install .
71+
fi

do-compile/android/xml2.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#! /usr/bin/env bash
2+
#
3+
# Copyright (C) 2021 Matt Reach<qianlongxu@gmail.com>
4+
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
# call common cmake build shell
18+
./cmake-compatible.sh "-DBUILD_SHARED_LIBS=0 -DLIBXML2_WITH_PROGRAMS=0 -DLIBXML2_WITH_ZLIB=1 -DLIBXML2_WITH_PYTHON=0 -DLIBXML2_WITH_ICONV=0" "development"

do-compile/apple/cmake-compatible.sh

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,14 @@
2020
# https://stackoverflow.com/questions/27660048/cmake-check-if-mac-os-x-use-apple-or-apple
2121

2222

23-
set -e
24-
2523
THIS_DIR=$(DIRNAME=$(dirname "$0"); cd "$DIRNAME"; pwd)
2624
cd "$THIS_DIR"
27-
CMAKE_OTHER_FLAGS="$1"
28-
25+
CMAKE_OTHER_OPTS="$1"
26+
CMAKE_COMPONENT="$2"
2927
echo "----------------------"
3028
echo "[*] configurate $LIB_NAME"
31-
echo "[*] other cmake flags: $CMAKE_OTHER_FLAGS"
29+
echo "[*] cmake options: $CMAKE_OTHER_OPTS"
30+
echo "[*] cmake component: $CMAKE_COMPONENT"
3231
echo "----------------------"
3332

3433
build="${MR_BUILD_SOURCE}/camke_wksp"
@@ -66,7 +65,7 @@ cmake -S ${MR_BUILD_SOURCE} \
6665
-DCMAKE_INSTALL_PREFIX=${MR_BUILD_PREFIX} \
6766
-DCMAKE_TOOLCHAIN_FILE="${MR_SHELL_TOOLS_DIR}/ios.toolchain.cmake" \
6867
-DPLATFORM=$pf \
69-
${CMAKE_OTHER_FLAGS} \
68+
${CMAKE_OTHER_OPTS} \
7069
-GXcode
7170

7271
echo "----------------------"
@@ -79,4 +78,8 @@ else
7978
cmake --build . --target $CMAKE_TARGET_NAME --config Release -- CODE_SIGNING_ALLOWED=NO
8079
fi
8180

82-
cmake --install .
81+
if [[ -n $CMAKE_COMPONENT ]];then
82+
cmake --install . --component "$CMAKE_COMPONENT"
83+
else
84+
cmake --install .
85+
fi

do-compile/apple/xml2.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#! /usr/bin/env bash
2+
#
3+
# Copyright (C) 2021 Matt Reach<qianlongxu@gmail.com>
4+
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
# call common cmake build shell
18+
./cmake-compatible.sh "-DBUILD_SHARED_LIBS=0 -DLIBXML2_WITH_PROGRAMS=0 -DLIBXML2_WITH_ZLIB=1 -DLIBXML2_WITH_PYTHON=0 -DLIBXML2_WITH_ICONV=1"

0 commit comments

Comments
 (0)