[Cmake] Mac OS X .app bundle making script - double-clickable mac application

paul. poppenhe at umich.edu
Thu Jun 10 10:12:07 EDT 2004


In case anyone was looking for a way to bundle up the binary file they 
just made with cmake on Mac OS X, here you go. Naturally you need to 
provide the binary, Info.plist, project.icns file, and all the 
frameworks. This is just the maker. Quick and dirty, i'm a new cmake 
user who didn't realize cmake didn't have one!

- paul

#!/bin/sh
#make a .app with the given commands

#$1 is the name of the package to make (x.app, MacOS/x, x.icns, etc)
#$2 is the Mach-O binary
#$3 is the Info.plist (does not have to be called info.plist, will be 
renamed)
#$4 is the binary.icns file
#$5 $6 ... and on are paths to .frameworks (or .dylib files) that need 
to be bundled with the app

if [ "x$4" == "x" ]; then
{
	echo "usage:"
	echo "APPNAME bundle-name binary-file plist-file icns-file 
{frameworks}"
}
else
{
	BUNDLE=$1
	mkdir ${BUNDLE}.app
	mkdir ${BUNDLE}.app/Contents
	mkdir ${BUNDLE}.app/Contents/MacOS
	mkdir ${BUNDLE}.app/Contents/Resources
	mkdir ${BUNDLE}.app/Contents/Frameworks
	#mkdir ${BUNDLE}.app/Contents/PlugIns
	cp $2 ${BUNDLE}.app/Contents/MacOS/
	cp $3 ${BUNDLE}.app/Contents/Info.plist
	cp $4 ${BUNDLE}.app/Contents/Resources/
	#copy frameworks
	while [ $# -ge 5 ]; do
	#[ "x$5" == "x" ]; do
	{
		cp -RP $5 ${BUNDLE}.app/Contents/Frameworks/
		shift
	}
	done
}
fi

#2004.06.04 - Copyright Paul Oppenheim. All rights reserved.
# free to use under the "MIT License":
# Permission is hereby granted, free of charge, to any person obtaining 
a copy of this software and associated documentation files (the 
"Software"), to deal in the Software without restriction, including 
without limitation the rights to use, copy, modify, merge, publish, 
distribute, sublicense, and/or sell copies of the Software, and to 
permit persons to whom the Software is furnished to do so, subject to 
the following conditions:
#The above copyright notice and this permission notice shall be 
included in all copies or substantial portions of the Software.
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.



More information about the Cmake mailing list