#!/bin/bash
# Open Hexagon shell script, originally written by Ethan "flibitijibibo" Lee

# Move to script's directory
cd "$(dirname "$(readlink -f "$(command -v "$0")")")"

# Get the kernel/architecture information
UNAME=`uname`
ARCH=`uname -m`

# Set the libpath and pick the proper binary
if [ "$UNAME" == "Darwin" ]; then
	export DYLD_LIBRARY_PATH=./osx/:$DYLD_LIBRARY_PATH
	./osx/openhexagon.osx $@
elif [ "$UNAME" == "Linux" ]; then
	if [ "$ARCH" == "x86_64" ]; then
		export LD_LIBRARY_PATH=./x86_64/:$LD_LIBRARY_PATH
		./x86_64/openhexagon.x86_64 $@
	else
		export LD_LIBRARY_PATH=:./x86/:$LD_LIBRARY_PATH
		./x86/openhexagon.x86 $@
	fi
fi
