Alien-wxWidgets

 view release on metacpan or  search on metacpan

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


    $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" );
    }
    
    if( $self->notes( 'build_wx' ) || $self->notes( 'mk_portable' )  ) {
        require File::Find;
        my $no_platform = join '|', qw(unix gtk x11 motif mac cocoa
                                       os2 palmos univ mgl msdos gtk1
                                       dfb);
        my $wx_base = $self->awx_wx_config_data->{wxdir_build};
        foreach my $find_base ( File::Spec->catdir( $wx_base, qw(include wx) ),
                             File::Spec->catdir( $wx_base, qw(contrib
                                                 include wx) ) ) {
            next unless -d $find_base;
            my $wanted = sub {
                $File::Find::prune ||=
                  -d $_ && $_ =~ m{include[/\\]wx[/\\](?:$no_platform)$};
                $File::Find::prune ||=
                  -d $_ && $_ =~ m{[/\\]\.svn$};
                return unless -f $_;
                my $rel = File::Spec->abs2rel( $_, $find_base );
                $files{$_} = awx_arch_file( "rEpLaCe/include/wx/$rel" );
                # print "$_ ==> $files{$_}\n";
            };
            File::Find::find
                ( { wanted   => $wanted,
                    no_chdir => 1,
                    },
                  $find_base
                  );
        }
    }
    
    for my $builtin ( @{ $self->awx_wx_config_data->{w32builtins} } ) {
	my $base = File::Basename::basename( $builtin );
        $files{$builtin} = awx_arch_file( "rEpLaCe/lib/$base" );
    }
    
    return %files;
}

sub copy_wxwidgets {
    my $self = shift;
    my %files = $self->files_to_install;

    while( my( $from, $to ) = each %files ) {
        $to =~ s/rEpLaCe/$self->{awx_key}/g;
        $self->copy_if_modified( from => $from, to => $to, verbose => 1 );
    }
}

sub install_wxwidgets {
    my $self = shift;

    $self->copy_wxwidgets;
}

sub awx_get_package {
    My::Build::Win32::_init();

    my $package;

    return 'WinCE' if $INC{'Cross.pm'};

    SWITCH: {
        local $_ = $Config{ccname} || $Config{cc};



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