Package: slashem / 0.0.7E7F3-7

slashem-debian.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
Description: Debian-specific patchset for slashem
 This is a collection of patches against slashem specifically for Debian.
 (TODO: Separate this gigantic patch into several smaller quilt-style patches)
Forwarded: not-needed
Last-Update: 05-13-2012

--- a/include/config.h
+++ b/include/config.h
@@ -7,6 +7,8 @@
 
 #undef SHORT_FILENAMES
 
+/* Include Debian specific magic */
+#include "debian.h"
 
 /*#define DEBUG*/
 /*#define DDEBUG*/
@@ -50,8 +52,8 @@
  * Define all of those you want supported in your binary.
  * Some combinations make no sense.  See the installation document.
  */
-#define TTY_GRAPHICS		/* good old tty based graphics */
-/* #define X11_GRAPHICS */	/* X11 interface */
+/* #define TTY_GRAPHICS	*/	/* good old tty based graphics */
+/* #define X11_GRAPHICS */      /* X11 interface */
 /* #define QT_GRAPHICS */	/* Qt Interface */
 /* #define KDE */		/* KDE Interface */
 /* #define GTK_GRAPHICS */	/* GTK Interface */
@@ -111,7 +113,7 @@
 # define USE_XPM		/* Use XPM format for images (required) */
 # define GRAPHIC_TOMBSTONE	/* Use graphical tombstone (rip.xpm) */
 # ifndef DEFAULT_WINDOW_SYS
-#  define DEFAULT_WINDOW_SYS "Qt"
+/* #  define DEFAULT_WINDOW_SYS "Qt"  /* Evil Qt windowing port */
 # endif
 #endif
 
@@ -179,7 +181,7 @@
  *  xpmtoppm <x11tiles.xpm | pnmscale 1.25 | pnmdepth 255 |
  *     ppmquant 90 | ppmtoxpm >x11tiles_big.xpm
  */
-/* # define USE_XPM */		/* Disable if you do not have the XPM library */
+# define USE_XPM		/* Disable if you do not have the XPM library */
 # ifdef USE_XPM
 #  define GRAPHIC_TOMBSTONE	/* Use graphical tombstone (rip.xpm) */
 # endif
@@ -202,7 +204,7 @@
 
 #ifndef WIZARD		/* allow for compile-time or Makefile changes */
 # ifndef KR1ED
-#  define WIZARD  "wizard" /* the person allowed to use the -D option */
+#  define WIZARD  "root" /* the person allowed to use the -D option */
 # else
 #  define WIZARD
 #  define WIZARD_NAME "wizard"
@@ -230,12 +232,12 @@
 
 #ifdef UNIX
 /* path and file name extension for compression program */
-# define COMPRESS "/usr/bin/compress" /* Lempel-Ziv compression */
-# define COMPRESS_EXTENSION ".Z"	     /* compress's extension */
+/* # define COMPRESS "/usr/bin/compress" */  /* Lempel-Ziv compression */
+/* # define COMPRESS_EXTENSION ".Z" */	     /* compress's extension */
 
 /* An example of one alternative you might want to use: */
-/* # define COMPRESS "/usr/local/bin/gzip" */   /* FSF gzip compression */
-/* # define COMPRESS_EXTENSION ".gz" */	     /* normal gzip extension */
+# define COMPRESS "/bin/gzip"    /* FSF gzip compression */
+# define COMPRESS_EXTENSION ".gz" 	/* normal gzip extension */
 
 /* # define COMPRESS "/usr/bin/bzip2"	*//* bzip2 compression */
 /* # define COMPRESS_EXTENSION ".bz2"	*//* bzip2 extension */
@@ -249,7 +251,7 @@
  *	a tar-like file, thus making a neater installation.  See *conf.h
  *	for detailed configuration.
  */
-/* #define DLB */             /* not supported on all platforms */
+#define DLB             /* not supported on all platforms */
 
 /*
  *	Defining INSURANCE slows down level changes, but allows games that
@@ -282,7 +284,7 @@
  * since the user might create files in a directory of his choice.
  * Of course SECURE is meaningful only if HACKDIR is defined.
  */
