Skip to content

Instantly share code, notes, and snippets.

@boxmein
Last active August 29, 2015 14:04
Show Gist options
  • Save boxmein/4491a03f08b93337208e to your computer and use it in GitHub Desktop.
Save boxmein/4491a03f08b93337208e to your computer and use it in GitHub Desktop.
A shell script to download all necessary libraries, and build simtr/The-Powder-Toy on Linux. Includes a Vagrantfile to run said Linux. (Runs 32-bit Debian Wheezy)
#!/bin/sh
# Run 'vagrant up' for a Linux box with all necessary tools to compile TPT.
# Note: does not yet work!
#
# Linux
#
echo "Preparing Linux build environment"
# install TPT dependencies and general build tools
sudo apt-get -y install python build-essential libsdl1.2-dev libbz2-dev zlib1g-dev liblua5.1.0-dev git scons libfftw3-dev
#
# Windows
#
echo "Preparing Windows build environment"
# Windows deps
sudo apt-get -y install mingw32 mingw32-binutils mingw32-runtime wget
# Build the cross-platform libraries (thanks jacob1)
wget -qO cross-libs.sh https://dl.dropboxusercontent.com/u/43784416/PowderToy/cross-libs.sh?dl=1
sudo chmod a+x ./cross-libs.sh
./cross-libs.sh make bzip2 fftw lua lua52 pthread regex sdl zlib
sudo ./cross-libs.sh make install bzip2 fftw lua lua52 pthread regex sdl zlib
#
# OSX
#
echo "Preparing OSX build environment"
# Add various OSX related packages
sudo add-apt-repository ppa:flosoft/ppa
sudo apt-get update
sudo apt-get install -y libssl0.9.8
sudo apt-get install -y ccache-lipo apple-x86-odcctools apple-x86-gcc apple-uni-sdk-10.5 apple-uni-framework-sdl
# Get the OSX pack (includes cross-platform library compilation AND the .app skeleton)
wget -qO maccross.zip https://dl.dropboxusercontent.com/u/43784416/PowderToy/maccrosscompile.zip
unzip maccross.zip -d maccross
# build Lua and FFTW for OSX
sudo chmod a+x ./maccross/cross-libs.sh
./maccross/cross-libs.sh make lua fftw
sudo ./maccross/cross-libs.sh make install lua fftw
# And viola!
# (spelled wrong on purpose)
echo "OSX build environment set! Find the .app skeleton inside the Vagrant machine here: $(realpath ./maccross)"
echo "-----"
echo "Successfully set up all tools! Run the following to build TPT:"
echo "$ vagrant ssh"
echo "$ cd /vagrant"
echo "$ scons (and add one of the following: --win, --lin, --mac)"
# -*- mode: ruby -*-
# vi: set ft=ruby :
# un-capitalized because github uses asciibetical order
# Runs a 32-bit Debian Wheezy virtual machine to compile TPT.
# To launch said VM and compile TPT, run "vagrant up". That's it!
# It's magic!
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# we want debian!
config.vm.box = "puphpet/debian75-x32"
# run build_tpt.sh while setting up the machine
config.vm.provision :shell, path: "build_tpt.sh"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment