Wx-Scintilla
view release on metacpan or search on metacpan
inc/Module/Build/Scintilla.pm view on Meta::CPAN
package Module::Build::Scintilla;
use 5.006;
use strict;
use warnings;
use Module::Build;
use Config;
our @ISA = qw( Module::Build );
sub stc_builderclass {
# get builder class
# based on OS && Config as we can't
# load alien and we are never likely
# to support a *nix toolkit other than
# gtk
my $bclass;
if ( $^O =~ /^mswin/i ) {
if ( $Config{cc} eq 'cl' ) {
require Module::Build::Scintilla::MSW;
$bclass = 'Module::Build::Scintilla::MSW';
} else {
require Module::Build::Scintilla::MSWgcc;
$bclass = 'Module::Build::Scintilla::MSWgcc';
}
} elsif ( $^O =~ /^darwin/i ) {
require Module::Build::Scintilla::OSX;
$bclass = 'Module::Build::Scintilla::OSX';
} else {
require Module::Build::Scintilla::GTK;
$bclass = 'Module::Build::Scintilla::GTK';
}
return $bclass;
}
sub stc_extra_scintilla_libs { ''; }
sub stc_prebuild_check { 1; }
sub stc_wxconfig {
my $self = shift;
# not available on windows
return $self->{_wxstc_config_wxconfig} if $self->{_wxstc_config_wxconfig};
my $binpathconfig;
my $sympathconfig = Alien::wxWidgets->prefix . '/bin/wx-config';
# sometimes the symlink is broken - if there has been relocation etc.
# but we know where it should be if installed by Alien::wxWidgets
# For system installs, 'wx-config' should work
eval {
my $location = readlink($sympathconfig);
my @sympaths = split( /\//, $location );
my $testpath = Alien::wxWidgets->prefix . '/lib/wx/config/' . $sympaths[-1];
$binpathconfig = $testpath if -f $testpath;
};
my $wxconfig = $binpathconfig || 'wx-config';
my $configtest = qx($wxconfig --version);
if ( $configtest !~ /^\d+\.\d+\.\d+/ ) {
die
'Cannot find wx-config for wxWidgets. Perhaps you need to install wxWidgets development libraries for your system?';
}
$self->{_wxstc_config_wxconfig} = $wxconfig;
return $self->{_wxstc_config_wxconfig};
}
sub stc_version_strings {
my $class = shift;
my $version = Alien::wxWidgets->version;
my $major = substr( $version, 0, 1 );
my $minor = 1 * substr( $version, 2, 3 );
my $release = 1 * substr( $version, 5, 3 );
return ( $major, $minor, $release );
}
sub stc_linker {
my $self = shift;
my $command = $self->stc_wxconfig . ' --ld';
my $linker = qx($command);
chomp($linker);
return $linker;
}
sub stc_ldflags {
my $self = shift;
return Alien::wxWidgets->link_flags;
}
sub stc_defines {
my $self = shift;
my $defines =
Alien::wxWidgets->defines . ' -DWXBUILDING -DSCI_LEXER -DLINK_LEXERS -DWXUSINGDLL -DWXMAKINGDLL_STC -D__WX__';
return $defines;
}
sub stc_compiler {
my $self = shift;
my $command = $self->stc_wxconfig . ' --cc';
my $compiler = qx($command);
chomp($compiler);
{
my @commands = split( /\s/, $compiler );
$commands[0] =~ s/^gcc/g\+\+/;
$commands[0] .= ' -c';
$compiler = join( ' ', @commands );
}
( run in 0.652 second using v1.01-cache-2.11-cpan-71847e10f99 )