MarpaX-ESLIF
view release on metacpan or search on metacpan
etc/compile_marpaESLIF.pl view on Meta::CPAN
);
my @include_dirs =
(
File::Spec->catdir($outdir, 'libmarpa', 'work', 'stage'),
File::Spec->catdir($outdir, 'include', 'marpaWrapper', 'internal'),
File::Spec->catdir($EXTRACT_DIR, 'genericLogger', 'include'),
File::Spec->catdir($EXTRACT_DIR, 'genericStack', 'include'),
File::Spec->catdir($EXTRACT_DIR, 'genericHash', 'include'),
File::Spec->catdir($EXTRACT_DIR, 'genericSparseArray', 'include'),
File::Spec->catdir($outdir, 'include')
);
foreach my $source (@sources) {
build_object($source, include_dirs => \@include_dirs, extra_compiler_flags => \@extra_compiler_flags);
}
}
sub process_marpaESLIF {
my ($ac) = @_;
my $tar = Archive::Tar->new;
my $input = File::Spec->catfile($TARBALLS_DIR, 'marpaeslif-src.tar.gz');
$tar->read($input);
my $outdir = File::Spec->catdir($EXTRACT_DIR, 'marpaESLIF');
print "Extracting $input\n";
make_path($outdir);
{
local $CWD = $outdir;
$tar->extract();
}
#
# We depend on pcre2 object that we distribute
#
process_pcre2($ac);
#
# We depend on luaunpanic
#
process_luaunpanic($ac);
#
# We depend on luaunpanic
#
process_marpaESLIFLua($ac);
#
# Get project, version and generate compile flag, export.h
#
my ($project, $version, $major, $minor, $patch) = get_project_and_version($ac, $outdir);
my $PROJECT = uc($project);
$ac->define_var("MARPAESLIF_UINT32_T", "CMAKE_HELPERS_UINT32_TYPEDEF");
$ac->define_var("MARPAESLIF_UINT64_T", "CMAKE_HELPERS_UINT64_TYPEDEF");
my @extra_compiler_flags = ();
push(@extra_compiler_flags, "-D${PROJECT}_NTRACE");
if ($IS_WINDOWS) {
#
# DLL platform
#
push(@extra_compiler_flags, "-DLUA_DL_DLL=1");
} else {
push(@extra_compiler_flags, "-DLUA_USE_DLOPEN=1");
push(@extra_compiler_flags, "-DLUA_USE_POSIX=1");
}
push(@extra_compiler_flags, "-DMARPAESLIFLUA_EMBEDDED=1");
push(@extra_compiler_flags, "-DMARPAESLIF_BUFSIZ=1048576");
push(@extra_compiler_flags, "-DPCRE2_CODE_UNIT_WIDTH=8");
push(@extra_compiler_flags, "-DPCRE2_STATIC=1");
#
# We want to align lua integer type with perl ivtype
#
my $ivtype = $Config{ivtype} || '';
if ($ivtype eq 'int') {
push(@extra_compiler_flags, "-DLUA_INT_TYPE=1");
} elsif ($ivtype eq 'long') {
push(@extra_compiler_flags, "-DLUA_INT_TYPE=2");
} elsif ($ivtype eq 'long long') {
push(@extra_compiler_flags, "-DLUA_INT_TYPE=3");
} else {
$ac->msg_notice("No exact map found in lua for perl integer type \"$ivtype\": use long long for lua_Integer");
push(@extra_compiler_flags, "-DLUA_INT_TYPE=3");
}
#
# We want to align lua float type with perl nvtype
#
my $nvtype = $Config{nvtype} || '';
if ($nvtype eq 'float') {
push(@extra_compiler_flags, "-DLUA_FLOAT_TYPE=1");
} elsif ($nvtype eq 'double') {
push(@extra_compiler_flags, "-DLUA_FLOAT_TYPE=2");
} elsif ($nvtype eq 'long double') {
push(@extra_compiler_flags, "-DLUA_FLOAT_TYPE=3");
} else {
$ac->msg_notice("No exact map found in lua for perl double type \"$nvtype\": use long double for lua_Number");
push(@extra_compiler_flags, "-DLUA_FLOAT_TYPE=3");
}
my $extra_defines = <<EXTRA_DEFINES;
#define MARPAESLIFLUA_VERSION_MAJOR $major
#define MARPAESLIFLUA_VERSION_MINOR $minor
#define MARPAESLIFLUA_VERSION_PATCH $patch
#define MARPAESLIFLUA_VERSION "$version"
EXTRA_DEFINES
generate_export_h($ac, $outdir, $project, $version, $major, $minor, $patch, $extra_defines);
#
# Configure
#
configure_file
(
$ac,
File::Spec->catfile($outdir, 'include', 'marpaESLIF', 'internal', 'config.h.in'),
File::Spec->catfile($outdir, 'include', 'marpaESLIF', 'internal', 'config.h')
);
#
# Compile
#
my @sources =
(
File::Spec->catfile($outdir, 'src', 'marpaESLIF.c')
);
my @include_dirs =
(
File::Spec->catdir($EXTRACT_DIR, 'marpaWrapper', 'include'),
File::Spec->catdir($EXTRACT_DIR, 'tconv', 'include'),
File::Spec->catdir($EXTRACT_DIR, 'pcre2-10.42', 'src'),
File::Spec->catdir($EXTRACT_DIR, 'luaunpanic', 'include', 'luaunpanic', 'lua'), # For luaconf.h
( run in 0.601 second using v1.01-cache-2.11-cpan-71847e10f99 )