This is probably a lot more than you are asking for but have been meaning to put this up for a while, for storage as much as anything else. I usually start a project by making it fully releasable from the start.
Here is a script that I created to build a releasable project you will need to do a little work to decipher what's going on. A little hint 'ProjectFolder' should be the name of the folder that your project resides in, and 'ProjectName' should be the released name of the project.
version.txt is a plain text file with 0.00.00 in it for the first build. the source to increment the version number is below, it is incremented when I build the PC version and the MacAutobuilder just reads it. Thank Brucey for the auto-incrementing version number code :-) Use code in main.bmx to extract the version number from the embedded file...
MacAutobuilder.sh
echo Getting the serial number
export VER=`cat /Volumes/ProjectFolder/media/version.txt`
echo $VER
echo Building Intel Source
'/Applications/BlitzMax/bin/bmk' makeapp -b bah.appstub -r -a -t gui '/Volumes/ProjectFolder/ProjectName.bmx'
echo Making Universal Binary
lipo -create /Volumes/ProjectFolder/ProjectName.app/Contents/MacOS/ProjectName /Volumes/ProjectFolder/ProjectName.app/Contents/MacOS/ProjectName-ppc -output /Volumes/ProjectFolder/ProjectName.app/Contents/MacOS/ProjectName-uni
echo Removing Intel and PPC executables.
rm -v -f /Volumes/ProjectFolder/ProjectName.app/Contents/MacOS/ProjectName
rm -v -f /Volumes/ProjectFolder/ProjectName.app/Contents/MacOS/ProjectName-ppc
mv -v /Volumes/ProjectFolder/ProjectName.app/Contents/MacOS/ProjectName-uni /Volumes/ProjectFolder/ProjectName.app/Contents/MacOS/ProjectName
echo Restoring icons
cp '/Volumes/ProjectFolder/ProjectName.icns' '/Volumes/ProjectFolder/ProjectName.app/Contents/Resources/ProjectName.icns'
echo Making package
'/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker' --doc '/Volumes/ProjectFolder/ProjectName.pmdoc' --out '/Users/nbrown/Desktop/ProjectName.pkg'
echo Making a disk image...
hdiutil create '/Users/nbrown/Desktop/ProjectName-scratch.dmg' -volname ProjectName-$VER -type UDIF -megabytes 50 -fs HFS+
echo Mounting the disk image...
MYDEV=`hdiutil attach '/Users/nbrown/Desktop/ProjectName-scratch.dmg' | tail -n 1 | awk '{print $1'}`
echo Device is $MYDEV
echo Copying ProjectName package to the disk image...
ditto -X '/Users/nbrown/Desktop/ProjectName.pkg' /Volumes/ProjectName-$VER/ProjectName.pkg
echo Unmounting the disk image...
hdiutil detach $MYDEV
echo Compressing the disk image...
hdiutil convert '/Users/nbrown/Desktop/ProjectName-scratch.dmg' -format UDZO -o /Users/nbrown/Desktop/nsm0-$VER-mac
echo removing scratch file.
rm -f '/Users/nbrown/Desktop/ProjectName-scratch.dmg'
echo COMPLETE
UpdateVersion.bmx
SuperStrict
Framework BRL.Stream
Import BaH.Format
Import brl.retro
DebugLog CommandLine()
Local filename:String = CommandLine() '"../media/version.txt"
Local formatter:TFormatter = TFormatter.Create("%d.%02d.%02d")
Local s:String = LoadString(filename)
Local digits:String[] = s.Split(".")
Local major:Int = digits[0].ToInt()
Local minor:Int = digits[1].ToInt()
Local micro:Int = digits[2].ToInt()
micro:+ 1
If micro > 99 Then
micro = 0
minor:+ 1
If minor > 99 Then
minor = 0
major:+ 1
End If
End If
formatter.IntArg(major).IntArg(minor).IntArg(micro)
' update text
SaveString(formatter.Format(), filename)
End
Function CommandLine$()
Local CmdLine:String
For Local e:String = EachIn AppArgs[1..] 'start from the second element of the appargs array
CmdLine:+ e +" " 'add each element to the CmdLine string
Next
Return CmdLine
End Function
main.bmx
Incbin "media/version.txt"
Global version:String ' = "0.00.00"
Local p:Byte Ptr = IncbinPtr("media/version.txt")
Local bytes:Int = IncbinLen("media/version.txt")
version = String.FromBytes(p,bytes)
DebugLog "String.FromBytes(p,bytes="+version
|