Make retroarch-build.sh work outside of libretro-super.

This commit is contained in:
T. Joseph Carter 2015-02-23 02:47:45 -08:00
parent 1de23cf6f9
commit 830b522753

View File

@ -1,30 +1,21 @@
#! /usr/bin/env bash
# vim: set ts=3 sw=3 noet ft=sh : bash
. ./libretro-config.sh
SCRIPT="${0#./}"
BASE_DIR="${SCRIPT%/*}"
WORKDIR="$PWD"
# BSDs don't have readlink -f
read_link()
{
TARGET_FILE="$1"
cd $(dirname "$TARGET_FILE")
TARGET_FILE=$(basename "$TARGET_FILE")
if [ "$BASE_DIR" = "$SCRIPT" ]; then
BASE_DIR="$WORKDIR"
else
if [[ "$0" != /* ]]; then
# Make the path absolute
BASE_DIR="$WORKDIR/$BASE_DIR"
fi
fi
while [ -L "$TARGET_FILE" ]
do
TARGET_FILE=$(readlink "$TARGET_FILE")
cd $(dirname "$TARGET_FILE")
TARGET_FILE=$(basename "$TARGET_FILE")
done
. "$BASE_DIR/libretro-config.sh"
PHYS_DIR=$(pwd -P)
RESULT="$PHYS_DIR/$TARGET_FILE"
echo $RESULT
}
SCRIPT=$(read_link "$0")
echo "Script: $SCRIPT"
BASE_DIR=$(dirname "$SCRIPT")
if [ -z "$RARCH_DIST_DIR" ]; then
RARCH_DIR="$BASE_DIR/dist"
RARCH_DIST_DIR="$RARCH_DIR/$DIST_DIR"