hunting/external/libconfig/build_libconfig.sh
2024-06-15 08:30:24 +08:00

29 lines
811 B
Bash
Executable File

#!/bin/bash
#compile libconfig to a library
platform=$1
COMPILE_HOST=$2
echo "Compile libconfig, platform = $platform."
echo "COMPILE_HOST = $COMPILE_HOST"
echo "Start to compile libconfig."
export ROOT_PATH=$PWD
if [ ! -d "./libconfig-1.7.3" ];then
echo "tar zxvf libconfig-1.7.3.tar.gz"
tar zxvf libconfig-1.7.3.tar.gz
fi
if [ ! -f "./libconfig-1.7.3/lib/.libs/libconfig++.a" ] || [ ! -f "./libconfig-1.7.3/lib/.libs/libconfig.a" ];then
echo "make libconfig++.a"
cd ./libconfig-1.7.3
case $platform in
"linux")
echo "==Compile linux."
./configure --disable-cxx --enable-static=yes
make
;;
*)
echo "==Compile cross compile. compiler = $COMPILE_HOST"
./configure --host=$COMPILE_HOST --disable-cxx --enable-static=yes
make
;;
esac
fi
cd $ROOT_PATH