-/* #define SECURE */	/* do setuid(getuid()) after chdir() */
+#define SECURE	/* do setuid(getuid()) after chdir() */
 
 /*
  * If it is desirable to limit the number of people that can play Hack
--- /dev/null
+++ b/include/debian.h
@@ -0,0 +1,38 @@
+/* Configuration of Slash'em for Debian:
+ *
+ * This file includes a bit of magic to make it posible to build several
+ * window interfaces in seperate binaries without patching config.h.
+ */
+
+#if defined DEBIAN_TTY
+# define TTY_GRAPHICS
+# define NH_CONFIG_FILE     ".slashemrc"
+#endif
+
+#if defined DEBIAN_X11
+# define X11_GRAPHICS
+# define DEFAULT_WC_TILED_MAP
+# define DEFAULT_WINDOW_SYS "X11"
+# define NH_CONFIG_FILE     ".slashemrc-x11"
+#endif
+
+#if defined DEBIAN_SDL
+# define SDL_GRAPHICS
+# define DEFAULT_WC_TILED_MAP
+# define NH_CONFIG_FILE	    ".slashemrc-sdl"
+#endif
+
+#if defined DEBIAN_GTK
+# define PROXY_GRAPHICS
+# define GTK_GRAPHICS
+# define GTK_PROXY
+# define DEFAULT_WC_TILED_MAP
+# define NH_CONFIG_FILE     ".slashemrc-gtk"
+#endif
+
+#if defined DEBIAN_QT
+# define QT_GRAPHICS
+# define NH_CONFIG_FILE     ".slashemrc-qt"
+#endif
+
+#define USE_XPM
--- a/include/file.h
+++ b/include/file.h
@@ -41,3 +41,7 @@
 
 /* Environment Options Name */
 #define NETHACK_ENV_OPTIONS "@UPPER@OPTIONS"
+
+/* Include Debian configuration to overrule NH_CONFIG_FILE */
+#include "debian.h"
+
--- a/include/global.h
+++ b/include/global.h
@@ -35,7 +35,7 @@
 #define NH_CMDHELPAREA	FILE_AREA_SHARE
 #define NH_HISTORY		"history"	/* a file giving nethack's history */
 #define NH_HISTORY_AREA	FILE_AREA_SHARE
-#define NH_LICENSE		"license"	/* file with license information */
+#define NH_LICENSE		"copyright"	/* file with license information */
 #define NH_LICENSE_AREA	FILE_AREA_DOC
 #define NH_OPTIONFILE	"opthelp"	/* a file explaining runtime options */
 #define NH_OPTIONAREA	FILE_AREA_SHARE
--- a/include/unixconf.h
+++ b/include/unixconf.h
@@ -20,9 +20,11 @@
  */
 
 /* define exactly one of the following four choices */
-/* #define BSD 1 */	/* define for 4.n/Free/Open/Net BSD  */
+#if defined(__FreeBSD_kernel__)
+#define BSD 1	/* define for 4.n/Free/Open/Net BSD  */
 			/* also for relatives like SunOS 4.x, DG/UX, and */
 			/* older versions of Linux */
+#endif
 /* #define ULTRIX */	/* define for Ultrix v3.0 or higher (but not lower) */
 			/* Use BSD for < v3.0 */
 			/* "ULTRIX" not to be confused with "ultrix" */
@@ -33,12 +35,14 @@
 
 
 /* define any of the following that are appropriate */
-#define SVR4		/* use in addition to SYSV for System V Release 4 */
+/* #define SVR4	*/	/* use in addition to SYSV for System V Release 4 */
 			/* including Solaris 2+ */
 #define NETWORK		/* if running on a networked system */
 			/* e.g. Suns sharing a playground through NFS */
 /* #define SUNOS4 */	/* SunOS 4.x */
