| 1 | ################################################################################### | ||
| 2 | # Distribution Wx::Perl::Packager | ||
| 3 | # File Wx/Perl/Packager/MacOSX.pm | ||
| 4 | # Description: module for MacOSX specific handlers | ||
| 5 | # File Revision: $Id: MacOSX.pm 48 2010-04-25 00:26:34Z $ | ||
| 6 | # License: This program is free software; you can redistribute it and/or | ||
| 7 | # modify it under the same terms as Perl itself | ||
| 8 | # Copyright: Copyright (c) 2006 - 2010 Mark Dootson | ||
| 9 | ################################################################################### | ||
| 10 | package Wx::Perl::Packager::MacOSX; | ||
| 11 | use strict; | ||
| 12 | use warnings; | ||
| 13 | require Wx::Perl::Packager::Base; | ||
| 14 | use base qw( Wx::Perl::Packager::Base ); | ||
| 15 | |||
| 16 | our $VERSION = '0.27'; | ||
| 17 | |||
| 18 | sub new { | ||
| 19 | my $class = shift; | ||
| 20 | my $self = $class->SUPER::new( @_ ); | ||
| 21 | |||
| 22 | return $self; | ||
| 23 | } | ||
| 24 | |||
| 25 | sub config_modules { | ||
| 26 | my $self = shift; | ||
| 27 | |||
| 28 | $self->get_modules->{wx} = { filename => 'wxmain.bundle', loaded => 0, libref => undef, missing_fatal => 0 }; | ||
| 29 | |||
| 30 | $self->SUPER::config_modules; | ||
| 31 | } | ||
| 32 | |||
| 33 | sub config_system { | ||
| 34 | my $self = shift; | ||
| 35 | $self->set_so_module_suffix(''); # different linux dists symlink the .so libraries differently | ||
| 36 | # BAH. the loaders in Wx::Perl::Packager will look for | ||
| 37 | # modules ending in '.so' - If your modules get packaged | ||
| 38 | # differently, put the suffix here. | ||
| 39 | # e.g. if your module when packaged is | ||
| 40 | # wxlibs_gcc_base.so.0.6.0 | ||
| 41 | # you should $self->set_so_module_suffix('.0.6.0') | ||
| 42 | |||
| 43 | $self->set_relocate_pdkcheck(0); # relocate the Wx dlls during PDK Check - never necessary it seems | ||
| 44 | |||
| 45 | $self->set_relocate_packaged(1); # relocate the Wx Dlls when running as PerlApp | ||
| 46 | |||
| 47 | $self->set_relocate_wx_main(1); # if set_relocate_packaged is true and we find 'wxmain.dll' | ||
| 48 | # as a bound file, we load it as Wx.dll ( which it should be | ||
| 49 | # if user as bound it). This is the current fix for PerlApp | ||
| 50 | # segmentation fault on exit in Linux. Makes no difference | ||
| 51 | # in MSWin | ||
| 52 | |||
| 53 | $self->set_unlink_relocated(0); # delete the extracted files - ensures relocated are loaded | ||
| 54 | |||
| 55 | $self->set_loadmode_pdkcheck('standard'); # standard | nullsub | packload during pdkcheck | ||
| 56 | # standard uses normal Wx loading | ||
| 57 | # nullsub - no extensions are loaded | ||
| 58 | # packload - extensions are loaded by Wx::Perl::Packager | ||
| 59 | |||
| 60 | $self->set_loadmode_packaged('standard');# as above, when running as PerlApp | ||
| 61 | |||
| 62 | $self->set_loadcore_pdkcheck(0); # use DynaLoader to load wx modules listed by | ||
| 63 | # get_core_modules method (below)during pdkcheck | ||
| 64 | |||
| 65 | $self->set_loadcore_packaged(0); # as above, when running as PerlApp | ||
| 66 | |||
| 67 | $self->set_unload_loaded_core(0);# unload any librefs we loaded | ||
| 68 | # (uses DynaLoader in an END block ) | ||
| 69 | |||
| 70 | $self->set_unload_loaded_plugins(0); # unload plugins ( html, stc, gl .. etc) that are | ||
| 71 | # loaded via 'packload'. This seems to be necessary | ||
| 72 | # to ensure correct unloading order. | ||
| 73 | # Note - plugins are loaded using | ||
| 74 | # Wx::_load_plugin (not DynaLoader); | ||
| 75 | |||
| 76 | $self->set_pdkcheck_exit(0); # because of the current seg fault on exit in linux | ||
| 77 | # you can't package using PerlApp | ||
| 78 | # setting this to '1' calls 'exit(0)' after | ||
| 79 | # Wx has loaded during pdkcheck | ||
| 80 | # Drastic - but it is the current hack for this failure on linux | ||
| 81 | |||
| 82 | $self->set_pdkcheck_handle(1); # if true, use special handling during pdkcheck | ||
| 83 | # if false, treat as standard perl ( all other pdkcheck | ||
| 84 | # options are ignored) | ||
| 85 | |||
| 86 | $self->SUPER::config_system; | ||
| 87 | |||
| 88 | } | ||
| 89 | |||
| 90 | sub prepare_pdkcheck { | ||
| 91 | my $self = shift; | ||
| 92 | die qq(You must set DYLD_LIBRARY_PATH to include the path to wxWidgets dlls before running PerlApp) if not exists($ENV{DYLD_LIBRARY_PATH}); | ||
| 93 | # set PDK Check EXIT to correct value for OSX 10.4 ( osx v 8) | ||
| 94 | my $osxver = $self->get_osx_major_version; | ||
| 95 | if($osxver == 8) { | ||
| 96 | $self->set_pdkcheck_exit(1); | ||
| 97 | } | ||
| 98 | } | ||
| 99 | |||
| 100 | sub get_osx_major_version { | ||
| 101 | my $verstr = `uname -r`; | ||
| 102 | if( $verstr =~ /^(\d+)/ ) { | ||
| 103 | return $1; | ||
| 104 | } else { | ||
| 105 | die qq(Could not determine OSX version number); | ||
| 106 | } | ||
| 107 | } | ||
| 108 | |||
| 109 | |||
| 110 | 1; |