#!/bin/bash

pd=`pwd -P`

jhome="$HOME/jaguarlite"

/bin/mkdir -p $jhome/bin
/bin/mkdir -p $jhome/example
/bin/mkdir -p $jhome/lib
/bin/mkdir -p $jhome/include

/bin/cp -f bin/*  $jhome/bin/
/bin/cp -f lib/*  $jhome/lib/
/bin/cp -f include/*  $jhome/include/
/bin/cp -f example/*  $jhome/example

cd $jhome/lib
ln -s libcrypto.so.3 libcrypto.so
ln -s libssl.so.3 libssl.so

    pv2=`python --version 2>&1|awk '{print $2}'|cut -d. -f2`
    python_ver="${pv}.${pv2}"
    if [[ $python_ver = "3.9" ]]; then
        ln -s jaguarpy-python3.9.23.so jaguarpy.so
    elif [[ $python_ver = "3.10" ]]; then
        ln -s jaguarpy-python3.10.12.so jaguarpy.so
    elif [[ $python_ver = "3.11" ]]; then
        ln -s jaguarpy-python3.11.13.so jaguarpy.so
    elif [[ $python_ver = "3.12" ]]; then
        ln -s jaguarpy-python3.12.3.so jaguarpy.so
    elif [[ $python_ver = "3.13" ]]; then
        ln -s jaguarpy-python3.13.7.so jaguarpy.so
    elif [[ $python_ver = "3.14" ]]; then
        ln -s jaguarpy-python3.14.0.so jaguarpy.so
    else
        echo "Your Python version $python_ver is not supported in JaguarDB client library"
    fi


cd $pd

echo "JaguarLite has been installed in $jhome"

