XSConfig

 view release on metacpan or  search on metacpan

Config_xs.PL  view on Meta::CPAN

    $v = substr($v, 1, length($v)-2); # strip start/end quotes, ' or "
    #$v =~ s/\\/\\\\/g;
    $h{$k} = $v;
}
close $in;
if ($in_core || -e $git) {
    open $in, "<", $git or die "Error reading '$git': $!";
    while (<$in>) {
        last if $_ eq "\$Config::Git_Data=<<'ENDOFGIT';\n";
    }
    while (<$in>) {
        chomp;
        last if $_ eq 'ENDOFGIT';
        # some Config_git.pl that were generated, probably without a git binary
        # available but with a .git dir in perl source tree
        # contain a blank line before ENDOFGIT line
        next unless length $_;
        my ($k,$v) = split(/=/,$_,2);
        $v = substr($v, 1, length($v)-2); # strip start/end quotes, ' or "
        $h{$k} = $v;
    }
    close $in;
}

# Test if gperf works. if not patch canned xsout instead.
unless ($no_gperf) {
    local $!;
    $gperf_ok = !(system("$gperf --output-file=${xsout}_tmp gperftest.in") >> 8);
    if ($gperf_ok and -z $xsout."_tmp") {
        $gperf_ok = 0;
    }
    unlink $xsout."_tmp";
    print STDERR "$gperf ",$gperf_ok ? "works ok\n" : "does not work. $!\n";
    unless ($gperf_ok) {
        if ($in_core) {
            print STDERR "Please install gperf for higher efficiency.\n";
        } else { # print the banner
            local $/;
            my $msg = <DATA>;
            eval $msg;
        }
    }
}

