Document explicitly what m-prefix does to each command
[aNetHack.git] / win / X11 / Install.X11
blobdff03f84ba445ae09e57758533629e7343928d5c
1 $NHDT-Date$  $NHDT-Branch$:$NHDT-Revision$
3 This document describes the installation of NetHack with an X11 interface.
5 There are no explicit UNIX dependencies in this code, but we have only
6 tested it under UNIX, using X11R4, X11R5, or X11R6.  We have two reports
7 that the code also works under DesqView/X on MS-DOS with djgpp, but you
8 will have to add dependencies for the X code to that makefile before you
9 can use it.  Other X11R4+ platforms may work as well, with some tweaking
10 likely.  Follow WIN* in sys/unix/Makefile.src for compilation hints.
12 (If you try to compile it with X11R3 or earlier, you will get many errors,
13 starting with complaints about XtPointer not being declared.  If you get
14 around the compilation problems, you will still need a recent library of
15 Athena Widgets to link against.  Once compiled, you can probably run it
16 under an R3 X server, though.)
18 The reason this uses the Athena widget set is that the Athena widgets come
19 free from MIT (like X11).  Unfortunately, the companies that resell X11
20 (value subtracted er, added software; yea, yea, that's the ticket) usually
21 discourage its use by either omitting the set or putting it on the
22 "unsupported" portion of their tape.  If you do not have the Athena
23 widgets, you may obtain them via anonymous ftp from ftp.x.org.
26 To use this code, define X11_GRAPHICS in include/config.h.  (You can comment
27 out TTY_GRAPHICS or change DEFAULT_WINDOW_SYS if you want to, but there's
28 little reason to do so.  The X11 version almost requires a config file
29 for full effect, so you can just as well set windowtype there; also, you
30 or someone else might just possibly be stuck in a situation where you can't
31 use the X version -- over a non-blindingly-fast modem, say.)  You may also
32 want to define USE_XPM or GRAPHIC_TOMBSTONE as discussed below.
34 In src/Makefile, add $(WINX11SRC), $(WINX11OBJ), and $(WINX11LIB) to
35 WINSRC, WINOBJ, and WINLIB respectively, and compile.  This will give you
36 an executable supporting both X11 and tty windowing.
39 If you want to use the optional tiles (multicolored pictures instead of a
40 replacement font), you will need to have the win/share files and change
41 the VARDATND setting in the top Makefile to contain the tile files before
42 you do your 'make all'.
44 If you get a linker error referring to `substitute_tiles' then most
45 likely you have overlooked the WINSRC, WINOBJ, WINLIB step above.
46 Alternatively, you are building with more than one non-tty interface
47 specified but haven't followed the direction in src/Makefile to remove
48 all but one instance of tile.o from the WINxxxOBJ values used for WINOBJ.
50 When using tiles, you have the option of defining USE_XPM in config.h.
51 This causes NetHack to use the XPM file format for the "x11tiles" file
52 rather than a custom format.  Since the XPM format can be processed by
53 existing tools such as PBMPlus and XV, you can modify the tiles to suit
54 your environment.  However, you need to make sure the number of tiles
55 in each row of the image remains the same (currently 40), as the code
56 depends on this to calculate the size of each tile. For example, you may
57 magnify them for display on high-resolution screens using the following
58 command:
59     xpmtoppm x11tiles | pnmscale -xscale 1 -yscale 1.6875 |
60         pnmdepth 255 | ppmquant 100 | ppmtoxpm >x11tiles_big.xpm
61 To use XPM, you must have the free XPM libraries installed in your system.
62 Official xpm releases can be found by ftp on:
63     ftp.x.org       (198.4.202.8)  contrib/libraries     (Boston, USA)
64     avahi.inria.fr  (138.96.12.1)  pub/xpm     (Sophia Antipolis, France)
65 If you do choose to define USE_XPM, be sure to add "-lXpm" to WINX11LIB
66 in src/Makefile.
68 If you define USE_XPM in config.h, you may also define GRAPHIC_TOMBSTONE
69 which causes the closing tombstone to be displayed from the image file
70 specified by the "tombstone" X resource (rip.xpm by default).  In this
71 case, make sure the top Makefile VARDATND also contains rip.xpm.
74 Whether or not you install tile support, you can provide support for
75 special graphics symbols via alternate fonts.  (The fonts and tiles
76 cannot be used at the same time, but the same executable handles both.)
77 The two included X11 fonts use the general NetHack map area remapping
78 to represent object/dungeon/trap/effect characters (see win/X11/nethack.rc
79 and the Guidebook) as monocolored symbols and monsters as monocolored
80 letters.  For instance, a ruby potion will show up as a potion symbol in
81 red.  It's easier to see the difference between fonts and tiles than to
82 describe it. :-)  Unless you are the only one using your executable and
83 you already know which you prefer, we suggest installing the optional files
84 for both possibilities and letting each person decide for themselves.
86 To use the included fonts, you will need to install one or both of them
87 and then use the symbol mappings found in nethack.rc.  The fonts are found
88 in nh10.bdf and ibm.bdf.  You first need to convert the bdf files to whatever
89 form your X11 server recognizes (usually using a command called bdftosnf
90 for R4 servers or bdftopcf for R5 servers).  Then run mkfontdir on the
91 directory containing your font files (you might want to copy them to HACKDIR,
92 from the top Makefile, after you've done "make install").  If these commands
93 aren't familiar, talk to your local X11 guru and read the man pages.
95 nethack.sh automatically adds HACKDIR to your font search path.  If
96 you (assuming you are a system administrator) can install the fonts in your
97 standard X11 font directory the relevent lines in nethack.sh can be removed.
98 Alternatively, all persons playing nethack must add that "xset fp+"
99 command to their .xinitrc file, or whatever file they execute when starting
100 X11.  See the note below for the alternative installation procedure
101 for Sun's OpenWindows.
104 If your X11 include files and libraries are not installed in a standard
105 place (i.e. /usr/include/X11 and /usr/lib respectively) you will need to
106 prepend an appropriate -I<idirectory> parameter to CFLAGS and a
107 -L<ldirectory> parameter to LFLAGS, setting <?directory> to the place to
108 find the include and library files for X11.
111 Finally, to ensure NetHack's windows look the way they were intended to
112 look, make sure the top Makefile VARDATND also contains NetHack.ad.  If it
113 does, running nethack will automatically take the appropriate steps to
114 cause this file to be used to initialize NetHack's X11 resources.
117 Three icon suggestions to the window manager are supported:  nh72, nh56,
118 and nh32.  Data for them comes from the source files nh72icon, nh56icon,
119 and nh32icon; they are compiled into the program via #includes in winX.c.
120 Selection between them is controlled by the "icon" resource in NetHack.ad;
121 the default is nh72.
124 Sorry, an Imakefile is not included.  Unlike many X11 programs, X11
125 support is only a small, optional, part of nethack, and the Makefile is
126 needed for systems that don't use X11.
129 Notes for Sun's OpenWindows:
130     1.  For OpenWindows 3.0 (NOT 2.x), define OPENWINBUG in include/unixconf.h.
131         The library bug from SunOS 4.1.x is fixed in Solaris 2.x (or when
132         proper Sun patches have been applied to 4.1.x), so it is also
133         unnecessary there.  (Defining it when unnecessary causes the same
134         problem being avoided when it is necessary. :-)
136     2.  In addition to the changes suggested by the comments in src/Makefile,
138         -- for OpenWindows 2.x and 3.0 (NOT 3.1) (i.e., versions for SunOS 4.x),
139            add -I/usr/openwin/include to CFLAGS, -L/usr/openwin/lib to LFLAGS,
140            and -lm to WINX11LIB in src/Makefile.
142         -- for OpenWindows 3.1 (i.e., versions for Solaris 2.x), add
143            -I/usr/openwin/include to CFLAGS, -L/usr/openwin/lib -L/usr/ccs/lib
144            -R/usr/openwin/lib to LFLAGS, and -lsocket -lnsl -lm
145            to WINX11LIB in src/Makefile.
147         (Naturally, if your OpenWindows is installed elsewhere, adapt the
148         openwin paths.)  This will allow you to create a game executable.
150     3.  Run the fonts through convertfont and run bldfamily on the directory.
151         Now you must let your X server know where to find the fonts.  For a
152         personal installation, the simplest thing is to include the directory
153         of the fonts in the environment variable FONTPATH, as set in your
154         .profile or .login before starting the server.  For a multi-user
155         installation, you have the various "xset fp+" options outlined
156         above for standard X.
158     4.  Something must still be done with the NetHack.ad file -- all three
159         of the possibilities mentioned for standard X11 should work.
162 Notes for AIX 3.2:
163     1.  AIX 3.2 includes the Athena Widget Toolkit library (and other things)
164         under the /usr/lpp/X11/Xamples tree, so you will have to add
165         -L/usr/lpp/X11/Xamples/lib to LFLAGS.  If you can't find libXaw.a on
166         your first build, go into /usr/lib/X11/Xamples, read the README file,
167         and build the library.
169 Notes for XFree86 - (on linux and BSD386 platforms)
171     1.  Edit src/Makefile for linux/BSD386. Even though you use the 
172         Open Look Window manager, do not define OPENWINBUG.  Use the 
173         standard X11 object and library options.
175     2.  Follow the standard installation directions defined above.
178 File                            Description
179 ---------       ---------------------------------------------------------------
180 nethack.rc      - A sample configuration file for fonts nh10 and ibm.
181 nh10.bdf        - A modified version of the 10x20 standard font.
182 ibm.bdf         - A modified version of one of the ibm (8x14) nethack font.
183                   Must be used in conjunction with NetHack.ad or nethack.rc.
184 nh32icon        - A 32x32 icon bitmap for use with window managers.
185 nh56icon        - A 56x56 icon bitmap for use with window managers.
186 nh72icon        - A 72x72 icon bitmap for use with window managers.
187 nh_icon.xpm     - A color icon for use with window managers.
188 NetHack.ad      - A sample .Xdefaults for a color screen.
189 ../../include/Window.h
190 ../../include/WindowP.h
191 Window.c        - A bare-bones widget that has 16 colors and a drawing canvas.
192 ../../include/winX.h
193                 - Defines for the X window-port.
194 win*.c          - Code for the X window-port
195 dialogs.c       - A better dialog widget.  Original code (modified slightly
196                   by Dean Luick) distributed under the X copyright by Tim
197                   Theisen.  This is from his Ghostview program (which is under
198                   the GNU public license, v2 or higher).
199 pet_mark.xbm    - A pet indicator bitmap for tiles.
200 pilemark.xbm    - Item pile indicator for tiles.
201 rip.xpm         - A graphical tombstone.
202 tile2x11.c      - Converts win/share tiles for X11 use.