NCBI C Toolkit Cross Reference

C/make/make-mac-bundle


  1 #!/bin/sh
  2 # $Id: make-mac-bundle,v 1.1 2008/08/29 16:18:49 ucko Exp $
  3 #
  4 # Helper script to convert graphical Mac OS X applications into
  5 # bundles, so they can run properly under 10.5 (which has dropped
  6 # support for simply adding suitable resource forks).  Based on Greg
  7 # Ercolano's tips: http://www.seriss.com/people/erco/fltk/#MacBundle.
  8 
  9 set -e
 10 
 11 for app in "$@"; do
 12     if test -x $app  &&  file -b $app | grep -q Mach-O; then
 13         :
 14     else
 15         echo "Skipping $app, which appears not to be a Mac(h) executable."
 16         continue
 17     fi
 18 
 19     base=`basename "$app"`
 20     tmptree=$app.app.tmp$$
 21     trap "rm -r $tmptree" 0 1 2 15
 22     mkdir $tmptree
 23     mkdir $tmptree/Contents
 24     mkdir $tmptree/Contents/Resources
 25     mkdir $tmptree/Contents/MacOS
 26     echo APPLncbi > $tmptree/Contents/PkgInfo
 27     case $base in
 28         ddv      ) version=1.0   ;;
 29         entrez2  ) version=9.5   ;;
 30         *sequin* ) version=8.20  ;;
 31         udv      ) version=1.0.2 ;;
 32         *        ) version=0.0   ;;
 33     esac
 34     cat >$tmptree/Contents/Info.plist <<EOF
 35 <?xml version="1.0" encoding="UTF-8"?>
 36 <!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
 37 <plist version="0.9">
 38     <dict>
 39         <key>CFBundleName</key>
 40         <string>`basename $app`</string>
 41         <key>CFBundlePackageType</key>
 42         <string>APPL</string>
 43         <key>CFBundleVersion</key>
 44         <string>59</string>
 45         <key>CFBundleShortVersionString</key>
 46         <string>$version</string>
 47 EOF
 48     for d in "`dirname \"$0\"`"/xCode/ncbicguiapp "$NCBI"; do
 49         if test -r $d/ncbi.icns; then
 50             cp $d/ncbi.icns $tmptree/Contents/Resources/ncbi.icns
 51             cat >>$tmptree/Contents/Info.plist <<EOF
 52         <key>CFBundleIconFile</key>
 53         <string>ncbi.icns</string>
 54 EOF
 55             continue
 56         fi
 57     done
 58     cat >>$tmptree/Contents/Info.plist <<EOF
 59         <key>CFBundleSignature</key>
 60         <string>none</string>
 61     </dict>
 62 </plist>
 63 EOF
 64     if test -e $app.app; then
 65         mv $app.app $app.app.old  ||  true
 66     fi
 67     mv $tmptree $app.app
 68     trap "" 0 1 2 15
 69     mv $app $app.app/Contents/MacOS/$base
 70     cat > $app <<EOF
 71 #!/bin/sh
 72 exec "\`dirname \\"\$0\\"\`/$base.app/Contents/MacOS/$base" "\$@"
 73 EOF
 74     chmod +x $app
 75     rm -rf $app.app.old
 76 done

source navigation ]   [ diff markup ]   [ identifier search ]   [ freetext search ]   [ file search ]  

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.