Alien-wxWidgets

 view release on metacpan or  search on metacpan

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

              qq{ | "$patch_exe" -N -p0 -u -b -z .bak};

    return $cmd;
}

sub awx_grep_dlls {
    my( $self, $libdir, $digits, $mono ) = @_;
    my $ret = {};
    my $ver = $self->_version_2_dec( $self->awx_w32_bakefile_version );
    my $suff = ( $self->awx_unicode ? 'u' : '' ) .
               ( $self->awx_debug && $ver <= 2.009 ? 'd' : '' );

    my @dlls = grep { m/${digits}\d*${suff}_/ }
               bsd_glob( File::Spec->catfile( $libdir, '*.dll' ) );
    my @libs = grep { m/(?:lib)?wx(?:wince|msw|base)[\w\.]+$/ }
               grep { m/${digits}\d*${suff}(_|\.)/ }
               bsd_glob( File::Spec->catfile( $libdir, "*$Config{lib_ext}" ) );
    # we want builtins on Win32 so that they are available for wxWidgets extensions
    my @builtins = grep { m/wx(zlib|regex|expat|png|jpeg|tiff)/ }
               bsd_glob( File::Spec->catfile( $libdir, "*$Config{lib_ext}" ) );

    $self->{w32builtins} = \@builtins;
    
    foreach my $full ( @dlls, @libs ) {
        my( $name, $type );
        local $_ = File::Basename::basename( $full );
        m/^[^_]+_([^_\.]+)/ and $name = $1;
        $name = 'base' if !defined $name || $name =~ m/^(gcc|vc|evc)$/;
        $type = m/$Config{lib_ext}$/i ? 'lib' : 'dll';
        $ret->{$name}{$type} = $full;
    }

    if( $mono ) {
        $ret->{mono} = delete $ret->{base};
    }

    die "Configuration error: could not find libraries for configuration: "
        . join ' ', map "'$_'", $suff, $digits
      unless ( exists $ret->{core}{dll} and exists $ret->{core}{lib} )
          or ( exists $ret->{mono}{dll} and exists $ret->{mono}{lib} );

    return $ret;
}

sub awx_wx_config_data {
    my $self = shift;
    my $wxdir_b = $ENV{WXDIR};
    my $wxdir = $self->notes( 'build_wx' ) ?
      awx_install_arch_dir( $self, 'rEpLaCe' ) : $wxdir_b;

    return { 'wxdir'       => $wxdir,
             'wxdir_build' => $wxdir_b,
             'wxinc'       => File::Spec->catdir( $wxdir_b, 'include' ),
             'wxcontrinc'  => File::Spec->catdir( $wxdir_b, 'contrib',
                                                 'include' ),
             };
}

sub awx_configure {
    my $self = shift;
    my %config = $self->SUPER::awx_configure;

    $config{prefix} = $self->wx_config( 'wxdir' );
    $config{config}{toolkit} = $self->is_wince ? 'wce' : 'msw';
    $config{shared_library_path} = awx_install_arch_file( $self, "rEpLaCe/lib" );

    $self->awx_w32_find_setup_dir( $self->wx_config( 'cxxflags' ) );

    return %config;
}

sub awx_w32_find_setup_dir {
    my( $self, $cxxflags ) = @_;

    die "Unable to find setup.h directory"
      unless $cxxflags =~ m{[/-]I\s*(\S+lib[\\/][\w\\/]+)(?:\s|$)};
    $self->{awx_setup_dir} = $1;

    $self->{awx_data}{version} = $self->awx_w32_bakefile_version
      if -f $self->awx_w32_build_cfg;
}

sub awx_w32_bakefile_version {
    my $self = shift;
    my $build_cfg = $self->awx_w32_build_cfg;
    my $in;

    open $in, $build_cfg;
    my %ver = map { split /=/ } grep /^WXVER_/, map { s/\s//g; $_ } <$in>;
    close $in;

    return join '.', @ver{qw(WXVER_MAJOR WXVER_MINOR WXVER_RELEASE)};
}

sub awx_w32_build_cfg {
    my $self = shift;
    File::Spec->catfile( $self->{awx_setup_dir}, 'build.cfg' )
}

sub files_to_install {
    my $self = shift;
    my $dlls = $self->awx_wx_config_data->{dlls};

    my $setup_h = File::Spec->catfile( $self->{awx_setup_dir},
                                       'wx', 'setup.h' );
    my $build_cfg = $self->awx_w32_build_cfg;
    my %files;

    $files{$build_cfg} = awx_arch_file( "rEpLaCe/lib/build.cfg" )
      if -f $build_cfg;

    $files{$setup_h} = awx_arch_file( "rEpLaCe/lib/wx/setup.h" );
    foreach my $dll ( map { $_->{dll} } values %$dlls ) {
        next unless defined $dll;
        my $base = File::Basename::basename( $dll );
        $files{$dll} = awx_arch_file( "rEpLaCe/lib/$base" );
    }
    foreach my $lib ( map { $_->{lib} } values %$dlls ) {
        next unless defined $lib;
        my $base = File::Basename::basename( $lib );
        $files{$lib} = awx_arch_file( "rEpLaCe/lib/$base" );



( run in 1.636 second using v1.01-cache-2.11-cpan-39bf76dae61 )