Packaging For Mac OSX
Cava Packager will successfully package wxPerl applications for Windows, Linux and MacOSX.
Alternatively you can package your applications for MacOSX using Wx::Perl::Packager and ActiveState PerlApp. PAR::Packer cannot create .app executable packages and so is not usable at present. However, there are threads on the wxperl users mailing list that discuss packaging applications into a .app package using freely available methods.
To use Wx::Perl::Packager and PerlApp, you must include the Wx::Perl::Packager module at the top of your script before you use Wx:
use Wx::Perl::Packager 0.25;
use Wx;
.....
If your application uses threads, use the threads packages before Wx::Perl::Packager:
use threads;
use threads::shared;
use Wx::Perl::Packager 0.25;
use Wx;
.....
You should use Wx::Perl::Packager 0.25 as a minimum. The PPMs provided at this repository are specially built to support both distribution as PPMs and to support packaging within an app bundle Therefore, this packaging information applies only to the combination of ActiveState Perl, PerlApp and the PPMs from this repository.
For PerlApp packaging and testing, you must set the DYLD_LIBRARY_PATH to the wxWidgets dylib directory before running PerlApp. If you have installed the PPMs and the PDK in default locations, the two required commands will look like:
export DYLD_LIBRARY_PATH=/Users/YOU/Library/ActivePerl-5.10/lib/auto/Wx/wxPerl.app/Contents/Frameworks
/usr/bin/open "/Applications/ActiveState Perl Dev Kit/PerlApp.app"
Creating and testing the app will work because you have set the DYLD_LIBRARY_PATH environment variable. Once you have finished working in PerlApp, you will have to make some additions to your created .app bundle.
If your new app is located at mydir/myapp.app, the necessary procedure is
cd mydir.app/Contents
mkdir Frameworks
cp -p /Users/YOU/Library/ActivePerl-5.10/lib/auto/Wx/wxPerl.app/Contents/Frameworks/* Frameworks
Your app should now be distributable and run without the need for a DYLD_LIBRARY_PATH.
This works because the Wx .bundle files and wxWidgets dylib files in the PPM distribution are built to find dependencies relative to the executable that loads them. If you already have a different packaging method that relies on setting DYLD_LIBRARY_PATH at run time, then that too should work without problems.
Each time you rebuild your app bundle, you will have to recreate the Frameworks directory and re-copy the dylib files.
To reduce the size of your app bundle, you may wish to only include the dlls that your app bundle actually uses. You can use the wxWidgets dependency list to determine which wxWidgets dlls are necessary for your distribution.
Supporting 10.4 Tiger.
When run on MacOSX version 10.4 (both ppc and intel machines) your PerlApp application may cause error dialogs on exit ("Application Quit Unexpectedly"). You can fix this by binding the Wx.bundle file as wxmain.bundle. That is, bind
pathtoyourppminstall/site/lib/auto/Wx/Wx.bundle
as
wxmain.bundle
Minimum Version Support
The Wx PPMs from this repository contain Universal binaries that require a minimum MacOSX version of 10.4 (Tiger) or above so that will be the minimum possible target version for your app bundles too.