Added libalien-wxwidgets-perl
[pkg-perl] / deb-src / libalien-wxwidgets-perl / libalien-wxwidgets-perl-0.50 / inc / My / Build / Any_wx_config_Bakefile.pm
1 package My::Build::Any_wx_config_Bakefile;
2
3 use strict;
4 our @ISA = qw(My::Build::Any_wx_config::Base);
5 use Config;
6
7 sub awx_wx_config_data {
8     my $self = shift;
9     return $self->{awx_data} if $self->{awx_data};
10
11     my %data;
12
13     foreach my $item ( qw(cxx ld cxxflags version libs basename prefix) ) {
14         $data{$item} = $self->_call_wx_config( $item );
15     }
16     $data{ld} =~ s/\-o\s*$/ /; # wxWidgets puts 'ld -o' into LD
17     $data{libs} =~ s/\-lwx\S+//g;
18
19     my @mono_libs = $self->_version_2_dec( $data{version} ) >= 2.009 ?
20                         @My::Build::Any_wx_config::MONO_LIBRARIES_2_9 :
21                         @My::Build::Any_wx_config::MONO_LIBRARIES_2_8;
22     my $arg = 'libs' . $My::Build::Any_wx_config::WX_CONFIG_LIBSEP .
23         join ',', grep { !m/base/ }
24                        ( $self->awx_is_monolithic ?
25                              @mono_libs :
26                              @My::Build::Any_wx_config::LIBRARIES );
27     my $libraries = $self->_call_wx_config( $arg );
28
29     my( $libname_re, $libsuffix );
30     if( $^O eq 'openbsd' ) {
31         $libname_re = '-l(.*_(\w+))';
32         $libsuffix = '.1.0';
33     } else {
34         $libname_re = '-l(.*_(\w+)-.*)';
35         $libsuffix = '';
36     }
37     foreach my $lib ( grep { m/\-lwx/ } split ' ', $libraries ) {
38         $lib =~ m/$libname_re/ or die $lib;
39         my( $key, $name ) = ( $2, $1 );
40         $key = 'base' if $key =~ m/^base[ud]{0,2}/;
41         $key = 'base' if $key =~ m/^carbon|^cocoa/ && $name !~ /osx_/; # here for Mac
42         $key = 'core' if $key =~ m/^carbon|^cocoa/ && $name =~ /osx_/; # here for Mac
43         $key = 'core' if $key =~ m/^mac[ud]{0,2}/;
44         $key = 'core' if $key =~ m/^gtk2?[ud]{0,2}/
45                               && $self->awx_is_monolithic
46                               && $lib =~ m/(?:gtk2?|mac)[ud]{0,2}-/;
47         my $dll = "lib${name}." . $self->awx_dlext . $libsuffix;
48
49         $data{dlls}{$key} = { dll  => $dll,
50                               link => $lib };
51     }
52     if( $self->awx_is_monolithic ) {
53         $data{dlls}{mono} = delete $data{dlls}{core};
54     }
55
56     $self->{awx_data} = \%data;
57 }
58
59 1;