Alien-wxWidgets

 view release on metacpan or  search on metacpan

inc/My/Build/Any_wx_config.pm  view on Meta::CPAN

    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,
        version          => $self->_version_2_dec
                            ( $self->notes( 'build_data' )->{data}{version} ),
        debug            => $self->awx_is_debug,
        unicode          => $self->awx_is_unicode,
        mslu             => $self->awx_is_mslu,
        # it is unlikely it will ever be required under *nix
        $self->notes( 'build_wx' ) ? () :
        ( compiler         => $self->awx_compiler_kind( $compiler ),
          compiler_version => $self->awx_compiler_version( $compiler )
          ),
      );

    return $key;
}

sub wxwidgets_configure_extra_flags {
    my $self = shift;
    
    my $extraflags = $self->notes( 'extraflags' );
    
    if( $self->notes( 'graphicscontext' ) ) {    
        $extraflags .= ' --enable-graphics_ctx';
    }
    
    return $extraflags;
}

sub awx_make {
    my( $self ) = @_;
    my $make = 'make';
    if( $^O eq 'solaris' ) {
        $make = $self->awx_path_search( 'gmake' );
        die "GNU make required under Solaris"
            unless $make;
    }

    return $make;
}

sub awx_version_type {
    my $self = shift;
    my $versiontype = ( $self->notes( 'build_data' )->{data}{version} =~ /^2\.(6|7|8)/ )
        ? 2 : 3;
    return $versiontype;
}

sub build_wxwidgets {
    my $self = shift;
    my $extra_flags = $self->wxwidgets_configure_extra_flags;
    my $prefix_dir = $self->_key;
    my $prefix = awx_install_arch_dir( $self, $prefix_dir );
    my $opengl = $self->notes( 'build_wx_opengl' );
    my $args = sprintf '--with-%s %s--disable-compat24',
                       $self->awx_build_toolkit,
                       $opengl ? '--with-opengl ' : '';
    my $unicode = $self->awx_is_unicode ? 'enable' : 'disable';
    my $debug = '';
    
    if( $self->awx_version_type == 2 ) {
        $debug = ( $self->awx_debug ) ? '--enable-debug' : '--disable-debug';
    } else {
        $debug = ( $self->awx_debug ) ? '--enable-debug=max' : '';
    }

    my $monolithic = $self->awx_is_monolithic ? 'enable' : 'disable';
    my $universal = $self->awx_is_universal ? 'enable' : 'disable';



( run in 0.969 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )