#! /bin/bash
lib_path=$(cd `dirname $0`; pwd)
if [ ! -d "${lib_path}/lib/" ];then
mkdir ${lib_path}/lib
echo "Please copy libxml2.so to the folder ${lib_path}/lib."
exit 1
fi
if [ ! -f "${lib_path}/lib/libxml2.so" ];then
echo "Please copy libxml2.so to the folder ${lib_path}/lib."
exit 1
fi
cd ${lib_path}/libxml_c
if [ -f "Makefile" ];then
make clean
fi
if [[ -n $(uname -a|grep "aarch64") ]];then
./configure
else
./configure --cc="aarch64-linux-gnu-gcc" --cross-prefix="aarch64-linux-gnu-"
fi
make
cd ${lib_path}/
echo start build xml_ffi
cjpm build -V
cp ${lib_path}/lib/*.so ${lib_path}/target/release/xml_ffi/
echo end build xml_ffi