Skip to content

Instantly share code, notes, and snippets.

@vizanto
Created January 21, 2013 08:23
Show Gist options
  • Save vizanto/4584531 to your computer and use it in GitHub Desktop.
Save vizanto/4584531 to your computer and use it in GitHub Desktop.
wrapinstall-haxe.sh
#!/bin/bash
cd "$TOOLDIR"
echo == Creating environment.sh ==
echo "
export HAXEPATH=\"`echo $TOOLDIR/haxe-*`\"
export NEKOPATH=\"`echo $TOOLDIR/neko-*`\"
"'
export HAXE_LIBRARY_PATH="$HAXEPATH/std"
export LD_LIBRARY_PATH="$NEKOPATH"
export PATH="$NEKOPATH:$PATH"
' > environment.sh
cat environment.sh
source environment.sh;
if [ -f $HAXEPATH/haxe ]; then
echo == Creating haxe wrapper scripts with correct Environment ==
cat environment.sh > haxe;
echo '"$HAXEPATH/haxe" $@' >> haxe
chmod +x haxe
cat haxe
cat environment.sh > haxedoc;
echo '"$HAXEPATH/haxedoc" $@' >> haxedoc
chmod +x haxedoc
cat haxedoc
cat environment.sh > haxelib;
echo '"$HAXEPATH/haxelib" $@' >> haxelib
chmod +x haxelib
cat haxelib
echo == Removing 32-bit haxelib and haxedoc ==
cd "$HAXEPATH"
rm -f haxelib haxedoc
echo == Recompiling haxelib with 64-bit neko ==
cd std/tools/haxelib/
"$TOOLDIR/haxe" haxelib.hxml
mv haxelib "$HAXEPATH"
echo == Recompiling haxedoc with 64-bit neko ==
cd ../haxedoc/
"$TOOLDIR/haxe" haxedoc.hxml
mv haxedoc "$HAXEPATH"
echo == Setting up haxelib ==
cd "$TOOLDIR"
mkdir -p "../haxelib"
./haxelib setup "`cd \"$TOOLDIR/../haxelib\"; pwd`"
fi;
if [ -f $NEKOPATH/neko ]; then
echo == Creating neko wrapper scripts with correct Environment ==
cd "$TOOLDIR"
cat environment.sh > neko;
echo '"$NEKOPATH/neko" $@' >> neko
chmod +x neko
cat neko
cat environment.sh > nekoc;
echo '"$NEKOPATH/nekoc" $@' >> nekoc
chmod +x nekoc
cat nekoc
cat environment.sh > nekoml;
echo '"$NEKOPATH/nekoml" $@' >> nekoml
chmod +x nekoml
cat nekoml
cat environment.sh > nekotools;
echo '"$NEKOPATH/nekotools" $@' >> nekotools
chmod +x nekotools
cat nekotools
fi;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment