mirror of
https://github.com/libretro/libretro-super
synced 2024-11-28 11:14:11 +00:00
97e3980357
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.
57 lines
1.1 KiB
Bash
Executable File
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
|
|
|