libretro-super/libretro-install.sh
Sam Stuewe 97e3980357 Clean up platform assignment
By using ``case`` instead of giant ``if…elif…else`` statements, you can save a lot of space and power. In this commit, I favored using permissive conditions (using *value*), but I'm not sure this is even necessary.
2013-07-19 21:12:01 -05:00

57 lines
1.1 KiB
Bash
Executable File

#!/bin/sh
if [ "$platform" ]; then
case "$platform" in
win) DIST_DIR=win;;
osx) DIST_DIR=osx;;
*) DIST_DIR=unix;;
esac
else
case "$(uname)" in
*BSD*) DIST_DIR=bsd;;
*Darwin*) DIST_DIR=osx;;
*mingw*|*MINGW*) DIST_DIR=win;;
*) DIST_DIR=unix;;
esac
fi
# BSDs don't have readlink -f
read_link()
{
TARGET_FILE="$1"
cd $(dirname "$TARGET_FILE")
TARGET_FILE=$(basename "$TARGET_FILE")
while [ -L "$TARGET_FILE" ]
do
TARGET_FILE=$(readlink "$TARGET_FILE")
cd $(dirname "$TARGET_FILE")
TARGET_FILE=$(basename "$TARGET_FILE")
done
PHYS_DIR=$(pwd -P)
RESULT="$PHYS_DIR/$TARGET_FILE"
echo $RESULT
}
SCRIPT=$(read_link "$0")
BASE_DIR=$(dirname "$SCRIPT")
RARCH_DIR="$BASE_DIR/dist"
RARCH_DIST_DIR="$RARCH_DIR/$DIST_DIR"
if [ -z "$1" ]; then
LIBRETRO_DIR="/usr/local/lib/libretro"
else
LIBRETRO_DIR="$1"
fi
for lib in "$RARCH_DIST_DIR"/*
do
if [ -f "$lib" ]; then
install -v -m644 "$lib" "$LIBRETRO_DIR"
else
echo "Library $lib not found, skipping ..."
fi
done