-/* #define LINUX */	/* Another Unix clone */
+#if defined(__linux__)
+#define LINUX   	/* Another Unix clone */
+#endif
 /* #define CYGWIN32 */	/* Unix on Win32 -- use with case sensitive defines */
 /* #define GENIX */	/* Yet Another Unix Clone */
 /* #define HISX */	/* Bull Unix for XPS Machines */
@@ -113,7 +117,7 @@
  * FILE_AREA_DOC	For human-readable documentation
  */
 
-/* #define FILE_AREAS */		/* Use file areas */
+#define FILE_AREAS		/* Use file areas */
 
 #ifdef FILE_AREAS
 
--- a/src/options.c
+++ b/src/options.c
@@ -169,7 +169,7 @@
 #else
 	{"news", (boolean *)0, FALSE, SET_IN_FILE},
 #endif
-	{"null", &flags.null, TRUE, SET_IN_GAME},
+	{"null", &flags.null, FALSE, SET_IN_GAME},
 #ifdef MAC
 	{"page_wait", &flags.page_wait, TRUE, SET_IN_GAME},
 #else
--- a/src/topten.c
+++ b/src/topten.c
@@ -33,7 +33,7 @@
 #define NAMSZ	10
 #define DTHSZ	100
 #define ROLESZ   3
-#define PERSMAX	 3		/* entries per name/uid per char. allowed */
+#define PERSMAX	 10		/* entries per name/uid per char. allowed */
 #define POINTSMIN	1	/* must be > 0 */
 #define ENTRYMAX	100	/* must be >= 10 */
 
--- a/sys/unix/Makefile.src
+++ b/sys/unix/Makefile.src
@@ -1,3 +1,6 @@
+# Determine kernel name
+UNAME := $(shell uname -s)
+
 #	NetHack Makefile.
 #	SCCS Id: @(#)Makefile.src	3.4	2002/03/02
 
@@ -122,13 +125,18 @@
 # CFLAGS = -O -I../include -I/usr/X11/include
 # LFLAGS = -L/usr/X11/lib
 
-# flags for Linux
+# flags for Linux and kFreeBSD
 #   compile normally
-# CFLAGS = -O2 -fomit-frame-pointer -I../include
-# LFLAGS = -L/usr/X11R6/lib
+#   disable optimization on non-Linux archs due to FTBFS
+ifeq ($(UNAME),Linux)
+CFLAGS = -DDEBIAN_$(GUI) -O2 -fomit-frame-pointer -fstack-protector --param=ssp-buffer-size=4 -I../include -I/usr/X11R6/include
+else
+CFLAGS = -DDEBIAN_$(GUI) -fstack-protector --param=ssp-buffer-size=4 -I../include -I/usr/X11R6/include
+endif
+LFLAGS = -L/usr/X11R6/lib -Wl,-z,relro
 #   OR compile backwards compatible a.out format
-# CFLAGS = -O2 -b i486-linuxaout -fomit-frame-pointer -I../include
-# LFLAGS = -b i486-linuxaout -L/usr/X11R6/lib
+# CFLAGS = -O2 -b i486-linuxaout -fomit-frame-pointer -I../include -I/usr/X11/include
+# LFLAGS = -b i486-linuxaout -L/usr/X11/lib
 
 # flags for BeOS
 #   on a Mac/BeBox:
@@ -144,8 +152,8 @@
 # flags for debugging:
 # CFLAGS = -g -I../include
 
-CFLAGS = -O -I../include
-LFLAGS =
+# CFLAGS = -O -I../include
+# LFLAGS =
 
 # Only used for the Gnome interface.
 # When including the Gnome interface, you need to include gnome specific
@@ -163,6 +171,7 @@
 # RedHat 6.1
 # QTDIR = /usr/lib/qt-2.0.1
 #
+QTDIR= /usr
 QTLIBDIR=$(QTDIR)/lib
 QTINCDIR=$(QTDIR)/include
 QTBINDIR=$(QTDIR)/bin
