#------------------------------------------------------------------------ # Helper script to create a MacOS X application from a binary. # # Daan Leijen and Arthur Baars. # # Copyright (c) 2003,2004 Daan Leijen, Arthur Baars #------------------------------------------------------------------------ # $Id: macosx-app-template,v 1.4 2005/04/29 14:16:51 dleijen Exp $ arg="" # variables program="" verbose="no" if test -z "$rezcomp"; then rezcomp="/Developer/Tools/Rez -t APPL Carbon.r $rezfile -o" fi # Parse command-line arguments while : ; do # put optional argument in the $arg variable case "$1" in -*=*) arg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; *) arg= ;; esac # match on the arguments case "$1" in "") break;; -\?|--help) echo "usage:" echo " macosx-app [options] " echo "" echo "options: [defaults in brackets]" echo " --help | -? show this information" echo " --verbose | -v be verbose" echo "" exit 1;; -v|--verbose) verbose="yes";; -*) echo "error: Unknown option \"$1\". Use \"--help\" to show valid options." 1>&2 echo "" 1>&2 exit 2;; *) if test "$program"; then echo "error: [program] is specified twice. Use \"--help\" to show valid options." 1>&2 echo ""1>&2 exit 2 fi program="$1";; esac shift done # default program if test -z "$program"; then echo "error: you need to specify a program. Use \"--help\" to show valid options." 1>&2 echo "" 1>&2 exit 2 fi # show when verbose is true. show() { if test "$verbose" = "yes"; then echo "$1" fi } # link with default resources if test "$rezcomp"; then show "creating resource:" show " > $rezcomp $program" $rezcomp $program fi # create a bundle bundle="$program.app/Contents" # create bundle directories show "creating app directories:" show " - $program.app" mkdir -p $program.app show " - $bundle" mkdir -p $bundle show " - $bundle/MacOS" mkdir -p $bundle/MacOS show " - $bundle/Resources" mkdir -p $bundle/Resources # standard files if test "$rezfile"; then cp -f ${rezfile}src $bundle/Resources/$program.rsrc fi cp -f $program $bundle/MacOS/ # no icons for now :-( # cp -f $wxwinsrc/mac/wxmac.icns $bundle/Resources/wxmac.icns # package info show "creating package info:" show " - $bundle/PkgInfo" echo -n "APPL????" > $bundle/PgkInfo #sed -e "s/IDENTIFIER/`echo $programdir | sed 's,/,.,g'`/" \ # -e "s/EXECUTABLE/$program/" \ # -e "s/VERSION/$majorversion.$minorversion.$release/" $wxwinsrc/mac/Info.plist.in > $bundle/Info.plist # program identifier & version curdir="`pwd`" identifier="`echo $curdir | sed 's|/|.|g'`" programversion="$version" # create program information file cat > $bundle/Info.plist << EOF CFBundleInfoDictionaryVersion 6.0 CFBundleIdentifier org.wxwindows.$identifier CFBundleDevelopmentRegion English CFBundleExecutable $program CFBundleIconFile wxmac.icns CFBundleName $program CFBundlePackageType APPL CFBundleSignature ???? CFBundleVersion $programversion CFBundleShortVersionString $programversion CFBundleGetInfoString $program version $programversion, (c) 2004 wxWidgets CFBundleLongVersionString $programversion, (c) 2004 wxWidgets NSHumanReadableCopyright Copyright 2004 wxWidgets LSRequiresCarbon CSResourcesFileMapped EOF show "done." show ""