Skip to content

Commit 45dc311

Browse files
committed
android xml2 use automake
1 parent ee73372 commit 45dc311

File tree

2 files changed

+63
-4
lines changed

2 files changed

+63
-4
lines changed

configs/libs/xml2.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@
2424

2525
export LIB_NAME='xml2'
2626
export LIPO_LIBS="libxml2"
27-
export LIB_DEPENDS_BIN="cmake"
28-
export CMAKE_TARGET_NAME=LibXml2
27+
export LIB_DEPENDS_BIN="autoconf automake libtool"
2928
export GIT_LOCAL_REPO=extra/xml2
3029
export GIT_COMMIT=v2.13.6
3130
export REPO_DIR=xml2

do-compile/android/xml2.sh

Lines changed: 62 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,65 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

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"
17+
# can't use cmake,because ios undeclared function 'getentropy'
18+
# https://gitlab.gnome.org/GNOME/libxml2/-/issues/774#note_2174500
19+
# ./cmake-compatible.sh "-DBUILD_SHARED_LIBS=0 -DLIBXML2_WITH_PROGRAMS=0 -DLIBXML2_WITH_ZLIB=1 -DLIBXML2_WITH_PYTHON=0 -DLIBXML2_WITH_ICONV=1"
20+
21+
22+
if [[ "$MR_DEBUG" == "debug" ]];then
23+
export MR_OTHER_CFLAGS="${MR_OTHER_CFLAGS} -g"
24+
else
25+
export MR_OTHER_CFLAGS="${MR_OTHER_CFLAGS} -Os"
26+
fi
27+
28+
CFLAGS="$MR_OTHER_CFLAGS"
29+
30+
# prepare build config
31+
CFG_FLAGS="--prefix=$MR_BUILD_PREFIX"
32+
# for cross compile
33+
if [[ $(uname -m) != "$MR_ARCH" || "$MR_FORCE_CROSS" ]];then
34+
echo "[*] cross compile, on $(uname -m) compile $MR_PLAT $MR_ARCH."
35+
# https://www.gnu.org/software/automake/manual/html_node/Cross_002dCompilation.html
36+
CFLAGS="$CFLAGS -isysroot $MR_SYS_ROOT"
37+
# aarch64-linux-android21
38+
CFG_FLAGS="$CFG_FLAGS --host=$MR_FF_ARCH-linux-android$MR_ANDROID_API --with-sysroot=$MR_SYS_ROOT"
39+
fi
40+
41+
echo "----------------------"
42+
echo "[*] configurate $LIB_NAME"
43+
echo "----------------------"
44+
45+
cd $MR_BUILD_SOURCE
46+
47+
echo
48+
echo "CC: $MR_TRIPLE_CC"
49+
echo "CFG_FLAGS: $CFG_FLAGS"
50+
echo "CFLAGS: $CFLAGS"
51+
echo
52+
53+
export CFLAGS="$CFLAGS"
54+
export LDFLAGS="$CFLAGS"
55+
56+
export CC="$MR_TRIPLE_CC"
57+
export CXX="$MR_TRIPLE_CXX"
58+
export AR="$MR_AR"
59+
export AS="$RM_AS"
60+
export RANLIB="$MR_RANLIB"
61+
62+
./autogen.sh \
63+
$CFG_FLAGS \
64+
--prefix=$MR_BUILD_PREFIX \
65+
--enable-static --disable-shared \
66+
--disable-fast-install \
67+
--without-python \
68+
--without-debug \
69+
--with-zlib \
70+
--with-pic \
71+
--without-lzma
72+
73+
echo "----------------------"
74+
echo "[*] compile $LIB_NAME"
75+
echo "----------------------"
76+
77+
make clean >/dev/null
78+
make install -j${MR_HOST_NPROC}

0 commit comments

Comments
 (0)