TVision
view release on metacpan or search on metacpan
Makefile.PL view on Meta::CPAN
exit 0;
}
sub usage {
_die <<'EOT';
Most common usage:
perl Makefile.PL
Customised usage:
perl Makefile.PL \
[--ldflags=...] \ # Use this specific library
[--cflags=...] \ # Use this specific include path
[--define=...] \ # Use this specific set of defines
[--help] \ # --help
[<makemaker opts>] # e.g. LINKTYPE=STATIC
For compilation against tvision at given specific location
perl Makefile.PL --library=-l/path/to/tvision.a \
--include=-I/path/to/tv/include \
--define="-DDEFINE1=SMTH1 -DDEFINE2=SMTH2"
EOT
}
$|=1;
if (!$ldflags and !$cflags) {
# user haven't specified where include and libraries.
# This means OS has these include and libs.
# Do we beleive system has it? NO.
# therefore build the one provided with us.
if ($^O eq 'MSWin32') {
# assume strawberry perl with cmake/gmake
mkdir 'tv-build';
chdir 'tv-build';
if (`gcc --version` =~ /^\S+ +\(.*?\) +(\d+)\.(\d+)\.(\d+)$/m) {
my $gccver = sprintf "%02d.%03d%03d", $1, $2, $3;
if ($gccver>11) {
print "GCC version $gccver OK, do cmake\n";
`cmake -S ../tvision.git -B . -G "MinGW Makefiles"
2>&1 > cmake-out.txt`;
print "do gmake\n";
`gmake 2>&1 > gmake-out.txt`;
$cflags = "-Itvision.git/include";
$ldflags = "-ltv-build/libtvision.a";
} else {
print "warning: your GCC version $gccver is <10. continue, but...\n";
}
} else {
print "warning: can't see version of your gcc. continue, but...\n" . ("it is ".`gcc --version`);
}
chdir '..';
}
elsif ($skip) {
} elsif ($^O eq 'linux' or $^O eq 'cygwin') {
# assume normal gcc/cmake/make
mkdir 'tv-build';
chdir 'tv-build';
if (`gcc --version` =~ /^\S+ +\(.*?\) +(\d+)\.(\d+)\.(\d+)(?: \d*)?$/m) {
my $gccver = sprintf "%02d.%03d%03d", $1, $2, $3;
if ($gccver>=12) {
print "GCC version $gccver OK, do cmake\n";
# -DCMAKE_POSITION_INDEPENDENT_CODE=ON to avoid error 'relocation R_X86_64_TPOFF32 against ...'
`cmake -S ../tvision.git -B . -DCMAKE_POSITION_INDEPENDENT_CODE=ON 2>&1 > cmake-out.txt`;
print "do make\n";
`make 2>&1 > make-out.txt`;
$cflags = "-Itvision.git/include";
$ldflags = "-Ltv-build -ltvision -lncurses -lncursesw -lstdc++";
} else {
print "warning: your GCC version $gccver is less than 12.0. continue, but...\n";
$cflags = "-Itvision.git/include";
$ldflags = "-Ltv-build -ltvision -lncurses -lncursesw";
}
} else {
print "warning: can't see version of your gcc. continue, but...\n" . ("it is ".`gcc --version`);
}
chdir '..';
}
}
WriteMakefile(
NAME => 'TVision',
VERSION_FROM => 'TVision.pm', # finds $VERSION
ABSTRACT_FROM => 'TVision.pm', # retrieve abstract from module
AUTHOR => 'Vadim Konovalov <vkon@cpan.org>',
META_MERGE => {
"meta-spec" => { version => 2 },
resources => {
bugtracker => {
web => 'https://github.com/vadrerko/perl-tvision/issues',
},
repository => {
type => 'git',
web => 'https://github.com/vadrerko/perl-tvision',
url => 'https://github.com/vadrerko/perl-tvision.git',
},
}
},
LIBS => ["$ldflags"],
BUILD_REQUIRES => {
'ExtUtils::ParseXS' => 0,
},
INC => "$cflags", # e.g., '-I. -I/usr/include/other'
OBJECT => 'TVision.o TVision-methods.o tkPack-cpp.o',
XS => {
'TVision.xs' => 'TVision.cpp',
'TVision-methods.xs' => 'TVision-methods.cpp',
'tkPack-cpp.xs' => 'tkPack-cpp.cpp',
},
);
sub MY::xs_c {
return '
.xs.cpp:
$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $*.xs >xstmp.c && $(MV) xstmp.c $*.cpp
';
}
sub MY::postamble {
return <<'EOS';
TVision-methods.xs: TVision-methods.xs.in
$(PERL) -MText::Template -we "Text::Template::fill_in_file('TVision-methods.xs.in', DELIMITERS=>['{{{','}}}'],OUTPUT => \*STDOUT)" > TVision-methods.xs
( run in 0.343 second using v1.01-cache-2.11-cpan-5511b514fd6 )