hunting/external/curl/build_curl.sh
2024-06-15 08:30:24 +08:00

76 lines
3.0 KiB
Bash
Executable File

#!/bin/bash
#编译curl库
platform=$1
CMAKE_SOURCE_DIR=$2
echo "Compile curl, platform = $platform, cmake source dir = $CMAKE_SOURCE_DIR."
export ROOT_PATH=$PWD
if [ ! -d "./curl-8.1.2" ];then
echo "tar zxvf curl-8.1.2.tar.gz"
tar zxvf curl-8.1.2.tar.gz
fi
if [ -d "./curl-8.1.2" ];then
cd ./curl-8.1.2
if [ ! -d "./build" ];then
echo "mkdir build"
mkdir build
fi
cd build
fi
exit
# tailor="no-asm no-async no-md2 no-mdc2 no-poly1305 no-blake2 \
# no-siphash no-sm3 no-rc2 no-rc4 no-rc5 no-idea no-aria no-bf no-cast \
# no-camellia no-chacha no-ec no-sm2 no-dso \
# no-err no-comp no-cms no-ts no-cmac no-ct \
# no-hw-padlock no-nextprotoneg no-psk no-rfc3779 no-srtp \
# no-cms no-dgram no-dynamic-engine no-ec no-ec2m no-filenames no-gost \
# no-afalgeng no-async no-autoalginit no-autoerrinit no-capieng"
tailor="--disable-dict --disable-file --disable-gopher \
--disable-imap --disable-ldap --disable-pop3 --disable-rtmp \
--disable-rtsp --disable-scp --disable-sftp --disable-smb \
--disable-telnet --disable-tftp --disable-ipv6"
if [ ! -f "./googletest-release-1.11.0/googlemock/lib/libgtest.a" ] || [ ! -f "./googletest-release-1.11.0/googlemock/lib/libgmock.a" ];then
echo "make curl"
case $platform in
"linux")
echo "==Compile linux."
# cmake -DCMAKE_TOOLCHAIN_FILE=$CMAKE_SOURCE_DIR/build/cmake/toolchain/linux.toolchain.cmake .
# make
# CFLAGS=-fPIC cmake .. \
# -DCMAKE_BUILD_TYPE=RELEASE \
# -DCMAKE_INSTALL_PREFIX=$ROOT_PATH \
# -DBUILD_SHARED_LIBS=OFF -DCURL_USE_OPENSSL=ON \
# -DCMAKE_PREFIX_PATH=../../../openssl/build \
# -DCMAKE_TOOLCHAIN_FILE=../../../../build/cmake/toolchain/linux.toolchain.cmake
# make libcurl
cd ../
./configure --without-zlib --prefix=$ROOT_PATH --with-ssl=/home/xiaojiazhu/project_codes/sifarsdk/external/openssl/build CC=gcc
make
# cmake --build .. --target install --config Release -j 8
;;
"sigmastart_333DE")
echo "==Compile sigmastart_333DE."
# cmake -DCMAKE_TOOLCHAIN_FILE=$CMAKE_SOURCE_DIR/333DE/build/cmake/toolchain/sigmastart_333DE.toolchain.cmake .
# CFLAGS=-fPIC cmake .. \
# -DCMAKE_BUILD_TYPE=RELEASE \
# -DCMAKE_INSTALL_PREFIX=$ROOT_PATH \
# -DBUILD_SHARED_LIBS=OFF -DCURL_USE_OPENSSL=ON \
# -DCMAKE_PREFIX_PATH=../../../openssl/build \
# -DCMAKE_TOOLCHAIN_FILE=../../../../333DE/build/cmake/toolchain/sigmastart_333DE.toolchain.cmake
# make libcurl
cd ../
# without openssl
# ./configure --prefix=$ROOT_PATH --host=arm-linux CC=arm-linux-gnueabihf-9.1.0-gcc --without-ssl
# with openssl
# ./configure --prefix=$ROOT_PATH --with-ssl=/home/xiaojiazhu/project_codes/sifarsdk/external/curl --host=arm-linux CC=arm-linux-gnueabihf-9.1.0-gcc
./configure $tailor --without-zlib --prefix=$ROOT_PATH --with-ssl=/home/xiaojiazhu/project_codes/sifarsdk/external/openssl/build --host=arm-linux CC=arm-linux-gnueabihf-9.1.0-gcc
make
;;
*)
echo "Compile gtest failed."
;;
esac
fi
cd $ROOT_PATH
echo "Exit build_curl.sh."