if ($gperf_ok) {
    # make a customized .xs, not git tracked, smaller Config shared lib since
    # we dont need a "universal" set of keys for all build configs of perl
    gen_gperf_Config($xsin, $xsoutcustm, \%h);
    # postprocess the values a bit to generate a canned Config for CI/no gperf
    # reserve up to 39 config_args
    for (0..39) {
        my $k = "config_arg".$_;
        $h{$k} = '' unless exists $h{$k};
    } # needed for cperl and CPAN
    #these qw blocks are created with genkeys.PL in the cpan repo
    my @cannedkeys = qw(

bin_ELF bootstrap_charset   canned_gperf    ccstdflags  ccwarnflags charsize
config_argc config_args d_attribute_always_inline   d_attribute_used
d_builtin_clz   d_builtin_ctz   d_builtin_prefetch  d_get_current_dir_name
d_llabs d_re_comp   d_realpath  d_regcmp    d_setenv    dlltool dtraceobject
fake_signatures getcwdnull  git_ancestor    git_commit_date git_remote_branch
git_unpushed    hostgenerate    hostosname  hostperl    i_netinet_in_systm
i_netinet_ip    i_netinet_ip6   incpth  installhtmldir  installhtmlhelpdir
ld_can_script   libdb_needs_pthread mad malloc_cflags   sanitize_address
sysincpth   syslibpth   sysroot targetdir   targetenv   targethost  targetmkdir
targetport  useversionedarchname

      );
    unless ($in_core) { # cperl doesn't need these, CPAN does
        push @cannedkeys , qw(

ARCH    BuiltWithPatchPerl  Mcc PATH    PERL_PATCHLEVEL ansi2knr    arflags
ccflags_nolargefiles    cf_epoch    charbits    compiler_warning
config_heavy    d_accept4   d_acosh d_asctime64 d_asinh d_atanh d_attribut
d_attribute_deprecated  d_attribute_format  d_attribute_malloc
d_attribute_nonnull d_attribute_noreturn    d_attribute_pure
d_attribute_unused  d_attribute_visibility  d_attribute_warn_unused_result
d_backtrace d_bcmp  d_bcopy d_builtin_add_overflow  d_builtin_arith_overflow
d_builtin_choose_expr   d_builtin_expect    d_builtin_mul_overflow
d_builtin_sub_overflow  d_bzero d_c99_variadic_macros   d_cbrt  d_charvspr
d_clearenv  d_copysign  d_cplusplus d_ctermid   d_ctime64   d_difftime64
d_dir_dd_fd d_dladdr    d_double_has_inf    d_double_has_nan
d_double_has_negative_zero  d_double_has_subnormals d_double_style_cray
d_double_style_ibm  d_double_style_ieee d_double_style_vax  d_dup3  d_duplocale
d_erf   d_erfc  d_exp2  d_expm1 d_fchmodat  d_fdclose   d_fdim  d_fegetround
d_ffs   d_ffsl  d_fma   d_fmax  d_fmin  d_fp_classify   d_fp_classl
d_fpgetround    d_freelocale    d_fs_data_s d_fstatfs   d_fstatvfs  d_futimes
d_gai_strerror  d_gdbm_ndbm_h_uses_prototypes   d_gdbmndbm_h_uses_prototypes
d_getaddrinfo   d_getenv_preserves_other_thread d_getfsstat d_getmnt
d_getmntent d_getnameinfo   d_gmtime64  d_has_C_UTF8    d_hasmntopt d_hypot
d_ilogb d_inc_version_list  d_inetntop  d_inetpton  d_ip_mreq
d_ip_mreq_source    d_ipv6_mreq d_ipv6_mreq_source  d_isblank   d_isfinitel
d_isinfl    d_isless    d_isnormal  d_j0    d_j0l   d_lc_monetary_2008
d_ldexpl    d_lgamma    d_lgamma_r  d_libname_unique    d_linkat    d_llrint
d_llrintl   d_llround   d_llroundl  d_localeconv_l  d_localtime64
d_localtime_r_needs_tzset   d_log1p d_log2  d_logb  d_long_double_style_ieee
d_long_double_style_ieee_doubledouble   d_long_double_style_ieee_extended
d_long_double_style_ieee_std    d_long_double_style_vax d_lrint d_lrintl
d_lround    d_lroundl   d_malloc_good_size  d_malloc_size
d_malloc_usable_size    d_mbrlen    d_mbrtowc   d_memchr    d_memcmp
d_memcpy    d_memmem    d_memmove   d_memrchr   d_memset    d_mkostemp
d_mktime64  d_modfl_pow32_bug   d_modflproto    d_nan   d_nanosleep d_ndbm
d_ndbm_h_uses_prototypes    d_nearbyint d_newlocale d_nextafter d_nexttoward
d_nl_langinfo_l d_non_int_bitfields d_nv_zero_is_allbits_zero   d_openat
d_perl_lc_all_category_positions_init   d_perl_lc_all_separator
d_perl_lc_all_uses_name_value_pairs d_pipe2 d_prctl d_prctl_set_name
d_printf_format_null    d_pseudofork    d_ptrdiff_t d_querylocale   d_regcomp
d_remainder d_remquo    d_renameat  d_rint  d_round d_safebcpy  d_safemcpy
d_sanemcmp  d_scalbn    d_setenv    d_setlocale_accepts_any_locale_name d_sfio
d_siginfo_si_addr   d_siginfo_si_band   d_siginfo_si_errno  d_siginfo_si_fd
d_siginfo_si_pid    d_siginfo_si_status d_siginfo_si_uid    d_siginfo_si_value
d_signbit   d_sin6_scope_id d_sitearch  d_snprintf  d_sockaddr_in6
d_sockaddr_sa_len   d_sockaddr_storage  d_sprintf_returns_strlen    d_stat
d_statfs_f_flags    d_statfs_s  d_static_inline d_statvfs   d_strchr
d_strctcpy  d_strerrm   d_strerror  d_strerror_l    d_strlcat   d_strlcpy
d_strnlen   d_strtod_l  d_strtold_l d_strxfrm_l d_tgamma    d_thread_local
d_thread_safe_nl_langinfo_l d_timegm    d_towlower  d_towupper  d_trunc
d_truncl    d_unlinkat  d_unsetenv  d_uselocale d_ustat d_vendorscript
d_vms_case_sensitive_symbols    d_volatile  d_vprintf   d_vsnprintf d_wcrtomb
d_wcscmp    d_wcsxfrm   default_inc_excludes_dot    defvoidused dl_so_eq_ext
doop_cflags doubleinfbytes  doublekind  doublemantbits  doublenanbytes  dtrace
dtracexnolibs   extern_C    found_libucb    from    gccansipedantic git_branch
git_commit_id   git_commit_id_title git_describe    git_snapshot_date
git_uncommitted_changes gnulibc_version hash_func   html1dir    html1direxp
html3dir    html3direxp i32dformat  i_assert    i_bfd   i_dld   i_execinfo
i_fenv  i_float i_gdbm_ndbm i_gdbmndbm  i_mallocmalloc  i_math  i_memory
i_mntent    i_quadmath  i_sfio  i_stdarg    i_stdbool   i_stddef    i_stdint
i_sysmount  i_syspoll   i_sysstatfs i_sysstatvfs    i_syssyscall    i_sysvfs
i_ustat i_values    i_varargs   i_varhdr    i_wchar i_xlocale   ieeefp_h
initialinstalllocation  installhtml1dir installhtml3dir installsitehtml1dir
installsitehtml3dir installsiteman1dir  installsiteman3dir  installsitescript
installvendorhtml1dir   installvendorhtml3dir   installvendorman1dir
installvendorman3dir    installvendorscript ldflags_nolargefiles
libs_nolargefiles   libswanted_nolargefiles longdblinfbytes longdblkind
longdblmantbits longdblnanbytes madlyh  madlyobj    madlysrc    mistrustnm
nv_overflows_integers_at    nvmantbits  op_cflags   perl_patchlevel
perl_revision   perl_static_inline  perl_subversion perl_thread_local
perl_version    ppmarch pthread_h_first regexec_cflags  rm_try  run sGMTIME_max
sGMTIME_min sLOCALTIME_max  sLOCALTIME_min  sitehtml1dir    sitehtml1direxp
sitehtml3dir    sitehtml3direxp siteman1dir siteman1direxp  siteman3dir
siteman3direxp  sitescript  sitescriptexp   st_dev_sign st_dev_size st_ino_sign
st_ino_size taint_disabled  taint_support   targetsh    to  toke_cflags
u32XUformat u32oformat  u32uformat  u32xformat  usecbacktrace   usecperl
usedefaultstrict    usedevel    usedtrace   usekernprocpathname uselanginfo
usensgetexecutablepath  usequadmath userelocatableinc   usesfio vaproto
vendorhtml1dir  vendorhtml1direxp   vendorhtml3dir  vendorhtml3direxp
vendorman1dir   vendorman1direxp    vendorman3dir   vendorman3direxp
vendorscript    vendorscriptexp voidflags   xlocale_needed  yacc    yaccflags

        );
    }

    for my $k (@cannedkeys) {
        if (!exists $h{$k}) {
            warn "add $k to $xsout\n" if $verbose;
            $h{$k} = '';
        }
    }
    #dont regen the git tracked canned hash inside cperl unless requested
    gen_gperf_Config($xsin, $xsout, \%h) if $regen || ! $in_core;
    $xsout = $xsoutcustm; # use smaller build specific .xs
}
#add marker key so we know for testing the larger canned gperf hash was used
else {
    $h{canned_gperf} = '';
}

# code in Config_heavy.pl to compute byteorder is customized/interpolated
# for each build permutation of perl by configpm. The byteorder in the
# Config_heavy.pl database is ignored. Just use Config_heavy.pl to get byteorder
# instead of copying the complicated code in configpm to here
$h{byteorder} = $Config{byteorder};

#these values are dynamically generated in ActivePerl::Config, freeze them
if(defined &ActivePerl::PRODUCT && ! $ENV{ACTIVEPERL_CONFIG_DISABLE}){
    foreach (qw (
        _a
        _o



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