Consolidated FNA and fnalibs setup scripts into one script

This commit is contained in:
Caleb Cornett 2018-10-08 23:50:49 -04:00
parent ace44c9081
commit 08b57d7fac
3 changed files with 80 additions and 53 deletions

100
getFNA.sh
View File

@ -1,33 +1,91 @@
#!/bin/sh #!/bin/bash
# getFNA # Program: getFNA
# Clones/pulls the latest FNA from Github for use as a project reference. # Author: Caleb Cornett
# Usage: ./getFNA # Usage: ./getFNA.sh
# Description: Quick and easy way to install a local copy of FNA and its native libraries.
git --version > /dev/null # Checks if git is installed
if [ $? -eq 1 ]; then function checkGit()
echo "ERROR: Git is required to pull FNA from the command line." {
echo "Either install git or download and unzip FNA manually." git --version > /dev/null 2>&1
exit 1 if [ ! $? -eq 0 ]; then
fi echo >&2 "ERROR: Git is not installed. Please install git to download FNA."
exit 1
fi
}
# Downloading # Clones FNA from the git master branch
if [ ! -d "FNA" ]; then function downloadFNA()
echo "Cloning FNA..." {
checkGit
echo "Downloading FNA..."
git clone https://github.com/FNA-XNA/FNA.git --recursive git clone https://github.com/FNA-XNA/FNA.git --recursive
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "Finished cloning!" echo "Finished downloading!"
else else
echo "ERROR: Unable to clone successfully. Maybe try again later?" echo >&2 "ERROR: Unable to download successfully. Maybe try again later?"
exit 1
fi fi
else }
echo "Pulling the latest git version of FNA..."
cd FNA # Pulls FNA from the git master branch
git pull --recurse-submodules function updateFNA()
{
checkGit
echo "Updating to the latest git version of FNA..."
git -C ./FNA pull --recurse-submodules
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "Finished updating!" echo "Finished updating!"
else else
echo "ERROR: Unable to update." echo >&2 "ERROR: Unable to update."
exit 1 exit 1
fi fi
}
# Downloads and extracts prepackaged archive of native libraries ("fnalibs")
function getLibs()
{
# Downloading
echo "Downloading latest fnalibs..."
curl http://fna.flibitijibibo.com/archive/fnalibs.tar.bz2 > fnalibs.tar.bz2
if [ $? -eq 0 ]; then
echo "Finished downloading!"
else
>&2 echo "ERROR: Unable to download successfully."
exit 1
fi
# Decompressing
echo "Decompressing fnalibs..."
mkdir -p fnalibs
tar xjC fnalibs -f fnalibs.tar.bz2
if [ $? -eq 0 ]; then
echo "Finished decompressing!"
rm fnalibs.tar.bz2
else
>&2 echo "ERROR: Unable to decompress successfully."
exit 1
fi
}
# FNA
if [ ! -d "FNA" ]; then
read -p "Download FNA (y/n)? " shouldDownload
if [[ $shouldDownload =~ ^[Yy]$ ]]; then
downloadFNA
fi
else
read -p "Update FNA (y/n)? " shouldUpdate
if [[ $shouldUpdate =~ ^[Yy]$ ]]; then
updateFNA
fi
fi
# FNALIBS
if [ ! -d "fnalibs" ]; then
read -p "Download fnalibs (y/n)? " shouldDownloadLibs
else
read -p "Redownload fnalibs (y/n)? " shouldDownloadLibs
fi
if [[ $shouldDownloadLibs =~ ^[Yy]$ ]]; then
getLibs
fi fi

View File

@ -1,32 +0,0 @@
#!/bin/sh
# getLibs
# Downloads the latest archive of pre-compiled native libraries for FNA,
# and installs them in /usr/local/lib so Mono can easily reference them.
# Usage: ./getLibs
# Downloading
echo "Downloading latest fnalibs..."
curl http://fna.flibitijibibo.com/archive/fnalibs.tar.bz2 > fnalibs.tar.bz2
if [ $? -eq 0 ]; then
echo "Finished downloading!"
else
echo "ERROR: Unable to download successfully. Maybe try again later?"
exit 1
fi
# Decompressing
echo "Decompressing fnalibs..."
mkdir fnalibs
tar xjC fnalibs -f fnalibs.tar.bz2
rm fnalibs.tar.bz2
echo "Finished decompressing!"
# Copying
echo "Copying fnalibs to /usr/local/libs..."
cp ./fnalibs/osx/* /usr/local/lib
if [ $? -eq 0 ]; then
echo "Successfully installed!"
else
echo "ERROR: Unable to copy fnalibs successfully."
exit 1
fi

View File

@ -1,4 +1,5 @@
#!/bin/bash #!/bin/bash
# buildEffects
# Compiles all .fx files found in the project's Content directory. # Compiles all .fx files found in the project's Content directory.
# Intended for usage with VS Code Build Tasks tooling. # Intended for usage with VS Code Build Tasks tooling.
# You may need to change the path to fxc.exe depending on your installation. # You may need to change the path to fxc.exe depending on your installation.