@@ -178,10 +187,12 @@
 # The Qt and Be window systems are written in C++, while the rest of
 # NetHack is standard C.  If using Qt, uncomment the LINK line here to get
 # the C++ libraries linked in.
-CXXFLAGS = $(CFLAGS) -I. -I$(QTINCDIR)
-# Qt is C++, so define the compiler and linker thus required:
-CXX=g++
-#LINK=g++
+ifeq ($(GUI), "QT")
+  CXXFLAGS = $(CFLAGS) -I. -I$(QTINCDIR)
+  # Qt is C++, so define the compiler and linker thus required:
+  CXX=g++
+  LINK=g++
+endif
 #	For cross-compiling, eg. with gcc on Linux (see also CC further up):
 #CXX=arm-linux-g++
 #LINK=arm-linux-gcc
@@ -291,27 +302,37 @@
 SDLGL_CFLAGS = `sdl-config --cflags`
 
 # Use these declarations if you only want to support the TTY windowing system
-WINSRC = $(WINTTYSRC)
-WINOBJ = $(WINTTYOBJ)
+ifeq ($(GUI),TTY)
+  WINSRC = $(WINTTYSRC)
+  WINOBJ = $(WINTTYOBJ)
+endif
 # Use these declarations if you want to support the X11 windowing system
-# WINSRC = $(WINTTYSRC) $(WINX11SRC)
-# WINOBJ = $(WINTTYOBJ) $(WINX11OBJ)
+ifeq ($(GUI),X11)
+  WINSRC = $(WINTTYSRC) $(WINX11SRC)
+  WINOBJ = $(WINTTYOBJ) $(WINX11OBJ)
+endif
 # Use these declarations if you want to support the Qt windowing system
-# WINSRC = $(WINTTYSRC) $(WINQTSRC)
-# WINOBJ = $(WINTTYOBJ) $(WINQTOBJ)
+ifeq ($(GUI),QT)
+  WINSRC = $(WINTTYSRC) $(WINQTSRC)
+  WINOBJ = $(WINTTYOBJ) $(WINQTOBJ)
+endif
 # Use these declarations if you want to support a conventional
 # GTK windowing system (only useful if not installing setuid or setgid)
 # WINSRC = $(WINTTYSRC) $(WINGTKSRC) $(PROXYUTLSRC)
-# WINOBJ = $(WINTTYOBJ) $(WINGTKOBJ) $(PROXYUTLOBJ)
+###INOBJ = $(WINTTYOBJ) $(WINGTKOBJ) $(PROXYUTLOBJ)
 # Use these declarations if you want to support external windowing systems
 # and a proxified GTK windowing system (see Install.GTK)
-# WINSRC = $(WINTTYSRC) $(WINGTKSRC) \
-#	$(WINPROXYSRC) $(PROXYUTLSRC) $(PROXYCOMSRC) $(PROXYCLNTSRC)
-# WINOBJ = $(WINTTYOBJ) $(WINGTKOBJ) \
-#	$(WINPROXYOBJ) $(PROXYUTLOBJ) $(PROXYCOMOBJ) $(PROXYCLNTOBJ)
+ifeq ($(GUI),GTK)
+  WINSRC = $(WINTTYSRC) $(WINGTKSRC) \
+ 	$(WINPROXYSRC) $(PROXYUTLSRC) $(PROXYCOMSRC) $(PROXYCLNTSRC)
+  WINOBJ = $(WINTTYOBJ) $(WINGTKOBJ) \
+ 	$(WINPROXYOBJ) $(PROXYUTLOBJ) $(PROXYCOMOBJ) $(PROXYCLNTOBJ)
+endif
 # Use these declarations to only support the SDL/GL windowing systems
