-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathluajit
executable file
·54 lines (48 loc) · 1.41 KB
/
luajit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
dirname=$(dirname $0)
pushd $dirname 1>/dev/null 2>/dev/null && absname=$(pwd) && popd 1>/dev/null 2>/dev/null
# uname <option>, where <option>:
# -s, --kernel-name print the kernel name
# -n, --nodename print the network node hostname
# -r, --kernel-release print the kernel release
# -v, --kernel-version print the kernel version
# -m, --machine print the machine hardware name
# -p, --processor print the processor type or "unknown"
# -i, --hardware-platform print the hardware platform or "unknown" - does not work on OSX
# -o, --operating-system print the operating system - does not work on OSX
OS=Unknown
ARCH=Unknown
SO=.Unknown
# Find ARCH by machine
case `uname -m` in
x86_64) ARCH=x64;;
i686) ARCH=x86;;
i386) ARCH=x86;;
arm*) ARCH=arm;;
esac
# Find OS by kernel name
case `uname -s` in
Linux)
OS=Linux
OSARCH=$OS/$ARCH
SO=.so
# this should go away at some point (-Wl,-rpath $ORIGN)
export LD_LIBRARY_PATH=$absname/:$absname/bin/$OSARCH/:$LD_LIBRARY_PATH
;;
Darwin)
OS=OSX
OSARCH=$OS # universal
SO=.dylib
# this should go away at some point (install_name_tool with @rpath and @executable path)
export DYLD_LIBRARY_PATH=$absname/bin/$OSARCH:$DYLD_LIBRARY_PATH
;;
*)
case `uname -o` in
Cygwin)
OS=Windows
SO=.dll
;;
esac
esac
export LUA_PATH="$absname/?.lua;$LUA_PATH"
"$dirname/bin/$OSARCH/luajit" "$@"