Skip to content

Instantly share code, notes, and snippets.

@jgranick

jgranick/install-haxe.sh

Last active Apr 17, 2019
Embed
What would you like to do?
Install Haxe using a development release for 64-bit Linux
#!/bin/sh
# Install Haxe using a development release for 64-bit Linux
HAXE_VERSION=haxe_2019-04-01_development_bbfe5ac
NEKO_VERSION=2.2.0
if [ "$1" = "y" -o "$1" = "-y" ]; then
echo "Do you want to install Haxe $HAXE_VERSION and Neko $NEKO_VERSION? (y/n) y"
RESP=y
else
read -p "Do you want to install Haxe $HAXE_VERSION and Neko $NEKO_VERSION? (y/n) " RESP
fi
if [ $RESP = "y" ]; then
if [ -n "$(command -v yum)" ]; then
echo ""
echo "---------------------------------------"
echo " Installing Dependencies"
echo "---------------------------------------"
sudo yum -y install wget
elif [ -n "$(command -v pacman)" ]; then
echo ""
echo "---------------------------------------"
echo " Installing Dependencies"
echo "---------------------------------------"
set -e
sudo pacman -S wget --noconfirm
elif [ -n "$(command -v apt-get)" ]; then
echo ""
echo "---------------------------------------"
echo " Removing Haxe (if installed)"
echo "---------------------------------------"
set +e
sudo apt-get remove haxe neko
set -e
fi
echo ""
echo "---------------------------------------"
echo " Downloading Neko $NEKO_VERSION (64-bit)"
echo "---------------------------------------"
wget -c http://nekovm.org/_media/neko-$NEKO_VERSION-linux64.tar.gz
echo ""
echo "---------------------------------------"
echo " Installing Neko $NEKO_VERSION"
echo "---------------------------------------"
# Extract and copy files to /usr/lib/neko
tar xvzf neko-$NEKO_VERSION-linux64.tar.gz
sudo rm -rf /usr/lib/neko
sudo mkdir -p /usr/local/lib/neko
sudo rm -rf /usr/local/lib/neko/neko
sudo rm -rf /usr/local/lib/neko/nekotools
sudo cp -r neko-$NEKO_VERSION-linux64/* /usr/local/lib/neko
# Add symlinks
sudo rm -rf /usr/bin/neko
sudo rm -rf /usr/bin/nekoc
sudo rm -rf /usr/bin/nekotools
sudo rm -rf /usr/lib/libneko.so
sudo rm -rf /usr/lib/libneko.so.2
sudo rm -rf /usr/lib/libneko.so.$NEKO_VERSION
sudo rm -rf /usr/local/bin/neko
sudo rm -rf /usr/local/bin/nekoc
sudo rm -rf /usr/local/bin/nekotools
sudo rm -rf /usr/local/lib/libneko.so
sudo rm -rf /usr/local/lib/libneko.so.2
sudo rm -rf /usr/local/lib/libneko.so.$NEKO_VERSION
sudo ln -s /usr/local/lib/neko/libneko.so.$NEKO_VERSION /usr/local/lib/libneko.so
sudo ln -s /usr/local/lib/neko/libneko.so.$NEKO_VERSION /usr/local/lib/libneko.so.2
sudo ln -s /usr/local/lib/neko/libneko.so.$NEKO_VERSION /usr/local/lib/libneko.so.$NEKO_VERSION
sudo ln -s /usr/local/lib/neko/libneko.so.$NEKO_VERSION /usr/lib/libneko.so
sudo ln -s /usr/local/lib/neko/libneko.so.$NEKO_VERSION /usr/lib/libneko.so.2
sudo ln -s /usr/local/lib/neko/libneko.so.$NEKO_VERSION /usr/lib/libneko.so.$NEKO_VERSION
sudo ln -s /usr/local/lib/neko/neko /usr/local/bin/neko
sudo ln -s /usr/local/lib/neko/nekoc /usr/local/bin/nekoc
sudo ln -s /usr/local/lib/neko/nekotools /usr/local/bin/nekotools
if [ -d "/usr/local/lib64" ]; then
set +e
sudo rm -rf /usr/local/lib64/libneko.so
sudo ln -s /usr/local/lib/neko/libneko.so /usr/local/lib64/libneko.so
set -e
fi
# Cleanup
rm -rf neko-$NEKO_VERSION-linux
rm neko-$NEKO_VERSION-linux64.tar.gz
# Install libgc, which is required for Neko
if [ -n "$(command -v yum)" ]; then
sudo yum -y install libgc
elif [ -n "$(command -v pacman)" ]; then
sudo pacman -S gc --noconfirm
elif [ -n "$(command -v zypper)" ]; then
sudo zypper --non-interactive install libgc1
else
sudo apt-get -y install libgc-dev
fi
if [ -d "/usr/local/lib64" ] && [ ! -f "/usr/local/lib64/libpcre.so.3" ]; then
set +e
sudo ln -s /usr/local/lib64/libpcre.so.1 /usr/local/lib64/libpcre.so.3
set -e
fi
echo ""
echo "---------------------------------------"
echo " Downloading Haxe $HAXE_VERSION (64-bit)"
echo "---------------------------------------"
wget -c http://hxbuilds.s3-website-us-east-1.amazonaws.com/builds/haxe/linux64/$HAXE_VERSION.tar.gz
echo ""
echo "---------------------------------------"
echo " Installing Haxe $HAXE_VERSION"
echo "---------------------------------------"
# Extract and copy files to /usr/lib/haxe
sudo mkdir -p /usr/local/lib/haxe
sudo rm -rf /usr/local/lib/haxe/haxe
sudo tar xvzf $HAXE_VERSION.tar.gz -C /usr/local/lib/haxe --strip-components=1
# Add symlinks
sudo rm -rf /usr/bin/haxe
sudo rm -rf /usr/bin/haxelib
sudo rm -rf /usr/bin/haxedoc
sudo rm -rf /usr/local/bin/haxe
sudo rm -rf /usr/local/bin/haxelib
sudo rm -rf /usr/local/bin/haxedoc
sudo ln -s /usr/local/lib/haxe/haxe /usr/local/bin/haxe
sudo ln -s /usr/local/lib/haxe/haxelib /usr/local/bin/haxelib
# Set up haxelib
mkdir -p ~/haxelib
haxelib setup ~/haxelib
# Cleanup
rm $HAXE_VERSION.tar.gz
fi
echo ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment