Editing Create a MacOS X App Bundle Using MacPorts
Jump to navigation
Jump to search
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
=Install MacPorts= | |||
[http://www.macports.org/ MacPorts], formerly called DarwinPorts, is a package management system that simplifies the installation of software on the MacOS X and Darwin operating systems. It is a free/open source software project to simplify installation of other free/open source software. Similar in aim and function to Fink and the BSDs' ports collections. | [http://www.macports.org/ MacPorts], formerly called DarwinPorts, is a package management system that simplifies the installation of software on the MacOS X and Darwin operating systems. It is a free/open source software project to simplify installation of other free/open source software. Similar in aim and function to Fink and the BSDs' ports collections. | ||
Line 19: | Line 9: | ||
* 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 | 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. For the remainder of this page, it is assume a local portfile is being used and that the port name is {{Codeline|<nowiki>octave-local</nowiki>}}. | ||
==Install an Octave Port== | |||
MacPorts | For the purpose of creating an App bundle using MacPorts, an Octave port must be installed. A standard MacPorts port or a local port may be used. For a local portfile it is first required that a [http://guide.macports.org/chunked/development.local-repositories.html local portfile repository be created] and the local portfile placed there. | ||
A [[Prototype MacPorts PortFile|prototype portfile]] | 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]. A [[Prototype MacPorts PortFile|prototype portfile]] which does not depend upon METIS and does depend upon epstool, pstoedit, and transfig has been prepared. | ||
After [http://guide.macports.org/chunked/development.local-repositories.html creating a local portfile repository] an Octave portfile may be added to the local repository using the commands below. | |||
<nowiki>mkdir -p ~/ports/math/octave-local | <nowiki>mkdir -p ~/ports/math/octave-local | ||
cp ~/Desktop/portfile ~/ports/math/octave-local</nowiki> | cp ~/Desktop/portfile ~/ports/math/octave-local</nowiki> | ||
This assumes the Octave portfile had been placed on the | This assumes the Octave portfile had been placed on the users Desktop, and that the local portfile repository is located in the users home folder and named {{Codeline|<nowiki>ports</nowiki>}}. After adding the portfile, the local repository must be indexed for MacPorts to recognize it. | ||
<nowiki>cd ~/ | <nowiki>cd ~/portfile | ||
portindex -f</nowiki> | portindex -f</nowiki> | ||
Once indexed the local Octave port may be installed. | Once indexed the local Octave port may be installed. | ||
<nowiki>sudo port install octave-local | <nowiki>sudo port install octave-local</nowiki> | ||
Once an Octave port is installed the command below may be used to determine / verify the version and variants of < | Once an Octave port is installed the command below may be used to determine / verify the version and variants of {{Codeline|<nowiki>octave-local</nowiki>}} which are installed. | ||
<nowiki>port installed octave-local</nowiki> | <nowiki>port installed octave-local</nowiki> | ||
= | =Create the MacOS X App Bundle= | ||
There | 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. | ||
<nowiki>sudo port mdmg octave- | <nowiki>sudo port mdmg octave-local</nowiki> | ||
If more than one version of Octave is installed, or if more than one variant of Octave has been installed, the version and variant should be included. | |||
<nowiki> | <nowiki>sudo port mdmg octave-local @<version>+variant1+variant2</nowiki> | ||
The DMG will be placed in the port's {{Codeline|<nowiki>work</nowiki>}} directory. If a local portfile is used, a symbolic link to the {{Codeline|<nowiki>work</nowiki>}} directory will be placed in the directory containing the portfile. In this instance the DMG can be found in {{Codeline|<nowiki>~/ports/math/octave-local/work</nowiki>}}. | |||
==Use Platypus to produce a template for the App bundle== | |||
[[File:Platypus.png|400px|thumb|right|Initial Platypus Dialog (click to enlarge)]] | |||
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 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. The itemize list below describes how to produce an App bundle template for Octave. Once this has been done, it the App bundle template must be populated with Octave and its dependencies. | |||
* Run the Platypus application. | |||
* Import Octave's [http://www.octave.org/wiki/index.php?title=File:Icon.png icon]. | |||
** The icon linked to above is a png with a transparent background. This feature is needed to produce a MacOS X application icon. | |||
** Using the icon linked to above the ''Icon Composer'' developers utility may be used to create a MacOS X icon. The Icon Composer is part of Xcode's developer's tools. Its home is {{Codeline|<nowiki>/Developer/Applications/Icon Composer.app</nowiki>}} | |||
* 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. | |||
* 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== | |||
To populate the App bundle template with Octave and its dependencies, from MacPorts, follow the itemize instructions below. | To populate the App bundle template with Octave and its dependencies, from MacPorts, follow the itemize instructions below. | ||
Line 118: | Line 73: | ||
<nowiki>sudo mv /opt /opt-save</nowiki> | <nowiki>sudo mv /opt /opt-save</nowiki> | ||
* Install the MacPorts Octave DMG, which as placed on the MacOS X Desktop. Installing the DMG will create a new {{Codeline|<nowiki>/opt</nowiki>}} directory containing Octave and all its build and run-time dependencies. To avoid conflict with the original MacPorts installation. | * Install the MacPorts Octave DMG, which as placed on the MacOS X Desktop. Installing the DMG will create a new {{Codeline|<nowiki>/opt</nowiki>}} directory containing Octave and all its build and run-time dependencies. To avoid conflict with the original MacPorts installation. | ||
* Place the [[MacOS_X_App_Octave_Shell_Script| Octave shell script]] in the same directory as the App bundle template created using | * Place the [[MacOS_X_App_Octave_Shell_Script| Octave shell script]] in the same directory as the App bundle template created using Platypus. | ||
* Populate the App bundle by running the script below from the directory containing the App bundle template and the [[MacOS_X_App_Octave_Shell_Script| Octave shell script]]. | * Populate 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="/opt/local/" | 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 octave ${FULLAPP}/Contents/Resources/bin/. | cp octave ${FULLAPP}/Contents/Resources/bin/. | ||
mkdir ${FULLAPP}/Contents/Resources/Applications | mkdir ${FULLAPP}/Contents/Resources/Applications | ||
Line 138: | Line 91: | ||
The Octave App bundle for MacOS X is now ready to run. | The Octave App bundle for MacOS X is now ready to run. | ||
= | =Problems and Restrictions of the App Bundle= | ||
* In the past, the App bundle did not run if there were spaces in its path. A solution to this problem has been applied, but is not fully tested. | * In the past, the App bundle did not run if there were spaces in its path. A solution to this problem has been applied, but is not fully tested. | ||
* The [[MacOS_X_App_Octave_Shell_Script|Octave shell script]] used to run Octave is designed to ensure that the bundled version of AquaTerm is used by Octave. This was done because binary incompatibilities have been encountered between the bundled Gnuplot and AquaTerm applications provided by other sources. If Octave/Gnuplot appear to have a problem producing a plot using AquaTerm, verify that Aquaterm is running. If it is not, then quit and relaunch the Octave App. If an Aquaterm application is running, please verify that it is the one bundled with Octave. | * The [[MacOS_X_App_Octave_Shell_Script|Octave shell script]] used to run Octave is designed to ensure that the bundled version of AquaTerm is used by Octave. This was done because binary incompatibilities have been encountered between the bundled Gnuplot and AquaTerm applications provided by other sources. If Octave/Gnuplot appear to have a problem producing a plot using AquaTerm, verify that Aquaterm is running. If it is not, then quit and relaunch the Octave App. If an Aquaterm application is running, please verify that it is the one bundled with Octave. | ||
* Executables built by MacPorts may include features specific to the MacOS X version the executables were build on. As a result, the Octave App bundle may ''not'' run on a different version of MacOS X. | * Executables built by MacPorts may include features specific to the MacOS X version the executables were build on. As a result, the Octave App bundle may ''not'' run on a different version of MacOS X. Results reported by some volunteers testing an App bundle are below. As some of the reported results are inconsistent, individuals are cautioned to not interpret these results as definitive. | ||
** An App built on a Core i7 MacBook Pro running MacOS 10.7 was found to run on; | |||
*** MacBook Air (Core 2 Duo) running MacOS 10.7 with both MacPorts and Fink installed. | |||
*** MacBook Pro (Core 2 Duo) running MacOS 10.6 with MacPorts installed. | |||
*** MacBook Pro (Core i7) running MacOS 10.7 with no MacPorts, and no Fink, installed. | |||
** The App bundle did not run on; | |||
*** MacBook Pro (Core i7) running MacOS 10.7 with no MacPorts, and no Fink, installed. | |||
*** MacMini (Core 2 Duo) running MacOS 10.6 with no MacPorts, and no Fink, installed. | |||
*** MacMini (Core 2 Duo) running MacOS 10.6 with Fink installed. The error encountered in this case is below. | |||
<nowiki>terminate called after throwing an instance of '__gnu_cxx::__concurrence_lock_error' | |||
what(): __gnu_cxx::__concurrence_lock_error</nowiki> | |||
* The {{Codeline|<nowiki>mex</nowiki>}} and {{Codeline|<nowiki>mkoctfile</nowiki>}} functions have not been tested. Although the App bundle does include a gcc toolset, some debugging is expected before this will work reliably. | * The {{Codeline|<nowiki>mex</nowiki>}} and {{Codeline|<nowiki>mkoctfile</nowiki>}} functions have not been tested. Although the App bundle does include a gcc toolset, some debugging is expected before this will work reliably. | ||
* When Octave is running, clicking on Octave's icon in the dock has no effect | * When Octave is running, clicking on Octave's icon in the dock has no effect. | ||
* Only one instance of the App may be run | * Only one instance of the App may be run. | ||
=Testing= | |||
Those interested in testing an App bundle can try this [https://dl.dropbox.com/u/14845154/Octave-X86_64-3.7.0%2B.dmg link]. The DMG is large (621.8 MB). I kindly ask those with patience to download it, to report results to bpabbott at mac.com. When reporting on your experience, please include; | |||
Those interested in testing an App bundle can try [https://dl.dropbox.com/u/14845154/Octave-X86_64-3.7.0% | |||
* The version of MacOS X you are running. | * The version of MacOS X you are running. | ||
** Note: This App bundle will ''not'' run on Mac OS 10.5 or earlier. | ** Note: This App bundle will ''not'' run on Mac OS 10.5 or earlier. | ||
* The Mac's processor (found under "About This Mac"). | * The Mac's processor (found under "About This Mac"). | ||
** Note: This App bundle will ''only'' run on 64 bit | ** Note: This App bundle will ''only'' run on Intel processors, and requires a 64 bit processor (X86_64). | ||
* Whether you have Fink, Homebrew, or MacPorts installed. | * Whether you have Fink, Homebrew, or MacPorts installed. | ||