Curses
view release on metacpan or search on metacpan
Makefile.PL view on Meta::CPAN
exit 1;
}
}
my $hintsfile;
if (defined($libType) && -f("hints/c-$OSNAME.$libType.h")) {
$hintsfile = "hints/c-$OSNAME.$libType.h";
} elsif (defined($libClass) && -f("hints/c-$OSNAME.$libClass.h")) {
$hintsfile = "hints/c-$OSNAME.$libClass.h";
} else {
my $candidate = "hints/c-$OSNAME.h";
if (-f($candidate)) {
$hintsfile = $candidate;
} else {
print STDERR <<"EOW";
I'm sorry, but I couldn't find a hints file that was configured for
your OS (named $candidate). You will need to create and configure a
"c-config.h" file for yourself. Please see the "INSTALL" directions
for pointers on how to do this.
EOW
exit 1;
}
}
print("Choosing hints file '$hintsfile'\n");
eval "require File::Copy;";
if (! $@) {
&File::Copy::copy($hintsfile, "c-config.h");
} else {
my $cp;
if ($OSNAME eq 'MSWin32') { $cp = "perl -MExtUtils::Command -e cp" }
elsif ($OSNAME eq 'VMS') { $cp = "copy/log" }
else { $cp = "cp" }
my $sys = "$cp $hintsfile c-config.h";
if ($sys =~ m!([^\\:\w/. -])!) {
print STDERR <<"EOW";
I'm sorry. I was going to try to create a "c-config.h" for you, but it
looks like there are some non-standard characters in the exec string.
I'm feeling rather paranoid, so I'll let you look at the line and do
it by hand if it looks OK. I wanted to execute a copy and thought I
might be able to use:
$sys
but it has the (possibly) naughty character '$1' in it. '
EOW
exit 1;
} else {
system($sys);
}
}
}
sub guessPanelMenuFormLibs($$$$$) {
my ($ncursesLibSearch, $libType, $panelLibsR, $menuLibsR, $formLibsR) = @_;
my ($panelLibGuess, $menuLibGuess, $formLibGuess);
if (defined($libType) && $libType eq "ncursesw") {
$panelLibGuess = -lpanelw;
$menuLibGuess = -lmenuw;
$formLibGuess = -lformw;
} else {
$panelLibGuess = -lpanel;
$menuLibGuess = -lmenu;
$formLibGuess = -lform;
}
$$panelLibsR = "$ncursesLibSearch $panelLibGuess";
$$menuLibsR = "$ncursesLibSearch $menuLibGuess";
$$formLibsR = "$ncursesLibSearch $formLibGuess";
}
my $gen;
my $panels;
my $menus;
my $forms;
my @argv;
while (@ARGV) {
my $arg = shift;
if ($arg eq 'GEN') { $gen = $arg }
elsif ($arg eq 'PANELS') { $panels = $arg }
elsif ($arg eq 'MENUS') { $menus = $arg }
elsif ($arg eq 'FORMS') { $forms = $arg }
else { push @argv, $arg }
}
@ARGV = @argv; # pass non-Curses arguments to MakeMaker
print "GEN function: ", ($gen ? "enabled" : "not applicable"), "\n";
print "PANELS functions: ", ($panels ? "enabled" : "not enabled"), "\n";
print "MENUS functions: ", ($menus ? "enabled" : "not enabled"), "\n";
print "FORMS functions: ", ($forms ? "enabled" : "not enabled"), "\n";
print "\n";
if (defined($inc) && defined($libs)) {
# We have the info we need
if (!defined($libType)) {
$libType = defaultLibTypeForOs($OSNAME);
}
} elsif (defined($inc) || defined($libs)) {
die("You must specify both CURSES_LDFLAGS and CURSES_CFLAGS " .
"environment variables or neither. ");
} elsif (defined($libType)) {
die("If you specify CURSES_LIBTYPE, you must also specify " .
"CURSES_LDFLAGS and CURSES_CFLAGS");
} else {
guessAtCursesLocation(\$libType, \$inc, \$libs);
}
if (not -e "c-config.h") {
makeCConfigH($libType);
}
# Major cheese alert. Any -L for the curses library is probably
# also needed for the panels library.
#
my $ncursesLibSearch;
$ncursesLibSearch = ''; # initial value
while ($libs =~ m{(-L\S+)}g) {
$ncursesLibSearch .= $1 . ' ';
}
guessPanelMenuFormLibs($ncursesLibSearch, $libType,
\my $panelGuess, \my $menuGuess, \my $formGuess);
if ($panels and not $panel_libs) {
$panel_libs = $panelGuess;
}
if ($menus and not $menu_libs) {
$menu_libs = $menuGuess;
}
if ($forms and not $form_libs) {
$form_libs = $formGuess;
}
# Both Perl and Ncurses have a form.h. We have to include the Perl
# header files in our search path, but don't need form.h itself.
# Because the Curses form library header directory comes before the
# perl header directory in our search path, that isn't normally a
# problem. EXCEPT: when there is no specific Curses form library
# directory, and the Curses form.h is instead in the general system
# search path, e.g. /usr/include/form.h. The system directories come
# after the Perl directory in the search. There used to be a
# workaround here where we would simply add /usr/include to the front
# of the search path, but that is not only gross, but ineffective with
# some compilers, which ignore a -I option that adds a directory that
# is a system directory (e.g. gcc 3).
# To deal with this, we make a rough check for the problem, and if it
# appears to exist, we tell the user to fix it.
if ($forms and $form_inc !~ m{-I} and -f('/usr/include/form.h')) {
print("WARNING: Your Curses form.h file appears to be in the default\n");
print("system search path, which will not work for us because of\n");
print("the conflicting Perl form.h file. This means your 'make' will\n");
print("probably fail unless you fix this, as described in the INSTALL\n");
print("file.\n");
}
my $clean =
'config.h CursesDef.h c-config.h cdemo testsym testint testtyp *.i *.s';
my $realc = $gen
? 'list.syms Curses.pm ' .
'CursesFun.c CursesVar.c CursesCon.c CursesTyp.h CursesBoot.c'
: "";
my $components =
($panels ? " PANELS " : "") .
($menus ? " MENUS " : "") .
($forms ? " FORMS " : "");
WriteMakefile(NAME => 'Curses',
INC => "$panel_inc $menu_inc $form_inc $inc",
LIBS => [ "$panel_libs $menu_libs $form_libs $libs" ],
H => [ 'CursesDef.h' ],
clean => { FILES => $clean },
realclean => { FILES => $realc },
dist => { COMPRESS => 'gzip -9f' },
postamble => { COMPONENTS => $components },
VERSION_FROM => 'Curses.pm',
);
( run in 1.128 second using v1.01-cache-2.11-cpan-39bf76dae61 )