|
#!/bin/bash |
|
|
|
# >>>>>> HELPER FUNCTIONS |
|
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" |
|
} |
|
|
|
function echoWarn { |
|
echo -en "\e[38m\n" #set color |
|
echo "--------------------------------------------------------------------------------" |
|
echo -en $1 |
|
echo -en "\n--------------------------------------------------------------------------------\e[37m\n" |
|
} |
|
|
|
function echoFail { |
|
echo -en "\e[31m\n" #set color |
|
echo "--------------------------------------------------------------------------------" |
|
echo -en $1 |
|
echo -en "\n--------------------------------------------------------------------------------\e[37m\n" |
|
} |
|
|
|
function echoConfirm { |
|
echo -en "\n\e[35m------------------------------------------------------------------------------------\n" |
|
echo -en "$1 [y/n]:? " |
|
read REPLY |
|
echo -en "-----------------------------------------------------------------------------------\e[37m\n" |
|
} |
|
#END HELPER FUNCTIONS <<<<<<<< |
|
|
|
HAXE_VERSION='3.4.7' |
|
OPENFL_VERSION='8.4.0' |
|
LIME_VERSION='7.0.0' |
|
HAXEPATHCOMMAND="export HAXE_STD_PATH=/usr/lib/haxe/std" |
|
|
|
echoSection "Creating Development Directories: ~/Development/haxe" |
|
mkdir -p ~/Development/haxe/{dev,lib,source} |
|
|
|
echoConfirm "Would you like to download dependencies for building haxe from source?" |
|
if [[ $REPLY =~ ^[Yy]$ ]] |
|
then |
|
echoSection "Installing dependencies for haxe" |
|
sudo apt-get update |
|
# 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 libasound2-dev |
|
|
|
if grep -q "stretch" /etc/*-release;then |
|
sudo apt-get install -y default-libmysqlclient-dev |
|
else |
|
sudo apt-get install -y libmysqlclient-dev |
|
fi |
|
|
|
fi |
|
|
|
|
|
echoConfirm "Download and install neko" |
|
if [[ $REPLY =~ ^[Yy]$ ]] |
|
then |
|
echoSection "Downloading and installing neko" |
|
# get neko first |
|
cd ~/Development/haxe/source |
|
wget -c http://builds.openfl.org.s3-us-east-2.amazonaws.com/neko/neko-2.0.0-rpi.zip |
|
sudo mkdir -p /usr/lib/neko |
|
sudo rm -rf /usr/lib/neko/neko |
|
sudo rm -rf /usr/lib/neko/nekotools |
|
sudo unzip -o neko-2.0.0-rpi.zip -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/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 |
|
|
|
rm neko-2.0.0-rpi.zip |
|
fi |
|
|
|
echoConfirm "Download and compile haxe ${HAXE_VERSION} from source" |
|
if [[ $REPLY =~ ^[Yy]$ ]] |
|
then |
|
echoSection "Downloading and compiling haxe ${HAXE_VERSION} from source" |
|
#get haxe |
|
cd ~/Development/haxe/source |
|
git clone --recursive https://github.com/HaxeFoundation/haxe -b $HAXE_VERSION |
|
cd haxe |
|
make |
|
make tools |
|
sudo make install install_tools |
|
export HAXE_STD_PATH=/usr/lib/haxe/std |
|
fi |
|
|
|
if [ -z "$HAXE_STD_PATH" ]; then |
|
if grep -qs "HAXE_STD_PATH" ~/.bashrc |
|
then |
|
echo "good HAXE_STD_PATH is already exported in ~/.bashrc. It should be set on next login." |
|
else |
|
echoConfirm "For proper functioning, HAXE_STD_PATH should be set. |
|
Would you like to add HAXE_STD_PATH to .bashrc" |
|
if [[ $REPLY =~ ^[Yy]$ ]] |
|
then |
|
echo $HAXEPATHCOMMAND >> ~/.bashrc |
|
else |
|
echo -e "You will need to add the following export line to .bashrc or .profile script: \n $HAXEPATHCOMMAND" |
|
fi |
|
fi |
|
|
|
export HAXE_STD_PATH=/usr/lib/haxe/std |
|
fi |
|
|
|
echoConfirm "Setup haxelib and install packages" |
|
if [[ $REPLY =~ ^[Yy]$ ]] |
|
then |
|
echoSection "Setting up haxelib and install packages required for building lime" |
|
cd ~/Development/haxe/ |
|
haxelib setup ./lib |
|
haxelib install format |
|
haxelib install hxcpp |
|
haxelib install hxp |
|
haxelib install openfl |
|
haxelib run openfl setup |
|
fi |
|
|
|
echoConfirm "Create clean .hxcpp_config.xml file for Raspberry Pi and turn on hxcpp compilercache" |
|
if [[ $REPLY =~ ^[Yy]$ ]] |
|
then |
|
echoSection "Creating clean .hxcpp_config.xml file for Raspberry Pi and turning on hxcpp compilercache in /home/pi/Development/.hxcpp_compilecache" |
|
rm -f ~/.hxcpp_config.xml |
|
echo '<?xml version="1.0" encoding="utf-8"?> |
|
<xml> |
|
<section id="vars"> |
|
<set name="rpi" value="1"/> |
|
<set name="HXCPP_COMPILE_CACHE" value="/home/pi/Development/.hxcpp_compilecache"/> |
|
</section> |
|
<section id="exes"> |
|
</section> |
|
</xml>' >> ~/.hxcpp_config.xml |
|
fi |
|
|
|
echoConfirm "Create clean .lime/config.xml file for Raspberry Pi" |
|
if [[ $REPLY =~ ^[Yy]$ ]] |
|
then |
|
echoSection "Creating clean .lime/config.xml file for Raspberry Pi" |
|
rm -f ~/.lime/config.xml |
|
mkdir -p ~/.lime |
|
echo '<?xml version="1.0" encoding="utf-8"?> |
|
<xml> |
|
<section id="defines"> |
|
<set name="rpi" value="1"/> |
|
</section> |
|
</xml>' >> ~/.lime/config.xml |
|
fi |
|
|
|
echoConfirm "Get lime version $LIME_VERSION from git" |
|
if [[ $REPLY =~ ^[Yy]$ ]] |
|
then |
|
echoSection "Get lime version $LIME_VERSION from git" |
|
cd ~/Development/haxe/dev/ |
|
git clone --recursive https://github.com/openfl/lime -b $LIME_VERSION |
|
haxelib dev lime lime |
|
fi |
|
|
|
echoConfirm "Rebuild hxcpp" |
|
if [[ $REPLY =~ ^[Yy]$ ]] |
|
then |
|
|
|
echoSection "Rebuilding hxcpp for Raspberry Pi" |
|
haxelib run lime rebuild hxcpp linux -rpi -v |
|
haxelib run lime rebuild hxcpp linux -rpi -static -v |
|
fi |
|
|
|
echoConfirm "Rebuild Lime" |
|
if [[ $REPLY =~ ^[Yy]$ ]] |
|
then |
|
echoSection "Rebuilding Lime tools and Lime for Raspberry Pi" |
|
lime rebuild tools linux -rpi -v |
|
lime rebuild lime linux -rpi -v |
|
fi |
|
|
|
echoSection "Now get version $OPENFL_VERSION of openfl that works with version $LIME_VERSION of lime" |
|
haxelib install openfl $OPENFL_VERSION |
|
haxelib set openfl $OPENFL_VERSION |
|
|
|
echoSection "All Done. You should now be able to compile an openfl project" |
|
lime -v |
|
openfl -v |
I'm having the following error in a raspberry pi 3
I tried a couple of scripts:
install_haxe_rpi.sh
andinstall_openfl/sh
This error appear in two places for me, when using the scripts trying to execute this line:
lime rebuild hxcpp linux -rpi -v
and later trying to test or build a openfl project
At some point I was able to not have the errors by using this fix you mention here
https://community.haxe.org/t/solved-raspberry-pi-setup-issue/1111/3
Even with the fix I was not able to compile, but I think is a different issue, this because the error was related to the "project.xml" or wrong parameters.
Anyway, I rolled back to try again and the error persist (it's showing again and I'm not able to fix it).
Can you point me in the right direction?