Create a MacOS X App Bundle Using MacPorts: Difference between revisions
Jump to navigation
Jump to search
(Switch to using Platypus to create the app bundle's template) |
(streamline and generally improve the content) |
||
Line 8: | Line 8: | ||
* Follow [http://www.macports.org/install.php MacPorts' installation instructions]. | * Follow [http://www.macports.org/install.php MacPorts' installation instructions]. | ||
* MacPorts has good support for Octave. A list of what MacPorts has available for Octave is [http://www.macports.org/ports.php?by=name&substr=octave here]. To install the most recent version of Octave, type {{Codeline|<nowiki>sudo port install octave-devel</nowiki>}} at the Terminal's command line. Octave has many dependencies which will be downloaded and installed prior to Octave. The entire installation process can take a few hours. | * MacPorts has good support for Octave. A list of what MacPorts has available for Octave is [http://www.macports.org/ports.php?by=name&substr=octave here]. To install the most recent version of Octave, type {{Codeline|<nowiki>sudo port install octave-devel</nowiki>}} at the Terminal's command line. Octave has many dependencies which will be downloaded and installed prior to Octave. The entire installation process can take a few hours. | ||
MacPorts has historically been rather good a maintaining their Octave portfiles. However, there are times when the maintainer fall behind. If the current version of the [http://www.macports.org/ports.php?by=name&substr=octave-devel octave-devel] port isn't current, it will be necessary to produce a local portfile. | |||
==Install an Octave Port== | ==Install an Octave Port== | ||
Line 19: | Line 21: | ||
Where {{Codeline|<nowiki><portname></nowiki>}} is the name of the port. For example, the name of the port for Octave 3.6.x is {{Codeline|<nowiki>octave36</nowiki>}}. | Where {{Codeline|<nowiki><portname></nowiki>}} is the name of the port. For example, the name of the port for Octave 3.6.x is {{Codeline|<nowiki>octave36</nowiki>}}. | ||
All of Octave's dependencies will also be Installed. MacPorts' Octave port includes the non-GPL | All of Octave's dependencies will also be Installed. MacPorts' Octave port includes the non-GPL [http://glaros.dtc.umn.edu/gkhome/views/metis METIS]. To avoid license violations do not bundle Metis with Octave and then distribute to others. A second motivation to use a local portfile is that the portfiles for the 3.4.x and 3.6.x series did not include all dependencies for the {{Codeline|<nowiki>print</nowiki>}} feature. The missing dependencies are [http://www.macports.org/ports.php?by=name&substr=epstool epstool], [http://www.macports.org/ports.php?by=name&substr=pstoedit pstoedit], and [http://www.macports.org/ports.php?by=name&substr=transfig transfig]. | ||
Once an Octave port is installed the command below may be used to determine / verify the port's version and variants. | Once an Octave port is installed the command below may be used to determine / verify the port's version and variants. | ||
Line 27: | Line 29: | ||
=Create the MacOS X App Bundle= | =Create the MacOS X App Bundle= | ||
==Produce a DMG | There are effectively four tasks needed to produce the App bundle. First, Octave and all its build and run-time dependencies must be extracted from the MacPorts installation. Second a App bundle template for running a shell script is required. This may be done using the MacOS X developer tool, Platypus. Third, the shell script which the App bundle runs is needed. This script will be used to launch the [http://en.wikipedia.org/wiki/Terminal_(OS_X) MacOS X Terminal app]. This script is referred to as the ''App's shell script''. Finally, a script for setting up the shell environment for Octave and running Octave is required. This script is referred to as the ''Octave shell script''. | ||
==Produce a DMG for Octave and its dependencies== | |||
MacPorts provides a feature for [http://guide.macports.org/index.html#using.binaries.binary-packages producing binary packages] with standalone binary installers that are precompiled; they do not require MacPorts on the target system. Binary files created with MacPorts may be either .pkg (Mac OS X Installer Packages), or RPM (RPM Package Manager) format. MacPorts may also process a .pkg package into a Mac OS X .dmg disk image file. The port command shown below will create a DMG type binary installer for the Octave port and all its dependencies. | MacPorts provides a feature for [http://guide.macports.org/index.html#using.binaries.binary-packages producing binary packages] with standalone binary installers that are precompiled; they do not require MacPorts on the target system. Binary files created with MacPorts may be either .pkg (Mac OS X Installer Packages), or RPM (RPM Package Manager) format. MacPorts may also process a .pkg package into a Mac OS X .dmg disk image file. The port command shown below will create a DMG type binary installer for the Octave port and all its dependencies. | ||
Line 38: | Line 42: | ||
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. | 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 Platypus to produce a template for the App bundle== | ==Use Platypus to produce a template for the App bundle== | ||
Line 49: | Line 47: | ||
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. | 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. | ||
A shell script intended to | A shell script intended to launch a [http://en.wikipedia.org/wiki/Terminal_(OS_X) MacOS X Terminal] and run Octave will be used as the basis for the MacOS X App bundle. | ||
* Run the Platypus application. | |||
* Import Octave's Icon. | |||
* Set the "Script Type" to "Shell" | |||
* Specify the "Script Path". | |||
** Click on the "Select" button and select the [[MacOS_X_App_Launcher_Script|App shell script]] used to launch the Terminal app, {{Codeline|<nowiki>script</nowiki>}}. | |||
* Set the "Output" to "None". | |||
* Specify App Name (Octave-3.7.0). | |||
* Click the "Create" button. | |||
* Save the App bundle template to the location of your choice. | |||
==Populate the App Bundle== | |||
* Save the original MacPorts installation. | |||
** {{Codeline|<nowiki>sudo mv /opt /opt-save</nowiki>}} | |||
* Install the MacPorts Octave DMG. This will create a new {{Codeline|<nowiki>/opt</nowiki>}} directory containing Octave and all its build and run-time dependencies. | |||
* Place the [[MacOS_X_App_Octave_Shell_Script| Octave shell script]] in the same directory as the App bundle template created using Platypus. | |||
* Populare the App bundle by running the script below from the directory containing the Platypus App bundle template and the [[MacOS_X_App_Octave_Shell_Script| Octave shell script]]. | |||
<nowiki>#! /bin/sh | <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=" | MACPORTS_PREFIX="/opt/local/" | ||
cp -pRf ${MACPORTS_PREFIX} ${FULLAPP}/Contents/Resources/. | cp -pRf ${MACPORTS_PREFIX} ${FULLAPP}/Contents/Resources/. | ||
rm ${FULLAPP}/Contents/Resources/bin/octave | rm ${FULLAPP}/Contents/Resources/bin/octave | ||
cp | cp octave ${FULLAPP}/Contents/Resources/bin/. | ||
cp | mkdir ${FULLAPP}/Contents/Resources/Applications | ||
cp /Applications/MacPorts/AquaTerm.app ${FULLAPP}/Contents/Resources/Applications/.</nowiki> | |||
* Restore the original MacPorts installation. | |||
<nowiki>sudo rm -r /opt | |||
sudo mv /opt-save /opt</nowiki> | |||
=Problems and Restrictions of the App Bundle= | =Problems and Restrictions of the App Bundle= |