Alien-wxWidgets

 view release on metacpan or  search on metacpan

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

    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};

        /^cl/i  and $package = 'Win32_MSVC'  and last SWITCH;
        /^gcc/i and $package = 'Win32_MinGW' and last SWITCH;

        # default
        die "Your compiler is not currently supported on Win32"
    };

    return $package . '_Bakefile';
}

# MSLU is off by default. It Must be explicitly enabled
sub awx_mslu {
    return $_[0]->args( 'wxWidgets-mslu' )
      if defined $_[0]->args( 'wxWidgets-mslu' );
    return 0;
}

sub massage_environment {
    my( $self ) = shift;

    if( $self->notes( 'build_wx' ) ) {
        $ENV{WXWIN} = $ENV{WXDIR} = File::Spec->rel2abs
          ( $self->notes( 'build_data' )->{data}{directory} );
    }
}

package My::Build::Win32_Bakefile;

use strict;
use Carp;
use Config;
# mixin: no use base

sub build_wxwidgets {
    my $self = shift;
    my $old_dir = Cwd::cwd();

    my $uni = $self->awx_unicode ? 'UNICODE=1'   : 'UNICODE=0';
    my $mslu = $self->awx_mslu   ? 'MSLU=1'      : 'MSLU=0';
    my $dbg = $self->awx_debug   ? 'BUILD=debug' : 'BUILD=release';
    my $opt = join ' ', $uni, $mslu, $dbg, 'SHARED=1';



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