Base wrapping of types.
[SquirrelJME.git] / Formula / brew-install.sh
blob4fd4748106f73103ea4ad6b1d5eae38505be85d9
1 #!/bin/sh
2 # ---------------------------------------------------------------------------
3 # Multi-Phasic Applications: SquirrelJME
4 # Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
5 # Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
6 # ---------------------------------------------------------------------------
7 # SquirrelJME is under the Mozilla Public License Version 2.0.
8 # For more information see license.txt.
9 # ---------------------------------------------------------------------------
10 # Brew installation script
12 # Where is this script?
13 __exeDir="$(dirname -- "$0")"
15 # Output directory
16 __binDir="$(readlink -f -- "$1")"
17 __binBinTarget="$(readlink -f -- "$1")/squirreljme-standalone"
18 __binJarTarget="$(readlink -f -- "$1")/squirreljme-standalone.jar"
20 # Jar directory
21 __jarDir="$(readlink -f -- "$2")"
23 # Install only the first highest versioned Jar
24 mkdir -p "$__binDir"
25 find "$__jarDir" -type f | grep '\.jar$' | grep 'squirreljme-standalone' |
26 sort -r | head -n 1 | while read __jar
28 # Determine the base name of the JAR
29 __baseName="$(basename -- "$__jar")"
31 # Copy the JAR to the target
32 cp -vf "$__jar" "$__binJarTarget"
34 # Add script to launch it
35 cat << EOF > "$__binBinTarget"
36 #!/bin/sh
37 java -jar "\$(dirname -- "\$0")/squirreljme-standalone.jar" "\$@"
38 exit \$?
39 EOF
41 # Make it executable
42 chmod +x "$__binBinTarget"
43 done