-# WINSRC = $(WINGLSRC)
-# WINOBJ = $(WINGLOBJ)
+ifeq ($(GUI),SDL)
+  WINSRC = $(WINGLSRC)
+  WINOBJ = $(WINGLOBJ)
+endif
 # Use these declarations if you want to support external windowing systems
 # WINSRC = $(WINTTYSRC) $(WINPROXYSRC) $(PROXYUTLSRC) $(PROXYCOMSRC)
 # WINOBJ = $(WINTTYOBJ) $(WINPROXYOBJ) $(PROXYUTLOBJ) $(PROXYCOMOBJ)
@@ -336,12 +357,12 @@
 # WINTTYLIB = -ltermcap
 # WINTTYLIB = -lcurses
 # WINTTYLIB = -lcurses16
-# WINTTYLIB = -lncurses
-WINTTYLIB = -ltermlib
+WINTTYLIB = -lncurses
+# WINTTYLIB = -ltermlib
 #
 # libraries for X11
 # If USE_XPM is defined in config.h, you will also need -lXpm here.
-WINX11LIB = -lXaw -lXmu -lXext -lXt -lX11
+WINX11LIB = -lXaw -lXmu -lXext -lXt -lX11 -lXpm
 # WINX11LIB = -lXaw -lXmu -lXt -lX11
 # WINX11LIB = -lXaw -lXmu -lXext -lXt -lXpm -lX11 -lm
 # WINX11LIB = -lXaw -lXmu -lXpm -lXext -lXt -lX11 -lSM -lICE -lm # BSD/OS 2.0
@@ -366,24 +387,35 @@
 #
 # libraries for SDL/GL window port
 WINSDLLIB = `sdl-config --libs` -lz -lpng
-WINGLLIB = -lGL
+WINGLLIB = 
 #
 # libraries for proxy
 WINPROXYLIB = -lpthread
 
 # Use this declaration if you only want to support the TTY windowing system
-WINLIB = $(WINTTYLIB)
+ifeq ($(GUI),TTY)
+  WINLIB = $(WINTTYLIB)
+endif
 # Use this declaration if you want to support the X11 windowing system
-# WINLIB = $(WINTTYLIB) $(WINX11LIB)
+ifeq ($(GUI),X11)
+  WINLIB = $(WINTTYLIB) $(WINX11LIB)
+endif
 # Use this declaration if you want to support the Qt windowing system
-# WINLIB = $(WINTTYLIB) $(WINQTLIB)
+ifeq ($(GUI),QT)
+  WINLIB = $(WINTTYLIB) $(WINQTLIB)
+endif
 # Use this declaration if you want to support a conventional
 # GTK windowing system (only useful if not installing setuid or setgid)
 # WINLIB = $(WINTTYLIB) $(WINGTKLIB)
 # Use this declaration if you want to support external windowing systems
 # and a proxified GTK windowing system (see Install.GTK)
-# WINLIB = $(WINTTYLIB) $(WINGTKLIB) $(WINPROXYLIB)
+ifeq ($(GUI),GTK)
+  WINLIB = $(WINTTYLIB) $(WINGTKLIB) $(WINPROXYLIB)
+endif
 # Use this declaration to only support the SDL/GL windowing system
+ifeq ($(GUI),SDL)
+  WINLIB = $(WINSDLLIB)
+endif
 # WINLIB = $(WINGLLIB)
 # Use this declaration if you want to support external windowing systems
 # WINLIB = $(WINTTYLIB) $(WINPROXYLIB)
@@ -530,7 +562,7 @@
 
 Sysunix:	$(HOBJ) Makefile
 	@echo "Loading ..."
-	@$(LINK) $(LFLAGS) -o $(GAME) $(HOBJ) $(WINLIB) $(LIBS)
+	$(LINK) $(LFLAGS) -o $(GAME) $(HOBJ) $(WINLIB) $(LIBS) -lm
 	@touch Sysunix
 
 Sys3B2:	$(HOBJ) Makefile
--- a/sys/unix/Makefile.top
+++ b/sys/unix/Makefile.top
@@ -17,12 +17,12 @@
 PREFIX   = /usr
 GAME     = slashem
 # GAME     = slashem.prg
-GAMEUID  = games
-GAMEGRP  = bin
+GAMEUID  = root
+GAMEGRP  = games
 
 # Permissions - some places use setgid instead of setuid, for instance
 # See also the option "SECURE" in include/config.h
-GAMEPERM = 04755
+GAMEPERM = 02755
 FILEPERM = 0644
 EXEPERM  = 0755
 DIRPERM  = 0755
@@ -40,16 +40,16 @@
 # These must agree with the definitions in unixconf.h
 
 # Defs. for non file areas support.
-GAMEDIR  = $(PREFIX)/local/slashemdir
-VARDIR = $(GAMEDIR)
-FILE_AREA_VAR = $(VARDIR)
-FILE_AREA_SAVE = $(VARDIR)/save
-FILE_AREA_SHARE = $(GAMEDIR)
-FILE_AREA_UNSHARE = $(GAMEDIR)
-FILE_AREA_DOC = $(GAMEDIR)
-FILE_AREA_BONES = $(FILE_AREA_VAR)
-FILE_AREA_LEVL = $(FILE_AREA_VAR)
-SHELLDIR = $(PREFIX)/local/bin
+# GAMEDIR  = $(PREFIX)/local/slashemdir
+# VARDIR = $(GAMEDIR)
+# FILE_AREA_VAR = $(VARDIR)
+# FILE_AREA_SAVE = $(VARDIR)/save
+# FILE_AREA_SHARE = $(GAMEDIR)
+# FILE_AREA_UNSHARE = $(GAMEDIR)
+# FILE_AREA_DOC = $(GAMEDIR)
+# FILE_AREA_BONES = $(FILE_AREA_VAR)
+# FILE_AREA_LEVL = $(FILE_AREA_VAR)
+# SHELLDIR = $(PREFIX)/local/bin
 
 # Defs. compatible with Linux's FSSTND 1.2
 # FILE_AREA_VAR = /var/lib/games/slashem
@@ -62,14 +62,15 @@
 # SHELLDIR = /usr/games
 
 # Defs. compatible with FHS 2.0
-# FILE_AREA_VAR = /var/games/slashem
-# FILE_AREA_SAVE = /var/games/slashem/save
-# FILE_AREA_SHARE = /usr/share/games/slashem
-# FILE_AREA_UNSHARE = /usr/lib/games/slashem
-# FILE_AREA_DOC = /usr/share/doc/slashem
-# FILE_AREA_BONES = $(FILE_AREA_VAR)
-# FILE_AREA_LEVL = $(FILE_AREA_VAR)
-# SHELLDIR = /usr/games
+FILE_AREA_VAR = $(PREFIX)/var/games/slashem
+FILE_AREA_SAVE = $(PREFIX)/var/games/slashem/save
+FILE_AREA_SHARE = $(PREFIX)/usr/share/games/slashem
+FILE_AREA_UNSHARE = $(PREFIX)/usr/lib/games/slashem
+FILE_AREA_DOC = $(PREFIX)/usr/share/doc/slashem-common
+FILE_AREA_BONES = $(FILE_AREA_VAR)
+FILE_AREA_LEVL = $(FILE_AREA_VAR)
+SHELLDIR = $(PREFIX)/usr/games
+GAMEDIR = /usr/lib/games/slashem
 
 # KDEDIR = /opt/kde
 # SHELLDIR = $(KDEDIR)/bin
@@ -78,8 +79,8 @@
 # for inclusion in DLB libraries (ND) and which are (D). Port specific files
 # per discussions in Install.X11, Install.Qt and Install.GTK
 CNF_SHARE_QTND = x11tiles rip.xpm nhsplash.xpm
-CNF_SHARE_X11ND = x11bigtiles x11tiles SlashEM.ad pet_mark.xbm
-# CNF_SHARE_X11ND = x11bigtiles x11tiles SlashEM.ad pet_mark.xbm rip.xpm
+# CNF_SHARE_X11ND = x11bigtiles x11tiles SlashEM.ad pet_mark.xbm
+CNF_SHARE_X11ND = x11bigtiles x11tiles SlashEM.ad pet_mark.xbm rip.xpm
 CNF_SHARE_GTKND = x11big3dtiles x11bigtiles x11tiles rip.xpm credit.xpm gtkrc
 CNF_SHARE_GTKPROXYND = x11big3dtiles.map x11bigtiles.map x11tiles.map
 # for Atari/Gem
@@ -101,7 +102,7 @@
 # CNF_SHARE_DATND = $(CNF_SHARE_GTKND) $(CNF_SHARE_GTKPROXYND)
 # CNF_SHARE_DATND = $(CNF_SHARE_GLND)
 # CNF_SHARE_DATND = $(CNF_SHARE_PROXYND)
-CNF_SHARE_DATND =
+CNF_SHARE_DATND = $(CNF_SHARE_X11ND) $(CNF_SHARE_GLND) $(CNF_SHARE_GTKND) $(CNF_SHARE_GTKPROXYND)
 
 CNF_SHARE_DATD = data oracles options quest.dat rumors
 CNF_SHARE_DAT = $(CNF_SHARE_DATD) $(CNF_SHARE_DATND)
@@ -290,10 +291,10 @@
 	$(MAKE) dofiles-$${target-nodlb}
 	cp src/$(GAME) $(FILE_AREA_UNSHARE)
 	cp util/recover $(FILE_AREA_UNSHARE)
-	cp dat/license doc/Guidebook.txt $(FILE_AREA_DOC)
+	cp doc/Guidebook.txt $(FILE_AREA_DOC)
 #	cp win/Qt/KDE/kslashem.kdelnk $(KDEDIR)/share/applnk/Games
 	-rm -f $(SHELLDIR)/$(GAME)
-	sed -e 's;/usr/games/lib/nethackdir;$(FILE_AREA_UNSHARE);' \
+	sed -e 's;/usr/games/lib/nethackdir;$(GAMEDIR);' \
 		-e 's;HACKDIR/nethack;HACKDIR/$(GAME);' \
 		< sys/unix/nethack.sh \
 		> $(SHELLDIR)/$(GAME)
@@ -303,9 +304,9 @@
 	chmod $(GAMEPERM) $(FILE_AREA_UNSHARE)/$(GAME)
 	chmod $(EXEPERM) $(FILE_AREA_UNSHARE)/recover
 	-( cd $(FILE_AREA_DOC) ; \
-			$(CHOWN) $(GAMEUID) license Guidebook.txt ; \
-			$(CHGRP) $(GAMEGRP) license Guidebook.txt ; \
-			chmod $(FILEPERM) license Guidebook.txt )
+			$(CHOWN) $(GAMEUID) Guidebook.txt ; \
+			$(CHGRP) $(GAMEGRP) Guidebook.txt ; \
+			chmod $(FILEPERM) Guidebook.txt )
 	-$(CHOWN) $(GAMEUID) $(SHELLDIR)/$(GAME)
 	$(CHGRP) $(GAMEGRP) $(SHELLDIR)/$(GAME)
 	chmod $(EXEPERM) $(SHELLDIR)/$(GAME)
--- a/sys/unix/Makefile.utl
+++ b/sys/unix/Makefile.utl
@@ -1,3 +1,6 @@
+# Determine kernel name
+UNAME := $(shell uname -s)
+
 #	Makefile for NetHack's utility programs.
 #	SCCS Id: @(#)Makefile.utl	3.4	1997/04/19
 
@@ -70,10 +73,15 @@
 # SGI cc 3.10 will fail to compile makedefs with -O
 # CFLAGS = -I../include -D__STDC__ -woff 100,293
 
-# flags for Linux
+# flags for Linux and kFreeBSD
 #   compile normally
