B-C

 view release on metacpan or  search on metacpan

Makefile.PL  view on Meta::CPAN

    print PH "\$use_declare_independent_comalloc = $use_declare_independent_comalloc;\n\n";
    print PH "# broken or patched upstream 5.22 ByteLoader. undef for yet undecided\n";
    $have_byteloader = 0 if $Config{usecperl}; # have it, but still broken
    print PH "\$have_byteloader = $have_byteloader;\n";
    print PH "# since cperl 5.22.2:\n";
    print PH "\$have_op_rettype = $have_op_rettype;\n";
    print PH "\$have_HEK_STATIC = $have_HEK_STATIC;\n";
    print PH "# use extra compiler flags, after ccopts, resp. ldopts\n";
    print PH "\$extra_cflags = \"$extra_cflags\";\n";
    print PH "\$extra_libs = \"$extra_libs\";\n";
    print PH "\@deps = qw( ", $b_c_deps, " );\n\n";

    if (!$CORE) { # miniperl cannot load Scalar::Util
        require Data::Dumper;
        $Data::Dumper::Terse=1;
        $Data::Dumper::Sortkeys=1;
    }
    my %cfg;
    my $conf = "(\n";
    # Ensure to add all used Config keys in B::C here, otherwise they will be silently empty.
    # easier hash key/value slices only came with 5.22.
    # Some keys are only needed with cross
    for my $s (qw(archname archlib sitearch sitelib byteorder cc ccflags
                  d_c99_variadic_macros d_dlopen d_isinf d_isnan d_longdbl dlext
                  i_dlfcn ivdformat ivsize ld ldflags libs longsize mad nvgformat
                  osname osvers perlpath privlib ptrsize sizesize static_ext
                  usecperl usedl useithreads uselongdouble usemultiplicity
	          usemymalloc uvuformat version))
      # maybe: use64bitall use64bitint
    {
        if ($CORE) {
            my $v = $Config::Config{$s};
            if (!defined $v) {
                $v = 'undef';
            } else {
                $v =~ s/'/\\'/g;
                if ($v !~ /^\d+$/) {
                    $v = "'".$v."'";
                }
            }
            $conf .= "\t$s => $v,\n";
        } else {
            $cfg{$s} = $Config::Config{$s};
        }
    }
    if ($CORE) {
        $conf .= ");";
    } else {
        $conf = Data::Dumper::Dumper(\%cfg);
        $conf =~ s/^\s*{/(/;
        $conf =~ s/}\s*$/);/;
    }
    print PH "our \%Config = $conf\n";
    print PH "\n";
    print PH "1;\n";
    close PH;
    chmod 0644, "lib/B/C/Config.pm";
}

# XXX Check for 5.16.0 B-1.34 and offer to patch it? rather use `perlall build --patches=Compiler`
my $unicode_warning =
  "  Perl handling of new unicode identifiers - package and symbol names - \n".
  "  without proper TR39 handling is considered a security risc and is not fully supported.\n".
  "  See http://websec.github.io/unicode-security-guide/\n\n";
if ($ENV{PERL_CORE}) {
    # supress the TR39 warnings in core
}
elsif ($] > 5.015005 and $] < 5.019004) {
    # We do not want to support binary identifiers. syscalls with 5.019004 should be enabled
    warn "Warning: Bad perl version $]\n".
	 $unicode_warning.
	 "  Check your code for syntax spoofs, confusables, esp. strip \\0 from package names.\n";
} elsif ($] >= 5.019004 and !($Config{usecperl} and $] >= 5.025002)) {
    warn "Warning:\n".
	 $unicode_warning.
	 "  Check your code for syntax spoofs, confusables, strip \\0 from package names.\n".
         ($Config{usecperl} ? "" :
	 "  Enable use warnings 'syscalls'.\n");
}
my $carp_warning =
  "  Perl5 broke Carp for the compiler with 5.26 with a dynamic _fetch_sub()\n".
  "  Either use an earlier Carp (<1.42) or check the cperl patches, replacing it\n".
  "  with a simple version check.\n";
if ($] >= 5.025004 and !$Config{usecperl}) {
    warn "Warning: Unsupported perl version $]\n".
	 $carp_warning;
}

my $perlcc = File::Spec->catfile("script", "perlcc");
if ($CORE and $^O eq 'MSWin32') {
    my $perldll = $Config{usecperl} ? "cperl*.dll" : "perl*.dll";
    system("copy ..\..\$perldll *.*");
}

WriteMakefile(
    NAME	 => "B::C",
    VERSION_FROM => "lib/B/C.pm",
    PL_FILES   => { $perlcc.'.PL'    => $perlcc },
    EXE_FILES  => [$perlcc, qw(script/cc_harness script/assemble script/disassemble)],
    PREREQ_PM  => {'Opcodes'  => '0',    # optional
		   'IPC::Run' => '0',    # optional
		   'B::Flags' => '0.15', # optional
		   'Time::HiRes' => '0', # optional
		   'ExtUtils::Embed' => '1.25' # mandatory (missing on redhat)
                   #'B'        => '1.0901' # required but in CORE
                  },
    'AUTHOR'   => 'Reini Urban <rurban@cpan.org>, '
                . 'Malcolm Beattie (retired)',
    'ABSTRACT' => 'Perl compiler',
    'LICENSE'  => 'perl',
    # was in core until 5.9.5, need to update it there
    (($] < 5.010 || $Config{usecperl}) ?
     ('INSTALLDIRS' => 'perl') : ()),
    (($ExtUtils::MakeMaker::VERSION gt '6.31' and $ExtUtils::MakeMaker::VERSION lt '6.46') ?
       ('EXTRA_META'  => "recommends:\n" .
        "    B::Flags:  0.15\n".
        "    B::Debug:  1.16\n".
        "    Opcodes:   0.10\n".
        "    IPC::Run:  0\n",
       ) : ()),
    ($ExtUtils::MakeMaker::VERSION gt '6.46' ?
    ('META_MERGE'  => {"recommends" =>
                       {
                        'B::Flags' => '0.15',
                        "B::Debug" => '1.16',
                        "Opcodes"  => '0.10',
                        "IPC::Run" => 0,
                       },
                       resources =>
                       {
                        license     => 'http://dev.perl.org/licenses/',
                        bugtracker  => 'https://github.com/rurban/perl-compiler/issues',
                        repository  => 'https://github.com/rurban/perl-compiler',
                       },
                      }



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