Alien-wxWidgets
view release on metacpan or search on metacpan
inc/My/Build/Any_wx_config.pm view on Meta::CPAN
}
sub awx_is_unicode {
$_[0]->notes( 'build_wx' )
? $_[0]->SUPER::awx_is_unicode
: $wx_unicode;
}
sub awx_is_monolithic {
$_[0]->notes( 'build_wx' )
? $_[0]->SUPER::awx_is_monolithic
: $wx_monolithic;
}
}
package My::Build::Any_wx_config::Base;
use strict;
use base qw(My::Build::Base);
use Fatal qw(chdir mkdir);
use Cwd ();
use Config;
use My::Build::Utility qw(awx_arch_dir awx_install_arch_dir);
sub awx_configure {
My::Build::Any_wx_config::_init( $_[0] );
my $self = shift;
my %config = $self->SUPER::awx_configure;
my $cf = $self->wx_config( 'cxxflags' );
$config{prefix} = $self->wx_config( 'prefix' );
$cf =~ m/__WX(x11|msw|motif|gtk|mac|osx_carbon|osx_cocoa)__/i or
die "Unable to determine toolkit!";
$config{config}{toolkit} = lc $1;
$config{config}{build} = $self->awx_is_monolithic ? 'mono' : 'multi';
if( $config{config}{toolkit} eq 'gtk' ) {
$self->wx_config( 'basename' ) =~ m/(gtk2?)/i or
die 'PANIC: ', $self->wx_config( 'basename' );
$config{config}{toolkit} = lc $1;
}
$config{compiler} = $ENV{CXX} || $self->wx_config( 'cxx' );
if( $self->awx_debug ) {
$config{c_flags} .= ' -g ';
}
my $cccflags = $self->wx_config( 'cxxflags' );
my $libs = $self->wx_config( 'libs' );
foreach ( split /\s+/, $cccflags ) {
m(^[-/]I) && do { $config{include_path} .= "$_ "; next; };
m(^[-/]D) && do { $config{defines} .= "$_ "; next; };
$config{c_flags} .= "$_ ";
}
my @paths = ( ( map { s/^-L//; $_ } grep { /^-L/ } split ' ', $libs ),
qw(/usr/local/lib /usr/lib /usr/lib64) );
foreach ( split /\s+/, $libs ) {
m{^-[lL]|/} && do { $config{link_libraries} .= " $_"; next; };
if( $_ eq '-pthread' && $^O =~ m/(?:linux|freebsd)/i ) {
$config{link_libraries} .= " -lpthread";
next;
}
$config{link_libraries} .= " $_";
}
my %dlls = %{$self->wx_config( 'dlls' )};
$config{_libraries} = {};
while( my( $k, $v ) = each %dlls ) {
if( @paths ) {
my $found = 0;
foreach my $path ( @paths ) {
$found = 1 if -f File::Spec->catfile( $path, $v->{dll} );
}
unless( $found || $self->notes( 'build_wx' ) ) {
if( grep $_ eq $k, @My::Build::Any_wx_config::CRITICAL ) {
warn "'$k' library not found: can't use wxWidgets\n";
} elsif( grep $_ eq $k, @My::Build::Any_wx_config::IMPORTANT ) {
warn "'$k' library not found: some functionality will be missing\n";
}
next;
}
}
$config{_libraries}{$k} = $v;
}
return %config;
}
sub _call_wx_config {
My::Build::Any_wx_config::_init( $_[0] );
my $self = shift;
my $options = join ' ', map { "--$_" } @_;
my $wx_config = $self->notes( 'wx_config' )
|| $ENV{WX_CONFIG} || 'wx-config';
# not completely correct, but close
$options = "--static $options" if $self->awx_static;
my $t = qx($wx_config $options);
chomp $t;
return $t;
}
sub awx_compiler_kind {
My::Build::Any_wx_config::_init( $_[0] );
return Alien::wxWidgets::Utility::awx_compiler_kind( $_[1] )
}
sub awx_dlext { $Config{dlext} }
sub _key {
my $self = shift;
my $compiler = $ENV{CXX} || $Config{ccname} || $Config{cc};
my $key = $self->awx_get_name
( toolkit => $self->awx_build_toolkit,
( run in 0.755 second using v1.01-cache-2.11-cpan-1191d43216d )