Create a MacOS X App Bundle Using MacPorts: Difference between revisions

Switch to using Platypus to create the app bundle's template
No edit summary
(Switch to using Platypus to create the app bundle's template)
Line 37: Line 37:
* {{Codeline|<nowiki>sudo port mdmg <portname> @<version>+variant1+variant2</nowiki>}}
* {{Codeline|<nowiki>sudo port mdmg <portname> @<version>+variant1+variant2</nowiki>}}


The DMG will be placed in a port's work directory.  If a local portfile is used, a symbolic link to the work directory will be placed in the directory containing the portfile.
The DMG will be placed in the port's work directory.  If a local portfile is used, a symbolic link to the work directory will be placed in the directory containing the portfile.


==Use the DMG to produce the App bundle==
==Down load the Boilerplate from Savannah==


* Download the App Boilerplate from Savannah's task tracker.
* Resources/Applications/AquaTerm.app
*# To be placed on Savannah soon.
* Resources/bin/octave
*# An itemized list of the Boilerplate's contents is below.
* Resources/script
*#* Boilerplate
 
*#** Contents
==Use Platypus to produce a template for the App bundle==
*#*** Info.plist
 
*#*** MacOS
To creating an application bundle for MacOS X the utility, [http://sveinbjorn.org/platypus Platypus], is used.  Platypus is a developer tool for the Mac OS X operating system which is intended to create native Mac OS X applications from interpreted scripts such as shell scripts or Perl, Ruby and Python programs.
*#**** Octave
 
*#*** Resources
A shell script intended to setup and run Octave will be used as the basis for the MacOS X App bundle.
*#**** appIcon.icns
 
*#**** AppSettings.plist
# Run Platypus
*#**** bin
# Import Octave's Icon
*#***** octave
# Set the "Script Type" to "Shell"
*#**** script
# Specify Script Path
* Create a copy of the DMG's contents
#* Click on the "Select" button and select the shell script used to launch the Terminal app, {{Codeline|<nowiki>script</nowiki>}}
*# Save the original MacPorts installation.
# Set "Output" to "None"
*#* {{Codeline|<nowiki>sudo mv /opt /opt-save</nowiki>}}
# Specify App Name (Octave-3.7.0)
*# Install the DMG.  This will create a new {{Codeline|<nowiki>/opt</nowiki>}} directory.
# Click the "Create" button
*# Move the new {{Codeline|<nowiki>/opt</nowiki>}} to the directory containing the App Boilerplate.
# Save the App bundle template to the location of your choice.
*# Restore the MacPorts installation
 
*#* {{Codeline|<nowiki>sudo mv /opt-save /opt</nowiki>}}
==Copy the contents of the MacPorts DMG to the App bundle Template==
* Create the App bundle using the shell script below. This script produces an App bundle named {{Codeline|<nowiki>Octave-3.7.0.app</nowiki>}}.
 
  <nowiki>#!/bin/sh -e
# Save the original MacPorts installation.
#* {{Codeline|<nowiki>sudo mv /opt /opt-save</nowiki>}}
# Install the DMG.  This will create a new {{Codeline|<nowiki>/opt</nowiki>}} directory.
# Move the the {{Codeline|<nowiki>/opt</nowiki>}} directory to the same location where {{Codeline|<nowiki>Boilerplate</nowiki>}} directory was placed.
# Restore the MacPorts installation
#* {{Codeline|<nowiki>sudo rm -r /opt</nowiki>}}
#* {{Codeline|<nowiki>sudo mv /opt-save /opt</nowiki>}}
 
==Populate the App bundle==
 
Use the script below to copy the contents of the Boilerplate and opt/local into the App bundle. This script assumes the App bundle is named {{Codeline|<nowiki>Octave-3.7.0.app</nowiki>}}.
 
  <nowiki>#! /bin/sh
VERSION=3.7.0
VERSION=3.7.0
APP=Octave
APP=Octave
FULLAPP="${APP}-${VERSION}.app"
FULLAPP="${APP}-${VERSION}.app"
MACPORTS_PREFIX="./opt/local"
MACPORTS_PREFIX="./opt/local/"
if [ -n "${FULLAPP}" ]; then
cp -pRf ${MACPORTS_PREFIX} ${FULLAPP}/Contents/Resources/.
  mkdir ${FULLAPP}
rm ${FULLAPP}/Contents/Resources/bin/octave
  mkdir ${FULLAPP}/Contents
cp -pRf Boilerplate/bin/ ${FULLAPP}/Contents/Resources/bin/.
  mkdir ${FULLAPP}/Contents/MacOS
cp -pRf Boilerplate/Applications ${FULLAPP}/Contents/Resources/.</nowiki>  
  cp -af ${MACPORTS_PREFIX} ${FULLAPP}/Contents/Resources
  ## Remove symbolic link to octave-$VERSION. This will be replaced by
  ## a shell script that is part of the Boilerplate
  rm ${FULLAPP}/Contents/Resources/bin/octave
fi
 
cp -pRf Boilerplate/. ${FULLAPP}/.
chmod 731 ${FULLAPP}</nowiki>


=Problems and Restrictions of the App Bundle=
=Problems and Restrictions of the App Bundle=
364

edits