#!/bin/bash
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"

# Install APR
cd 3rdparty
rm -rf apr-1.7.6
tar -zxvf apr-1.7.6.tar.gz
cd apr-1.7.6
./configure
make
make install



# Install APR-UTIL
cd "$SCRIPT_DIR/3rdparty"
rm -rf apr-util-1.6.3
tar -zxvf apr-util-1.6.3.tar.gz
cd apr-util-1.6.3
./configure --with-apr=../apr-1.7.6
make
make install

# Install mxml-4.0.4.zip
sudo apt-get install libmxml-dev

#cd "$SCRIPT_DIR/3rdparty"
#rm -rf mxml-4.0.4
#unzip mxml-4.0.4.zip
#cd mxml-4.0.4
#./configure
#make
#make install

# 编译 SDK
cd "$SCRIPT_DIR/3rdparty"
rm -rf cos-c-sdk-v5-master
unzip cos-c-sdk-v5-master.zip
cd cos-c-sdk-v5-master
cmake .
make
make install

# 安装
cd "$SCRIPT_DIR"
rm -rf build
mkdir build
cd build
cmake ..
make
cp -f libtencent_cos_sdk.so ../target
