Skip to content

Commit 830b522

Browse files
T. Joseph CarterT. Joseph Carter
T. Joseph Carter
authored and
T. Joseph Carter
committed
Make retroarch-build.sh work outside of libretro-super.
1 parent 1de23cf commit 830b522

File tree

1 file changed

+13
-22
lines changed

1 file changed

+13
-22
lines changed

retroarch-build.sh

+13-22
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,21 @@
11
#! /usr/bin/env bash
22
# vim: set ts=3 sw=3 noet ft=sh : bash
33

4-
. ./libretro-config.sh
4+
SCRIPT="${0#./}"
5+
BASE_DIR="${SCRIPT%/*}"
6+
WORKDIR="$PWD"
57

6-
# BSDs don't have readlink -f
7-
read_link()
8-
{
9-
TARGET_FILE="$1"
10-
cd $(dirname "$TARGET_FILE")
11-
TARGET_FILE=$(basename "$TARGET_FILE")
12-
13-
while [ -L "$TARGET_FILE" ]
14-
do
15-
TARGET_FILE=$(readlink "$TARGET_FILE")
16-
cd $(dirname "$TARGET_FILE")
17-
TARGET_FILE=$(basename "$TARGET_FILE")
18-
done
19-
20-
PHYS_DIR=$(pwd -P)
21-
RESULT="$PHYS_DIR/$TARGET_FILE"
22-
echo $RESULT
23-
}
8+
if [ "$BASE_DIR" = "$SCRIPT" ]; then
9+
BASE_DIR="$WORKDIR"
10+
else
11+
if [[ "$0" != /* ]]; then
12+
# Make the path absolute
13+
BASE_DIR="$WORKDIR/$BASE_DIR"
14+
fi
15+
fi
16+
17+
. "$BASE_DIR/libretro-config.sh"
2418

25-
SCRIPT=$(read_link "$0")
26-
echo "Script: $SCRIPT"
27-
BASE_DIR=$(dirname "$SCRIPT")
2819
if [ -z "$RARCH_DIST_DIR" ]; then
2920
RARCH_DIR="$BASE_DIR/dist"
3021
RARCH_DIST_DIR="$RARCH_DIR/$DIST_DIR"

0 commit comments

Comments
 (0)