Last active
November 22, 2016 10:34
-
-
Save oscarcs/651f9ce28811784cbf84b4b7ac3d6b6b to your computer and use it in GitHub Desktop.
Haxe install script for Ubuntu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Adapted from https://gist.github.com/jgranick/8cc40e2e0f277146725f | |
# Assumes Ubuntu system. Update HAXE_VERSION and NEKO_VERSION with up-to-date releases. | |
HAXE_VERSION=3.3.0-rc.1 | |
NEKO_VERSION=2.1.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 apt-get)" ]; then | |
echo "" | |
echo "---------------------------------------" | |
echo " Removing Haxe (if installed)" | |
echo "---------------------------------------" | |
set +e | |
sudo apt-get remove haxe neko | |
set -e | |
fi | |
if [ `uname -m` = "x86_64" ]; then | |
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 mkdir -p /usr/lib/neko | |
sudo rm -rf /usr/lib/neko/neko | |
sudo rm -rf /usr/lib/neko/nekotools | |
sudo cp -r neko-$NEKO_VERSION-linux64/* /usr/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 ln -s /usr/lib/neko/libneko.so /usr/lib/libneko.so | |
sudo ln -s /usr/lib/neko/neko /usr/bin/neko | |
sudo ln -s /usr/lib/neko/nekoc /usr/bin/nekoc | |
sudo ln -s /usr/lib/neko/nekotools /usr/bin/nekotools | |
if [ -d "/usr/lib64" ]; then | |
set +e | |
sudo rm -rf /usr/lib64/libneko.so | |
sudo ln -s /usr/lib/neko/libneko.so /usr/lib64/libneko.so | |
set -e | |
fi | |
# Cleanup | |
rm -rf neko-$NEKO_VERSION-linux | |
rm neko-$NEKO_VERSION-linux64.tar.gz | |
fi | |
# Install libgc, which is required for Neko | |
if [ -n "$(command -v apt-get)" ]; then | |
sudo apt-get -y install libgc-dev | |
fi | |
if [ -d "/usr/lib64" ] && [ ! -f "/usr/lib64/libpcre.so.3" ]; then | |
set +e | |
sudo ln -s /usr/lib64/libpcre.so.1 /usr/lib64/libpcre.so.3 | |
set -e | |
fi | |
if [ `uname -m` = "x86_64" ]; then | |
echo "" | |
echo "---------------------------------------" | |
echo " Downloading Haxe $HAXE_VERSION (64-bit)" | |
echo "---------------------------------------" | |
wget -c http://haxe.org/website-content/downloads/$HAXE_VERSION/downloads/haxe-$HAXE_VERSION-linux64.tar.gz | |
echo "" | |
echo "---------------------------------------" | |
echo " Installing Haxe $HAXE_VERSION" | |
echo "---------------------------------------" | |
# Extract and copy files to /usr/lib/haxe | |
sudo mkdir -p /usr/lib/haxe | |
sudo rm -rf /usr/lib/haxe/haxe | |
sudo tar xvzf haxe-$HAXE_VERSION-linux64.tar.gz -C /usr/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 ln -s /usr/lib/haxe/haxe /usr/bin/haxe | |
sudo ln -s /usr/lib/haxe/haxelib /usr/bin/haxelib | |
# Set up haxelib | |
sudo mkdir -p /usr/lib/haxe/lib | |
sudo chmod -R 777 /usr/lib/haxe/lib | |
haxelib setup /usr/lib/haxe/lib | |
# Cleanup | |
rm haxe-$HAXE_VERSION-linux64.tar.gz | |
fi | |
fi | |
echo "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment