| 1 |
This package requires at least perl5.005. You're on your own before |
| 2 |
then. |
| 3 |
|
| 4 |
1) Make sure you've got the prerequisites |
| 5 |
|
| 6 |
1.1) Make sure perl has been built. |
| 7 |
|
| 8 |
1.2) Make sure you have a Curses C library installed. Either original |
| 9 |
BSD Curses or newer Ncurses will do. Pdcurses (public domain Curses |
| 10 |
code that works in DOS, Windows, and X11) almost works. See |
| 11 |
PDCURSES section below. |
| 12 |
|
| 13 |
2) Chdir into the Curses source directory (which you unpacked from the |
| 14 |
.tgz file you downloaded from CPAN) |
| 15 |
|
| 16 |
3) Want to see if maybe the package can autoconfigure itself? It's |
| 17 |
pretty dumb about it, but give it a try and skip to (5). |
| 18 |
|
| 19 |
4) Configure the build for your system. |
| 20 |
|
| 21 |
4.1) |
| 22 |
|
| 23 |
Look in the "hints" directory to see if any of the hint files are |
| 24 |
appropriate to your machine's OS. If so, symlink or copy it to the |
| 25 |
file "c-config.h" in the current ("Curses") directory. If not, |
| 26 |
copy "hints/c-none.h" to "c-config.h" in the current directory. |
| 27 |
Then edit "c-config.h" and follow the directions. If you have to |
| 28 |
"roll your own", be sure to save a copy. A "make clean" will |
| 29 |
delete "c-config.h". If you "rolled your own", please send me a |
| 30 |
copy so I can include it in future distributions (see |
| 31 |
"hints/c-isc.h" for an example of a user-contributed "c-config.h"). |
| 32 |
|
| 33 |
4.2) |
| 34 |
|
| 35 |
Curses has an interface header file named form.h. If on your system |
| 36 |
this is in a system header file directory such as /usr/include, you |
| 37 |
have a problem. That's because Perl also has a file named form.h |
| 38 |
in a directory that is searched before the system directories in the |
| 39 |
compile of the Perl Curses module. |
| 40 |
|
| 41 |
So you'll have to fix that. It's better to have your Curses stuff |
| 42 |
in its own directory. /usr/include/ncurses is conventional. Move |
| 43 |
all your Curses header files (curses.h, ncurses.h, form.h, menu.h, |
| 44 |
panel.h) into this directory. If you use /usr/include/ncurses, |
| 45 |
Makefile.PL will find them there. Otherwise, set the _CFLAGS |
| 46 |
environment variables below accordingly. |
| 47 |
|
| 48 |
Alternatively, you can just edit c-config.h, after running |
| 49 |
Makefile.PL. Replace the line |
| 50 |
|
| 51 |
#include <form.h> |
| 52 |
|
| 53 |
with something like |
| 54 |
|
| 55 |
#include "/usr/include/form.h" |
| 56 |
|
| 57 |
explicitly specifying the Ncurses version of form.h. |
| 58 |
|
| 59 |
You can ignore all this if you're not building forms capability |
| 60 |
into the Perl Curses module (by specifying "FORMS" as an option to |
| 61 |
Makefile.PL below). |
| 62 |
|
| 63 |
4.3) |
| 64 |
|
| 65 |
Set environment variables telling the compiler and linker where your |
| 66 |
Curses C libraries are: |
| 67 |
|
| 68 |
CURSES_CFLAGS: -I and -D options needed at compile time for access to |
| 69 |
the basic Curses library (libcurses). |
| 70 |
CURSES_LDFLAGS: -L and -l options needed at link time for access to |
| 71 |
the basic Curses library (libcurses). (this really |
| 72 |
must be only -L and -l options; Makefile.PL parses it. Furthermore, |
| 73 |
there can't be any space between the -L or -l and its value). |
| 74 |
|
| 75 |
CURSES_PANEL_CFLAGS |
| 76 |
CURSES_PANEL_LDFLAGS |
| 77 |
CURSES_MENU_CFLAGS |
| 78 |
CURSES_MENU_LDFLAGS |
| 79 |
CURSES_FORM_CFLAGS |
| 80 |
CURSES_FORM_LDFLAGS |
| 81 |
|
| 82 |
These are analogous, but for the panel, menu, and form specialty |
| 83 |
Curses libraries, respectively. |
| 84 |
|
| 85 |
You can set these in your shell and export them, e.g. |
| 86 |
|
| 87 |
export CURSES_CFLAGS="-I/usr/include/ncurses" |
| 88 |
export CURSES_LDFLAGS="-L/usr/lib/ncurses -lncurses" |
| 89 |
|
| 90 |
Or you can set them right on the 'perl Makefile.PL' command. |
| 91 |
|
| 92 |
|
| 93 |
5) perl Makefile.PL [PANELS] [MENUS] [FORMS] [options] |
| 94 |
|
| 95 |
PANELS means to include Curses panel function. |
| 96 |
|
| 97 |
MENUS means to include Curses menu functions. |
| 98 |
|
| 99 |
FORMS means to include Curses form function. |
| 100 |
|
| 101 |
For PANELS, MENUS, and FORMS, you must have the associated C library on |
| 102 |
your system (libpanel, libmenu, libform). Choosing one of these options |
| 103 |
without having the library will prevent this package from compiling. |
| 104 |
|
| 105 |
Currently, PANELS, MENUS, and FORMS don't work for the BSD |
| 106 |
hints files (c-*.bsd.h), because I'm not aware of any panel, menu, |
| 107 |
or form libraries for BSD curses. |
| 108 |
|
| 109 |
This package needs the perl header files. If you've already |
| 110 |
installed perl, the "Makefile.PL" will magically know where they |
| 111 |
are. If you haven't installed perl, you may need to tell the |
| 112 |
"Makefile.PL" where the header files are. You can do this with the |
| 113 |
"PERL_SRC=<source directory>" option. |
| 114 |
|
| 115 |
perl Makefile.PL PERL_SRC=/local/src/perl |
| 116 |
|
| 117 |
The "Makefile.PL", as with just about every other perl module, uses |
| 118 |
the "ExtUtils::MakeMaker" package to generate a make file (named |
| 119 |
"Makefile"). I highly recommend reading the "ExtUtils::MakeMaker" |
| 120 |
man page, as there are lots of neat options you can specify. |
| 121 |
|
| 122 |
If Makefile.PL tells you that it can't do something (it prints out |
| 123 |
"I'm sorry" and some more stuff), then you'll need to go back to |
| 124 |
step (4) and try configuring by hand. |
| 125 |
|
| 126 |
6) make |
| 127 |
|
| 128 |
'make' starts off by creating the file "CursesDef.h", by running the |
| 129 |
program 'testsyms'. You will see hundreds of messages telling you which |
| 130 |
functions it found in your system Curses library and which ones it didn't. |
| 131 |
It is a very common build failure mode for it not to find any of the |
| 132 |
functions. If you see that happening, stop and see TROUBLESHOOTING below. |
| 133 |
|
| 134 |
'make' will then try to compile "Curses.c". If you get any undefined |
| 135 |
curses symbols, it means that your curses really doesn't have those |
| 136 |
functions, and you should edit "CursesDef.h" and/or "c-config.h" and change |
| 137 |
the #define to #undef for that function. |
| 138 |
|
| 139 |
If you get other compile errors, it is probably because the curses include |
| 140 |
file and the perl include files are conflicting. You'll have to figure out |
| 141 |
what's wrong and add proper C code to "c-config.h". See |
| 142 |
"hints/c-sunos.sysv.h" for an example of how to do this. |
| 143 |
|
| 144 |
We have seen a weird case in which the builder is unable to find the system |
| 145 |
Curses library even though it is in the linker's default search path and |
| 146 |
you give its name with CURSES_LDFLAGS. Until we figure out what causes |
| 147 |
that, you can work around it by adding a LDLOADLIBS= argument to 'make'. |
| 148 |
For a certain MacOS system in August 2022, this worked: |
| 149 |
|
| 150 |
$ make LDLOADLIBS=-lncurses |
| 151 |
|
| 152 |
7) Test the distribution: |
| 153 |
|
| 154 |
perl demo |
| 155 |
perl gdc |
| 156 |
perl demo2 [stuff that has a 50/50 chance of showing up right] |
| 157 |
perl demo.panel [if you enabled panel function] |
| 158 |
perl demo.menu [if you enabled menu function] |
| 159 |
perl demo.form [if you enabled form function] |
| 160 |
|
| 161 |
"gdc" is a digital clock ported from the "ncurses" distribution. |
| 162 |
|
| 163 |
As mentioned in the "README", the demo is not intended to be an exhaustive |
| 164 |
test of all the possible Curses functions. If it doesn't do all the |
| 165 |
functions correctly, it may be a Curses bug or it may be a problem with |
| 166 |
your system's "libcurses.a". There's no getting around the fact that you |
| 167 |
need to be conversant in how your system's "libcurses.a" works to be able |
| 168 |
to use Curses most effectively. |
| 169 |
|
| 170 |
If the tests fail, see TROUBLESHOOTING below. |
| 171 |
|
| 172 |
8) Doing a : |
| 173 |
|
| 174 |
make install |
| 175 |
|
| 176 |
will install everything in the "standard" perl places, just like |
| 177 |
stuff from the base perl distribution. |
| 178 |
|
| 179 |
9) Enjoy! |
| 180 |
|
| 181 |
If your enjoyment is ruined (:-) because the module doesn't work |
| 182 |
right, peruse the Curses pod document (located at the end of |
| 183 |
"Curses.pm") for incompatibilities with other Perl programs. Also |
| 184 |
check the end of the "README" for problems that may exist for your |
| 185 |
particular libcurses.a or operating system. |
| 186 |
|
| 187 |
|
| 188 |
TROUBLESHOOTING |
| 189 |
|
| 190 |
Virtually all failures people experience with the Curses module are due to |
| 191 |
failures with the system Curses library (libcurses), so if "perl demo" |
| 192 |
doesn't work, to isolate the problem, try running the program 'cdemo', |
| 193 |
which does the same things from C, i.e. not inolving Perl at all. |
| 194 |
|
| 195 |
$ make cdemo |
| 196 |
$ ./cdemo |
| 197 |
|
| 198 |
'cdemo' is compiled from C, using the same compilation and linking options |
| 199 |
as the Perl module. If it fails, then your problem has nothing to do with |
| 200 |
Perl. |
| 201 |
|
| 202 |
When there is a problem with the system Curses library, it is almost always |
| 203 |
that the build system didn't find it at all. That doesn't produce the nice |
| 204 |
build error message you might expect, because the build system is designed |
| 205 |
to deal with Curses libraries that are missing various functions, and when |
| 206 |
it can't find the library at all, tends to proceed happily as if the |
| 207 |
library is there but just missing _all_ the functions. You don't see a |
| 208 |
problem until run time. |
| 209 |
|
| 210 |
But it is easy to see if your problem is a with the system Curses library |
| 211 |
not being found. You'll see hundreds of messages when you run 'make' as |
| 212 |
the builder investigates your system Curses library telling you that it's |
| 213 |
not finding any of the Curses functions. |
| 214 |
|
| 215 |
The first thing 'make' does is create the file "CursesDef.h" by running the |
| 216 |
program 'testsyms', which investigates what the Curses libraries are like |
| 217 |
on your system. |
| 218 |
|
| 219 |
'testsyms' is very brittle -- it works via test compiles, and if any number |
| 220 |
of things goes wrong with the test compile, it makes bad assumptions, |
| 221 |
usually that you don't have a certain function in your Curses library. If |
| 222 |
'testsyms' tells you it can't find functions that you think you have, run |
| 223 |
the make with variable TESTSYMS_OPTS set to "-v": |
| 224 |
|
| 225 |
$ make TESTSYMS_OPTS=-v |
| 226 |
|
| 227 |
That will show you the error messages from the test compiles and you can |
| 228 |
figure out what's going wrong and fix it. Typically, you'll find that you |
| 229 |
need to do better on your CURSES_* environment variables (see above). |
| 230 |
|
| 231 |
Alternatively, if you see that 'testsyms' is picking the wrong values, you |
| 232 |
can edit "CursesDef.h" by hand and follow the directions. If you have to |
| 233 |
"roll your own", be sure to save a copy. A "make clean" will delete |
| 234 |
"CursesDef.h". |
| 235 |
|
| 236 |
|
| 237 |
|
| 238 |
|
| 239 |
(But if you were watching, you would have seen |
| 240 |
hundreds of informational messages telling you that the build system was |
| 241 |
not finding any of the Curses functions in the library). |
| 242 |
|
| 243 |
|
| 244 |
|
| 245 |
HP-UX |
| 246 |
----- |
| 247 |
|
| 248 |
HP-UX has two Curses libraries. According to HP: |
| 249 |
|
| 250 |
Libraries libcur_colr.a and libcur_colr.sl, and commands |
| 251 |
captoinfo_colr, infocmp_colr, tput_colr, and tic_colr are |
| 252 |
part of HP-UX Color-Curses package used for color-management. |
| 253 |
|
| 254 |
And there is apparently also a library with the standard names. |
| 255 |
The Curses Perl module builds using the standard library by default. |
| 256 |
If you want to use the "color" versions, set the CURSES_CFLAGS and |
| 257 |
CURSES_LDFLAGS environment variables accordingly. |
| 258 |
|
| 259 |
HP recommends using the HP ANSI C compiler for everything but |
| 260 |
compiling the kernel, but the one for compling the kernel is the |
| 261 |
default. (Seems ridiculous, but an HP user said so). I don't know |
| 262 |
what difference it makes for the Perl Curses module, but if you |
| 263 |
want to use the ANSI compiler, add this to Makefile.PL's arguments: |
| 264 |
|
| 265 |
CC=/opt/ansic/bin/cc |
| 266 |
|
| 267 |
|
| 268 |
PDCURSES |
| 269 |
-------- |
| 270 |
|
| 271 |
Pdcurses is a public domain Curses implementation that works on DOS, |
| 272 |
OS/2, Win32, and X11. http://pdcurses.sourceforge.net . |
| 273 |
|
| 274 |
Dave C reported success using Perl Curses with Pdcurses on Windows |
| 275 |
in September 2007. He gave these notes: |
| 276 |
|
| 277 |
Environment: |
| 278 |
Perl Version 5.8.1 built for MSWin32-x86-multi-thread |
| 279 |
MSVS 2003 Visual C++ 7 |
| 280 |
Windows XP |
| 281 |
Perl module Curses-1.16 |
| 282 |
Pdcurses 3.3 |
| 283 |
|
| 284 |
Instructions: |
| 285 |
|
| 286 |
- Set environment variables (for Perl Curses Makefile.PL): |
| 287 |
|
| 288 |
CURSES_CFLAGS='-Ic:\dev\pdc33' |
| 289 |
CURSES_LDFLAGS='-Lc:\dev\pdc33 pdcurses.lib' |
| 290 |
|
| 291 |
- Build and Test |
| 292 |
|
| 293 |
> Makefile.PL |
| 294 |
> nmake test |
| 295 |
|
| 296 |
ignore MOUSE_MOVED redefined warning |
| 297 |
MOUSE_MOVED is never used in Curses 1.16 |
| 298 |
|
| 299 |
- Install: |
| 300 |
|
| 301 |
> nmake install |
| 302 |
|
| 303 |
|
| 304 |
- Test: |
| 305 |
|
| 306 |
demo, demo2, demo.panel programs successfully run |
| 307 |
|
| 308 |
> nmake cdemo |
| 309 |
> cdemo |
| 310 |
|
| 311 |
|
| 312 |
Alexandr Ciornii on September 22, 2006, reported that he had some success |
| 313 |
using Perl Curses with Pdcurses, with these notes: |
| 314 |
|
| 315 |
I've encountered several problems with it: |
| 316 |
|
| 317 |
1. 'pdcurses.h' does not exist; only 'curses.h'. Renamed it. |
| 318 |
2. 'curses.h' also defines chtype and attr_t. Commented out there. |
| 319 |
3. 'curses.h' also defines SCREEN. Commented out in 'CursesTyp.h'. |
| 320 |
4. `perl demo` fails |
| 321 |
|
| 322 |
Curses function 'TIESCALAR' called with too few arguments at |
| 323 |
C:\cpan\Curses-1.14\blib\lib/Curses.pm line 82. |
| 324 |
Compilation failed in require at demo line 11. |