#https://github.com/GTAmodding/re3/wiki/Building-on-Linux
#https://github.com/GTAmodding/re3/tree/miami/
glibc="$(ldd --version | awk '/ldd/{print $NF}')"
#
#INSTALLING CMAKE 3.21 IF YOU ALREADY HAVE THIS VERSION OR NEWER THEN COMMENT THE NEXT STEPS
###CMAKE 3.21 START HERE###########
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null
sudo apt-add-repository 'deb https://apt.kitware.com/ubuntu/ bionic main'
sudo apt-get update
####CMAKE 3.21 END HERE##########
sudo apt install cmake git python3-pip libgl1-mesa-dev
git clone --recursive -b miami https://github.com/GTAmodding/re3.git reVC
sudo pip3 install conan
cd reVC
conan export vendor/librw librw/master@
mkdir build
cd build
conan install .. reVC/master@ -if build -o reVC:audio=openal -o librw:platform=gl3 -o librw:gl3_gfxlib=glfw --build missing -s reVC:build_type=RelWithDebInfo -s librw:build_type=RelWithDebInfo
conan build .. -if build -bf build -pf package
strip build/reVC/src/reVC
cp build/reVC/src/reVC ../gamefiles/
cd ../gamefiles
7za a -mx -r ../gta.vice.city.re3_x86_64_GLIBC_"$glibc".7z
echo "RE3 VICE CITY GIT VERSION for GTA VICE CITY COMPILED AND COMPRESSED WITH THE FILENAME gta.vice.city.re3_x86_64_GIT_VERSION_GLIBC_"$glibc".7z"