-# CFLAGS = -O2 -fomit-frame-pointer -I../include
-# LFLAGS = -L/usr/X11R6/lib
+#   disable optimization on non-Linux archs due to FTBFS
+ifeq ($(UNAME),Linux)
+CFLAGS = -DDEBIAN_$(GUI) -O2 -fomit-frame-pointer -fstack-protector --param=ssp-buffer-size=4 -I../include -I/usr/X11R6/include
+else
+CFLAGS = -DDEBIAN_$(GUI) -fstack-protector --param=ssp-buffer-size=4 -I../include -I/usr/X11R6/include
+endif
+LFLAGS = -L/usr/X11R6/lib -Wl,-z,relro
 #   OR compile backwards compatible a.out format
 # CFLAGS = -O2 -b i486-linuxaout -fomit-frame-pointer -I../include
 # LFLAGS = -b i486-linuxaout -L/usr/X11R6/lib
@@ -89,8 +97,8 @@
 # flags for debugging:
 # CFLAGS = -g -I../include
 
-CFLAGS = -O -I../include
-LFLAGS =
+# CFLAGS = -O -I../include
+# LFLAGS =
 
 LIBS =
  
@@ -101,11 +109,11 @@
 
 # yacc/lex programs to use to generate *_comp.h, *_lex.c, and *_yacc.c.
 # if, instead of yacc/lex you have bison/flex, comment/uncomment the following.
-YACC     = yacc
-LEX      = lex
-# YACC     = bison -y
+# YACC     = yacc
+# LEX      = lex
+YACC     = bison -y
 # YACC     = byacc
-# LEX      = flex
+LEX      = flex
  
 # these are the names of the output files from YACC/LEX. Under MS-DOS
 # and similar systems, they may differ
--- a/sys/unix/nethack.sh
+++ b/sys/unix/nethack.sh
@@ -1,10 +1,8 @@
 #!/bin/sh
 #	SCCS Id: @(#)nethack.sh	3.4	1990/02/26
 
-HACKDIR=/usr/games/lib/nethackdir
-export HACKDIR
-HACK=$HACKDIR/nethack
-MAXNROFPLAYERS=4
+HACK=/usr/lib/games/slashem/slashem
+MAXNROFPLAYERS=0
 
 # Since Nethack.ad is installed in HACKDIR, add it to XUSERFILESEARCHPATH
 case "x$XUSERFILESEARCHPATH" in
@@ -57,7 +55,6 @@
 fi
 
 
-cd $HACKDIR
 case $1 in
 	-s*)
 		exec $HACK "$@"
--- a/win/tty/termcap.c
+++ b/win/tty/termcap.c
@@ -960,10 +960,6 @@
 
 #include <curses.h>
 
-#if !defined(LINUX) && !defined(__FreeBSD__)
-extern char *tparm();
-#endif
-
 #  ifdef COLOR_BLACK	/* trust include file */
 #ifndef VIDEOSHADES
 #undef COLOR_BLACK
--- a/include/system.h
+++ b/include/system.h
@@ -530,7 +530,11 @@
 E time_t FDECL(time, (time_t *));
 #  endif
 # else
+#  if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+E time_t FDECL(time, (time_t *));
+#  else
 E long FDECL(time, (time_t *));
+#  endif
 # endif /* ULTRIX */
 
 #ifdef VMS
--- a/src/hacklib.c
+++ b/src/hacklib.c
@@ -4,6 +4,9 @@
 /* NetHack may be freely redistributed.  See license for details. */
 
 /* We could include only config.h, except for the overlay definitions... */
+#if defined(__FreeBSD_kernel__)
+    #include <time.h>
+#endif
 #include "hack.h"
 /*=
     Assorted 'small' utility routines.	They're virtually independent of
--- a/util/makedefs.c
+++ b/util/makedefs.c
@@ -4,6 +4,10 @@
 /* Copyright (c) Dean Luick, 1990.				  */
 /* NetHack may be freely redistributed.  See license for details. */
 
+#if defined(__FreeBSD_kernel__)
+    #include <time.h>
+#endif
+
 #define MAKEDEFS_C	/* use to conditionally include file sections */
 /* #define DEBUG */	/* uncomment for debugging info */