#!/bin/sh #------------------------------------------------------------------------ # Helper script to create a MacOS X application from a binary. # # Originaly created by Daan Leijen and Arthur Baars. # # Copyright (c) 2003,2004 Daan Leijen, Arthur Baars # Modified by Sean Seefried #------------------------------------------------------------------------ arg="" # variables program="" verbose="no" programversion="0.1" icon="" # 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";; -icon=*|--icon=*) icon="$arg";; -*) 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 } # 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 cp -f $program $bundle/MacOS/ # The icon cp -f $icon $bundle/Resources/$program.icns # package info show "creating package info:" show " - $bundle/PkgInfo" echo -n "APPL????" > $bundle/PkgInfo #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 $program.icns CFBundleName $program CFBundlePackageType APPL CFBundleSignature ???? CFBundleVersion $programversion CFBundleShortVersionString $programversion CFBundleGetInfoString $program $programversion, (c) Sean Seefried 2005 CFBundleLongVersionString $programversion NSHumanReadableCopyright Copyright (c) Sean Seefried 2005 LSRequiresCarbon CSResourcesFileMapped EOF show "done." show ""