Instantly share code, notes, and snippets.

What would you like to do?
function echoSection {
echo -en "\e[33m\n" #set color
echo "--------------------------------------------------------------------------------"
echo "--"
echo "-- " $1
echo "--"
echo -en "--------------------------------------------------------------------------------\e[37m\n"
function echoLine {
echo -en "\e[33m\n" #set color
echo "-- " $1
echo -en "\e[37m\n"
function echoConfirm {
echo -en "\e[35m---------------------------------------------------------------------------------\n"
read -p "-- $1 [Y/n]? " -n 1 -r
echo -en "\n--------------------------------------------------------------------------------\e[37m\n"
echoSection "Creating Development Directories"
mkdir -p ~/Development/haxe/{dev,lib,source}
echoSection "Installing dependencies for haxe"
# get dependencies
sudo apt-get install -y libgc-dev libpcre3-dev
sudo apt-get install -y build-essential git cmake
sudo apt-get install -y libudev-dev
sudo apt-get install -y ocaml ocaml-native-compilers libpcre-ocaml-dev
sudo apt-get install -y sqlite3 libsqlite3-dev
sudo apt-get install -y libmysqlclient-dev
sudo apt-get install -y libasound2-dev
echoSection "Downloading and installing neko"
# get neko first
cd ~/Development/haxe/source
wget -c
sudo mkdir -p /usr/lib/neko
sudo rm -rf /usr/lib/neko/neko
sudo rm -rf /usr/lib/neko/nekotools
sudo unzip -o -d /usr/lib/neko/
sudo cp -r /usr/lib/neko/bin/* /usr/lib/neko
sudo rm -rf /usr/lib/neko/bin
sudo rm -rf /usr/bin/neko
sudo rm -rf /usr/bin/nekoc
sudo rm -rf /usr/bin/nekotools
sudo rm -rf /usr/lib/
sudo ln -s /usr/lib/neko/ /usr/lib/
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
echoSection "Downloading and compiling haxe 3.4.2 from source"
#get haxe
cd ~/Development/haxe/source
git clone --recursive -b 3.4.2
cd haxe
make tools
sudo make install install_tools
echoSection "Setting up haxelib and install packages"
cd ~/Development/haxe/
haxelib setup ./lib
haxelib install format
haxelib install hxcpp
haxelib install openfl
haxelib run openfl setup
echoSection "Create clean .hxcpp_config.xml file for Raspberry Pi"
rm -f ~/.hxcpp_config.xml
echo '<?xml version="1.0" encoding="utf-8"?>
<section id="vars">
<set name="rpi" value="1"/>
<set name="HXCPP_COMPILE_CACHE" value="/home/pi/Development/.hxcpp_compilecache"/>
<section id="exes">
</xml>' >> ~/.hxcpp_config.xml
echoSection "Getting latest lime"
cd ~/Development/haxe/dev/
git clone --recursive
haxelib dev lime lime
echoSection "Rebuilding hxcpp for Raspberry Pi"
lime rebuild hxcpp linux -rpi -v
lime rebuild hxcpp linux -rpi -static -v
echoSection "Rebuilding Lime tools and Lime for Raspberry Pi"
lime rebuild tools linux -rpi -v
lime rebuild lime linux -rpi -v
echoSection "Create clean .lime/config.xml file for Raspberry Pi"
rm -f ~/.lime/config.xml
echo '<?xml version="1.0" encoding="utf-8"?>
<section id="defines">
<set name="rpi" value="1"/>
</xml>' >> ~/.lime/config.xml
echoConfirm "Would you like to add some aliases for building and running openfl projects to ~/.bash_aliases?"
if [[ $REPLY =~ ^[Yy]$ ]]
if grep -q "ofbuild" ~/.bash_aliases; then
echoLine "It appears you already have these aliases. Try: gofl, ofbuild, oftest or ofrun"
echo "alias gofl='cd ~/Development/openfl'
alias ofbuild='openfl build linux -v'
alias oftest='openfl test linux -v'
alias ofrun='openfl run linux'" >> ~/.bash_aliases
source ~/.bash_aliases
echoLine "you now have the following aliases: gofl, ofbuild, oftest, ofrun"
echoConfirm "Would you like to check out the openfl-samples-raspberrypi samples?"
if [[ $REPLY =~ ^[Yy]$ ]]
mkdir -p ~/Development/openfl
cd ~/Development/openfl
git clone
echoSection "Now cd into one of the samples at ~/Development/openfl/openfl-samples-raspberrypi and run: openfl test linux"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment