B-C

 view release on metacpan or  search on metacpan

Makefile.PL  view on Meta::CPAN

    # Not even the Byteloader works for 5.6 assembled code. The Disassembler does not stop at ret.
    return 0 if $] < 5.007 and $_[1] =~ /ByteLoader|Asmdata\.pm|Bytecode\.pm|Assembler\.pm/;
    # On windows the C compiler would work if DynaLoader.lib would be provided.
    # return 0 if $^O eq 'MSWin32' and !-d ".git" and $_[1] =~ /C\.pm|C\.xs|Stackobj\.pm/;
    return $_[1];
}


# Fix ActivePerl for MSVC6
# The linker for cl 12.0.8804 has no -opt:ref,icf, which is MSVC8 linker syntax.
sub const_config {
    my $s = shift->SUPER::const_config(@_);
    if ($Config::Config{ccversion} eq '12.0.8804' and $Config::Config{cc} eq 'cl') {
	$s =~ s/ -opt:ref,icf//gm;
    }
    $s
}

sub post_constants {
    my $mm = shift;
    main::write_b_c_config($mm->{VERSION});
    my $libs = "\nLIBS = $Config::Config{libs}";
    $libs .= $extra_libs if $extra_libs;
    #XXX PERL_MALLOC_DEF = -DPERL_EXTMALLOC_DEF -Dmalloc=Perl_malloc -Dfree=Perl_mfree -Drealloc=Perl_realloc -Dcalloc=Perl_calloc
    return "$libs\n";
}

sub ccflags {
    my $ccflags = shift->SUPER::ccflags(@_);
    $ccflags .= " -DHAVE_INDEPENDENT_COMALLOC" if $have_independent_comalloc;
    $ccflags .= $extra_cflags if $extra_cflags;
    return $ccflags if !-d ".git" or $ENV{NO_AUTHOR};
    # Recommended by http://www.network-theory.co.uk/docs/gccintro/gccintro_32.html
    # -ansi -pedantic -Wall -W -Wconversion -Wshadow -Wcast-qual -Wwrite-strings (-W => -WExtra)
    $ccflags .= " -ansi -pedantic -Wall -Wextra -Wconversion -Wshadow -Wcast-qual -Wwrite-strings"
      if $Config::Config{cc} =~ /\bgcc/ and $Config::Config{gccversion};
}

sub depend {
    my $headerpath = main::headerpath();
    my @headers = map { File::Spec->catfile($headerpath, $_) } qw(op.h cop.h sv.h);
    my $asmdata = File::Spec->catfile('lib', 'B', 'Asmdata.pm');
    my $byterun_c = File::Spec->catfile('ByteLoader', 'byterun.c');
    my $byterun_h = File::Spec->catfile('ByteLoader', 'byterun.h');
    my $result = "
$asmdata : Makefile bytecode.pl @headers
	\$(PERLRUN) bytecode.pl

$byterun_c : Makefile bytecode.pl @headers
	\$(PERLRUN) bytecode.pl

$byterun_h : Makefile bytecode.pl @headers
	\$(PERLRUN) bytecode.pl

TAGS : $asmdata
	etags --language=perl lib/B/*.pm
";
    if ($] > 5.009 and defined($ExtUtils::MM_Unix::VERSION)) {
        my $ver = 0+$ExtUtils::MM_Unix::VERSION;
        # 8.0403 is the cperl 5.24.0 version based on 7.04_03
        if ($ver == 8.0403 or $ver == 8.0404
            or $ver < 7.0509 or $ver == 7.1)
        {
            $result .= "\ntest :: subdirs-test\n\n";
        } else {
            $result .= "\ntest :: subdirs-test_\$(LINKTYPE)\n\n";
        }
    }
    if ($Config::Config{make} eq 'mingw32-make') { # mingw32 make different to msys make
        $result .= "\n.PHONY : \$(CONFIGDEP)\n\n";
    }
    $result;
}

# force reconfig of B::C::Config with compiled ByteLoader
sub subdirs {
    my $s = shift->SUPER::subdirs(@_);
    if ($] >= 5.022) {
        my $bcflags = File::Spec->catfile('lib', 'B', 'C', 'Config.pm');
        my $bytehintspatched = File::Spec->catfile('ByteLoader', 'hints', '522_patched.pl');
        return $s . "

subdirs ::
	\$(PERL) \"-I\$(PERL_ARCHLIB)\" $bytehintspatched
";
    } else {
        $s
    }
}

sub test {
    my $known_errors = "known_errors" . ($^V =~ /c$/ ? "_cperl.txt" : ".txt");
    my $logsuffix = main::perlversion();
    shift->SUPER::test(@_) .
"
# PERL_VAR: major only
PERL_VER = v5.".substr("$]",3,2) .
      q(
testmod :: pure_all
	PERL_DL_NONLAZY=1 $(FULLPERLRUN) -Iblib/arch -Iblib/lib t/modules.t
testmodall :: pure_all
	PERL_DL_NONLAZY=1 $(FULLPERLRUN) -Iblib/arch -Iblib/lib t/modules.t -no-subset -no-date t/top100
testc :: pure_all
	PERL_DL_NONLAZY=1 $(FULLPERLRUN) -Iblib/arch -Iblib/lib t/c.t
	PERL_DL_NONLAZY=1 $(FULLPERLRUN) -Iblib/arch -Iblib/lib t/c_o3.t
testcc :: pure_all
	PERL_DL_NONLAZY=1 $(FULLPERLRUN) -Iblib/arch -Iblib/lib t/cc.t
testbc :: pure_all
	PERL_DL_NONLAZY=1 $(FULLPERLRUN) -Iblib/arch -Iblib/lib t/bytecode.t
testfast :: pure_all
	NO_AUTHOR=1 $(FULLPERLRUN) -S prove -b -j10 -f
testfast-log :: pure_all
	NO_AUTHOR=1 $(FULLPERLRUN) -S prove -b -j10 -f  | tee log.test-).$logsuffix.q(-`git describe --tags`
testcritical :: pure_all
	t/critical.sh
teststatus :: pure_all
	./status_upd -fqd
testrelease :: pure_all
	$(ECHO) run t/release-testing.sh and perlall testvm --all
testcore_init :: t/CORE
	t/core-init.sh



( run in 2.892 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )