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

Share your advanced PureBasic knowledge/code with the community.
rodego
User
User
Posts: 10
Joined: Thu Nov 08, 2007 7:39 pm

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

Post 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!)
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

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

Post by Fred »

Insteresting ! We have also a (big) bash to compile and ship every versions, but it's through virtual machines and ssh.
KGB_X
User
User
Posts: 63
Joined: Tue Apr 22, 2008 6:06 pm
Location: No(r)way

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

Post by KGB_X »

thank you this is making my projects much easier to work with :D
Post Reply