Page 1 of 1

Bash script for fast compiling Linux & Windows 32\64 file

Posted: Wed Feb 09, 2011 9:02 pm
by rodego
Require: Bash, Wine 1.2+, any 64-bit Linux

Code: Select all

#!/bin/bash
# Script for PureBasic crosplatform build

# Path to PB compilers
# !!! CHANGE THIS PATH TO YOU PUREBASIC PATHES !!!
PureBasic_Path_Linux_x86="/home/jule/Soft/PureBasic/Linux86"
PureBasic_Path_Linux_x64="/home/jule/Soft/PureBasic/Linux64"
PureBasic_Path_Windows_x86="/home/jule/.wine/drive_c/Program Files (x86)/PureBasic"
PureBasic_Path_Windows_x64="/home/jule/.wine/drive_c/Program Files/PureBasic/Win64"

# Check arguments
if [ -n "$1" ]; then
{
	src=$1
}
else
{
	echo "Input source file name: "
	read src
}
fi

if [ -n "$2" ]; then
{
	executableName=$src
}
else
{
	echo "Input executable file name: "
	read executableName
}
fi

# Windows x86
echo
echo "Build Windows x86 binary"
wine "$PureBasic_Path_Windows_x86"/Compilers/pbcompiler.exe $src /exe $executableName.Win32.exe /QUIET

# Windows x64
echo
echo "Build Windows x64 binary"
wine64 "$PureBasic_Path_Windows_x64"/Compilers/pbcompiler.exe $src /exe $executableName.Win64.exe /QUIET

# Linux x86
echo
echo "Build Linux x86 binary"
export PUREBASIC_HOME=$PureBasic_Path_Linux_x86
export PATH=$PUREBASIC_HOME/compilers:$PATH
$PureBasic_Path_Linux_x86/compilers/pbcompiler $src -e $executableName.Lin86 -q

# Linux x64
echo
echo "Build Linux x64 binary"
export PUREBASIC_HOME=$PureBasic_Path_Linux_x64
export PATH=$PUREBASIC_HOME/compilers:$PATH
$PureBasic_Path_Linux_x64/compilers/pbcompiler $src -e $executableName.Lin64 -q


# Finish
echo
echo "******************************************"
echo "Done!"
Using:
./ScriptName SourceFileName ExecutableFileName

One command line for building Win32, Win64, Linux 32 and Linux 64 executables.

Feel Pure Power!)

Re: Bash script for fast compiling Linux & Windows 32\64 fil

Posted: Thu Feb 10, 2011 9:57 am
by Fred
Insteresting ! We have also a (big) bash to compile and ship every versions, but it's through virtual machines and ssh.

Re: Bash script for fast compiling Linux & Windows 32\64 fil

Posted: Thu Feb 10, 2011 1:38 pm
by KGB_X
thank you this is making my projects much easier to work with :D