Alien-wxWidgets
view release on metacpan or search on metacpan
inc/My/Build/Base.pm view on Meta::CPAN
# but avoid doubly building wxWidgets when doing
# "perl Makefile.PL && make && make test"
unlink 'configured' if -f 'configured';
$self->SUPER::ACTION_build;
}
sub ACTION_code {
my $self = shift;
$self->SUPER::ACTION_code;
# install_only is set when a wxWidgets build is already configured
# with Alien::wxWidgets
return if $self->notes( 'install_only' );
# see comment in ACTION_build for why 'configured' is used
return if -f 'configured';
$self->depends_on( 'build_wx' );
$self->create_config_file( awx_arch_file( 'Config/Config.pm' ) );
$self->install_wxwidgets;
# see comment in ACTION_build for why 'configured' is used
awx_touch( 'configured' );
$self->add_to_cleanup( 'configured' );
}
sub ACTION_build_wx {
my $self = shift;
if( $self->notes( 'build_wx' ) ) {
$self->fetch_wxwidgets;
$self->extract_wxwidgets;
$self->massage_environment;
$self->build_wxwidgets;
$self->massage_environment; # twice on purpose
}
}
sub ACTION_build_perl {
my $self = shift;
$self->SUPER::ACTION_build;
$self->massage_environment;
$self->create_config_file( awx_arch_file( 'Config/Config.pm' ) );
}
sub ACTION_install_wx {
my $self = shift;
$self->depends_on( 'build_perl' );
$self->install_wxwidgets;
}
sub ACTION_install {
my $self = shift;
$self->SUPER::ACTION_install;
$self->install_system_wxwidgets;
}
sub _check_data_file {
my( $self, $file, $manifest ) = @_;
require File::Spec::Unix;
my $data = do {
package main;
our( $TYPE, $URL );
local $TYPE = 'dummy';
local $URL = 'dummy';
do $file;
};
die "Unable to load data file '$file': $@" unless $data;
foreach my $p ( qw(msw mac unix) ) {
next unless exists $data->{$p};
foreach my $c ( qw(unicode ansi) ) {
next unless exists $data->{$p}{$c};
foreach my $f ( @{$data->{$p}{$c}} ) {
my $file = File::Spec->catfile( 'patches', $f );
my $manifest_file = File::Spec::Unix->catfile( 'patches', $f );
die 'Missing patch file: ', $file, "\n" unless -f $file;
die 'Patch file ', $file, ' not in MANIFEST'
unless exists $manifest->{$manifest_file};
}
}
}
}
sub _check_data_files {
my( $self ) = @_;
require ExtUtils::Manifest;
my $files = ExtUtils::Manifest::maniread();
foreach my $data ( grep m{^patches/data}, keys %$files ) {
print "Checking $data\n";
$self->_check_data_file( $data, $files );
}
}
sub ACTION_distcheck {
my $self = shift;
$self->SUPER::ACTION_distcheck;
$self->_check_data_files;
}
sub ACTION_dist {
my $self = shift;
$self->_check_data_files;
$self->SUPER::ACTION_dist;
}
sub awx_key {
my( $self ) = @_;
die unless $self->{awx_key};
return $self->{awx_key};
}
sub _version_2_dec {
my( $class, $ver ) = @_;
my $dec;
$ver =~ m/^(\d)(\d)$/ and
$dec = $1 + $2 / 1000;
$ver =~ m/^(\d)(\d)(\d+)$/ and
$dec = $1 + $2 / 1000 + $3 / 1000000;
$ver =~ m/^(\d)(\d+)_(\d+)$/ and
$dec = $1 + $2 / 1000 + $3 / 1000000;
$ver =~ m/^(\d+)\.(\d+)\.(\d+)$/ and
$dec = $1 + $2 / 1000 + $3 / 1000000;
return sprintf( "%.6f", $dec );
}
sub _init_config {
inc/My/Build/Base.pm view on Meta::CPAN
sub build_wxwidgets {
die "Don't know how to build wxWidgets";
}
sub install_wxwidgets {
return unless $_[0]->notes( 'build_wx' );
die "Don't know how to build wxWidgets";
}
sub install_system_wxwidgets { }
sub awx_configure {
my $self = shift;
return %{$self->{awx_config}} if $self->{awx_config};
my %config;
$config{config}{debug} = $self->awx_is_debug;
$config{config}{unicode} = $self->awx_is_unicode;
$config{config}{mslu} = $self->awx_is_mslu;
$config{config}{build} = $self->awx_is_monolithic ? 'mono' : 'multi';
$config{link_flags} = '';
$config{c_flags} = '';
return %config;
}
sub wx_config {
my $self = shift;
my $data = $self->awx_wx_config_data;
foreach ( @_ ) {
warn "Undefined key '", $_, "' in wx_config"
unless defined $data->{$_};
}
return @{$data}{@_};
}
sub awx_monolithic { $_[0]->args( 'wxWidgets-monolithic' ) ? 1 : 0 }
sub awx_is_monolithic { $_[0]->awx_monolithic }
sub awx_debug { $_[0]->args( 'wxWidgets-debug' ) ? 1 : 0 }
sub awx_is_debug { $_[0]->awx_debug }
sub awx_unicode { $_[0]->notes( 'build_wx_unicode' )
|| $_[0]->args( 'wxWidgets-unicode' ) ? 1 : 0 }
sub awx_is_unicode { $_[0]->awx_unicode }
sub awx_mslu { 0 }
sub awx_is_mslu { $_[0]->awx_mslu }
sub awx_static { $_[0]->args( 'wxWidgets-static' ) ? 1 : 0 }
sub awx_is_static { $_[0]->awx_static }
sub awx_universal { $_[0]->args( 'wxWidgets-universal' ) ? 1 : 0 }
sub awx_is_universal { $_[0]->awx_universal }
sub awx_get_package { local $_ = $_[0]; s/^My::Build:://; return $_ }
sub awx_wx_patches {
my $self = shift;
my $data = $self->notes( 'build_data' );
my $toolkit = $^O eq 'MSWin32' ? 'msw' :
$^O eq 'darwin' ? 'mac' :
'unix';
my $unicode = $self->awx_unicode ? 'unicode' : 'ansi';
return unless exists $data->{$toolkit} and $data->{$toolkit}{$unicode};
return map { File::Spec->rel2abs( File::Spec->catfile( 'patches', $_ ) ) }
@{$data->{$toolkit}{$unicode}};
}
sub awx_version_type {
my $self = shift;
my $versiontype = ( $self->notes( 'build_data' )->{data}{version} =~ /^2\.(6|7|8)/ )
? 2 : 3;
return $versiontype;
}
sub awx_get_name {
my( $self, %args ) = @_;
my $e = sub { defined $_[0] ? ( $_[0] ) : () };
my $pv = sub { join '.', map { 0 + ( $_ || 0 ) }
( $_[0] =~ /(\d+)\.(\d{1,3})(\d{0,3})/ ) } ;
my $base = join '-', $args{toolkit}, $pv->( $args{version} ),
$e->( $args{debug} ? 'dbg' : undef ),
$e->( $args{unicode} ? 'uni' : undef ),
$e->( $args{mslu} ? 'mslu' : undef ),
$e->( $args{compiler} ),
$e->( $args{compiler_version} ),
;
$base =~ s/\./_/g; $base =~ s/-/_/g;
return $base;
}
sub awx_compiler_kind { 'nc' } # as in 'No Clue'
sub awx_compiler_version {
return Alien::wxWidgets::Utility::awx_cc_abi_version( $_[1] );
}
sub awx_path_search {
my( $self, $file ) = @_;
foreach my $d ( File::Spec->path ) {
my $full = File::Spec->catfile( $d, $file );
# we are gonna use glob() to accept wildcards
foreach my $f ( bsd_glob( $full ) ) {
return $f if -f $f;
}
}
return;
}
sub awx_uses_bakefile { 1 }
sub ACTION_ppmdist {
my( $self ) = @_;
$self->awx_strip_dlls;
$self->_system( 'perl script/make_ppm.pl' );
( run in 0.391 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )