| 1 | ################################################################################### | ||
| 2 | # Distribution Wx::Perl::Packager | ||
| 3 | # File Wx/Perl/Packager/Linux.pm | ||
| 4 | # Description: module for Linux specific handlers | ||
| 5 | # File Revision: $Id: Linux.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::Linux; | ||
| 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 get_core_modules { (qw( base core adv )) } | ||
| 26 | |||
| 27 | sub cleanup_on_exit { | ||
| 28 | 1; | ||
| 29 | } | ||
| 30 | |||
| 31 | sub config_modules { | ||
| 32 | my $self = shift; | ||
| 33 | |||
| 34 | $self->get_modules->{wx} = { filename => 'wxmain.so', loaded => 0, libref => undef, missing_fatal => 0 }; | ||
| 35 | |||
| 36 | $self->SUPER::config_modules; | ||
| 37 | } | ||
| 38 | |||
| 39 | sub config_system { | ||
| 40 | my $self = shift; | ||
| 41 | |||
| 42 | $self->set_so_module_suffix('.0'); # different linux dists symlink the .so libraries differently | ||
| 43 | # BAH. the loaders in Wx::Perl::Packager will look for | ||
| 44 | # modules ending in '.so' - If your modules get packaged | ||
| 45 | # differently, put the suffix here. | ||
| 46 | # e.g. if your module when packaged is | ||
| 47 | # wxlibs_gcc_base.so.0.6.0 | ||
| 48 | # you should $self->set_so_module_suffix('.0.6.0') | ||
| 49 | |||
| 50 | $self->set_relocate_pdkcheck(0); # relocate the Wx dlls during PDK Check - never necessary it seems | ||
| 51 | |||
| 52 | $self->set_relocate_packaged(1); # relocate the Wx Dlls when running as PerlApp | ||
| 53 | |||
| 54 | $self->set_relocate_wx_main(1); # if set_relocate_packaged is true and we find 'wxmain.so' | ||
| 55 | # as a bound file, we load it as Wx.so ( which it should be | ||
| 56 | # if user as bound it). This is the current fix for PerlApp | ||
| 57 | # segmentation fault on exit in Linux. Makes no difference | ||
| 58 | # in MSWin | ||
| 59 | |||
| 60 | $self->set_unlink_relocated(1); # delete the extracted files - ensures relocated are loaded | ||
| 61 | |||
| 62 | $self->set_loadmode_pdkcheck('packload'); # standard | nullsub | packload during pdkcheck | ||
| 63 | # standard uses normal Wx loading | ||
| 64 | # nullsub - no extensions are loaded | ||
| 65 | # packload - extensions are loaded by Wx::Perl::Packager | ||
| 66 | |||
| 67 | $self->set_loadmode_packaged('packload');# as above, when running as PerlApp | ||
| 68 | |||
| 69 | $self->set_loadcore_pdkcheck(1); # use DynaLoader to load wx modules listed by | ||
| 70 | # get_core_modules method (below)during pdkcheck | ||
| 71 | |||
| 72 | $self->set_loadcore_packaged(1); # as above, when running as PerlApp | ||
| 73 | |||
| 74 | $self->set_unload_loaded_core(1);# unload any librefs we loaded | ||
| 75 | # (uses DynaLoader in an END block ) | ||
| 76 | |||
| 77 | $self->set_unload_loaded_plugins(1); # unload plugins ( html, stc, gl .. etc) that are | ||
| 78 | # loaded via 'packload'. This seems to be necessary | ||
| 79 | # to ensure correct unloading order. | ||
| 80 | # Note - plugins are loaded using | ||
| 81 | # Wx::_load_plugin (not DynaLoader); | ||
| 82 | |||
| 83 | $self->set_pdkcheck_exit(1); # because of the current fault on exit in linux | ||
| 84 | # you can't package using PerlApp | ||
| 85 | # this setting calls 'exit(0)' after | ||
| 86 | # Wx has loaded. | ||
| 87 | # Drastic - but it is the current hack for this failure on linux | ||
| 88 | |||
| 89 | $self->set_pdkcheck_handle(1); # if true, use special handling during pdkcheck | ||
| 90 | # if false, treat as standard perl ( all other pdkcheck | ||
| 91 | # options are ignored) | ||
| 92 | |||
| 93 | $self->SUPER::config_system; | ||
| 94 | } | ||
| 95 | |||
| 96 | |||
| 97 | 1; |