summaryrefslogtreecommitdiff
path: root/Ports/nethack
diff options
context:
space:
mode:
Diffstat (limited to 'Ports/nethack')
-rw-r--r--Ports/nethack/patches/0001-Don-t-use-fcntl-on-serenity.patch27
-rw-r--r--Ports/nethack/patches/0002-Use-explicitly-sized-types.patch (renamed from Ports/nethack/patches/host-tools-inttype.patch)223
-rw-r--r--Ports/nethack/patches/0003-Use-host-tools-where-needed.patch (renamed from Ports/nethack/patches/host-tools.patch)173
-rw-r--r--Ports/nethack/patches/0004-Set-the-install-path-correctly.patch (renamed from Ports/nethack/patches/install-path.patch)51
-rw-r--r--Ports/nethack/patches/0005-Add-hints-for-serenity.patch (renamed from Ports/nethack/patches/serenity-hints.patch)21
-rw-r--r--Ports/nethack/patches/ReadMe.md27
-rw-r--r--Ports/nethack/patches/fcntl.patch14
7 files changed, 321 insertions, 215 deletions
diff --git a/Ports/nethack/patches/0001-Don-t-use-fcntl-on-serenity.patch b/Ports/nethack/patches/0001-Don-t-use-fcntl-on-serenity.patch
new file mode 100644
index 0000000000..b48d5f3139
--- /dev/null
+++ b/Ports/nethack/patches/0001-Don-t-use-fcntl-on-serenity.patch
@@ -0,0 +1,27 @@
+From 3a91827276d7f4797ba1f8a2f37356ce0985dc7a Mon Sep 17 00:00:00 2001
+From: Gunnar Beutner <gbeutner@serenityos.org>
+Date: Sun, 11 Apr 2021 23:15:42 +0200
+Subject: [PATCH 1/5] Don't use fcntl on serenity
+
+---
+ include/unixconf.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/include/unixconf.h b/include/unixconf.h
+index c126d68..cafe766 100644
+--- a/include/unixconf.h
++++ b/include/unixconf.h
+@@ -246,8 +246,10 @@
+ * Comment out the USE_FCNTL if for some reason you have a strange
+ * OS/filesystem combination for which fcntl(2) does not work. */
+ #ifdef POSIX_TYPES
++#ifndef __serenity__
+ #define USE_FCNTL
+ #endif
++#endif
+
+ /*
+ * The remainder of the file should not need to be changed.
+--
+2.36.1
+
diff --git a/Ports/nethack/patches/host-tools-inttype.patch b/Ports/nethack/patches/0002-Use-explicitly-sized-types.patch
index 216f8a09e4..c70e0150f2 100644
--- a/Ports/nethack/patches/host-tools-inttype.patch
+++ b/Ports/nethack/patches/0002-Use-explicitly-sized-types.patch
@@ -1,7 +1,23 @@
-diff -Naur NetHack-NetHack-3.6.6_Released/include/decl.h NetHack-NetHack-3.6.6_Released.serenity/include/decl.h
---- NetHack-NetHack-3.6.6_Released/include/decl.h 2020-03-08 18:29:31.000000000 +0100
-+++ NetHack-NetHack-3.6.6_Released.serenity/include/decl.h 2021-04-11 22:49:31.732927985 +0200
-@@ -411,7 +411,7 @@
+From 00d5d3dad4bd9410d106bf48b83dbd01943d8db0 Mon Sep 17 00:00:00 2001
+From: Gunnar Beutner <gbeutner@serenityos.org>
+Date: Sun, 11 Apr 2021 23:15:42 +0200
+Subject: [PATCH 2/5] Use explicitly sized types
+
+---
+ include/decl.h | 2 +-
+ include/global.h | 10 +++++-----
+ include/qtext.h | 4 ++--
+ include/unixconf.h | 1 +
+ src/region.c | 6 +++---
+ src/rumors.c | 12 ++++++------
+ util/makedefs.c | 4 ++--
+ 7 files changed, 20 insertions(+), 19 deletions(-)
+
+diff --git a/include/decl.h b/include/decl.h
+index c6e298b..749757c 100644
+--- a/include/decl.h
++++ b/include/decl.h
+@@ -411,7 +411,7 @@ struct opvar {
xchar spovartyp; /* one of SPOVAR_foo */
union {
char *str;
@@ -10,10 +26,97 @@ diff -Naur NetHack-NetHack-3.6.6_Released/include/decl.h NetHack-NetHack-3.6.6_R
} vardata;
};
-diff -Naur NetHack-NetHack-3.6.6_Released/src/rumors.c NetHack-NetHack-3.6.6_Released.serenity/src/rumors.c
---- NetHack-NetHack-3.6.6_Released/src/rumors.c 2020-03-08 18:29:31.000000000 +0100
-+++ NetHack-NetHack-3.6.6_Released.serenity/src/rumors.c 2021-04-11 22:54:52.239553162 +0200
-@@ -54,7 +54,7 @@
+diff --git a/include/global.h b/include/global.h
+index a2b70d2..93e6933 100644
+--- a/include/global.h
++++ b/include/global.h
+@@ -293,11 +293,11 @@ extern char *FDECL(dupstr, (const char *)); /* ditto */
+ /* Used for consistency checks of various data files; declare it here so
+ that utility programs which include config.h but not hack.h can see it. */
+ struct version_info {
+- unsigned long incarnation; /* actual version number */
+- unsigned long feature_set; /* bitmask of config settings */
+- unsigned long entity_count; /* # of monsters and objects */
+- unsigned long struct_sizes1; /* size of key structs */
+- unsigned long struct_sizes2; /* size of more key structs */
++ uint32_t incarnation; /* actual version number */
++ uint32_t feature_set; /* bitmask of config settings */
++ uint32_t entity_count; /* # of monsters and objects */
++ uint32_t struct_sizes1; /* size of key structs */
++ uint32_t struct_sizes2; /* size of more key structs */
+ };
+
+ struct savefile_info {
+diff --git a/include/qtext.h b/include/qtext.h
+index 7529384..e17e2ea 100644
+--- a/include/qtext.h
++++ b/include/qtext.h
+@@ -12,7 +12,7 @@
+ struct qtmsg {
+ int msgnum;
+ char delivery;
+- long offset, size, summary_size;
++ int32_t offset, size, summary_size;
+ };
+
+ #ifdef MAKEDEFS_C /***** MAKEDEFS *****/
+@@ -27,7 +27,7 @@ struct msghdr {
+ struct qthdr {
+ int n_hdr;
+ char id[N_HDR][LEN_HDR];
+- long offset[N_HDR];
++ int32_t offset[N_HDR];
+ };
+
+ /* Error message macros */
+diff --git a/include/unixconf.h b/include/unixconf.h
+index cafe766..6aba57a 100644
+--- a/include/unixconf.h
++++ b/include/unixconf.h
+@@ -323,6 +323,7 @@
+
+ #if defined(POSIX_TYPES) || defined(__GNUC__)
+ #include <stdlib.h>
++#include <stdint.h>
+ #include <unistd.h>
+ #endif
+
+diff --git a/src/region.c b/src/region.c
+index f0b775d..e88f5a6 100644
+--- a/src/region.c
++++ b/src/region.c
+@@ -663,7 +663,7 @@ int mode;
+ bwrite(fd, (genericptr_t) &n, sizeof n);
+ if (n > 0)
+ bwrite(fd, (genericptr_t) regions[i]->leave_msg, n);
+- bwrite(fd, (genericptr_t) &regions[i]->ttl, sizeof(long));
++ bwrite(fd, (genericptr_t) &regions[i]->ttl, sizeof(int32_t));
+ bwrite(fd, (genericptr_t) &regions[i]->expire_f, sizeof(short));
+ bwrite(fd, (genericptr_t) &regions[i]->can_enter_f, sizeof(short));
+ bwrite(fd, (genericptr_t) &regions[i]->enter_f, sizeof(short));
+@@ -693,7 +693,7 @@ boolean ghostly; /* If a bones file restore */
+ {
+ int i, j;
+ unsigned n;
+- long tmstamp;
++ int32_t tmstamp;
+ char *msg_buf;
+
+ clear_regions(); /* Just for security */
+@@ -737,7 +737,7 @@ boolean ghostly; /* If a bones file restore */
+ } else
+ regions[i]->leave_msg = (const char *) 0;
+
+- mread(fd, (genericptr_t) &regions[i]->ttl, sizeof(long));
++ mread(fd, (genericptr_t) &regions[i]->ttl, sizeof(int32_t));
+ /* check for expired region */
+ if (regions[i]->ttl >= 0L)
+ regions[i]->ttl =
+diff --git a/src/rumors.c b/src/rumors.c
+index ac82b44..e7865b7 100644
+--- a/src/rumors.c
++++ b/src/rumors.c
+@@ -54,7 +54,7 @@ static long true_rumor_end, false_rumor_end;
/* oracles are handled differently from rumors... */
static int oracle_flg = 0; /* -1=>don't use, 0=>need init, 1=>init done */
static unsigned oracle_cnt = 0;
@@ -22,7 +125,7 @@ diff -Naur NetHack-NetHack-3.6.6_Released/src/rumors.c NetHack-NetHack-3.6.6_Rel
STATIC_OVL void
init_rumors(fp)
-@@ -384,7 +384,7 @@
+@@ -384,7 +384,7 @@ dlb *fp;
(void) dlb_fgets(line, sizeof line, fp);
if (sscanf(line, "%5d\n", &cnt) == 1 && cnt > 0) {
oracle_cnt = (unsigned) cnt;
@@ -31,7 +134,7 @@ diff -Naur NetHack-NetHack-3.6.6_Released/src/rumors.c NetHack-NetHack-3.6.6_Rel
for (i = 0; i < cnt; i++) {
(void) dlb_fgets(line, sizeof line, fp);
(void) sscanf(line, "%5lx\n", &oracle_loc[i]);
-@@ -401,7 +401,7 @@
+@@ -401,7 +401,7 @@ int fd, mode;
bwrite(fd, (genericptr_t) &oracle_cnt, sizeof oracle_cnt);
if (oracle_cnt)
bwrite(fd, (genericptr_t) oracle_loc,
@@ -40,7 +143,7 @@ diff -Naur NetHack-NetHack-3.6.6_Released/src/rumors.c NetHack-NetHack-3.6.6_Rel
}
if (release_data(mode)) {
if (oracle_cnt) {
-@@ -417,8 +417,8 @@
+@@ -417,8 +417,8 @@ int fd;
{
mread(fd, (genericptr_t) &oracle_cnt, sizeof oracle_cnt);
if (oracle_cnt) {
@@ -51,7 +154,7 @@ diff -Naur NetHack-NetHack-3.6.6_Released/src/rumors.c NetHack-NetHack-3.6.6_Rel
oracle_flg = 1; /* no need to call init_oracles() */
}
}
-@@ -452,7 +452,7 @@
+@@ -452,7 +452,7 @@ boolean delphi;
if (oracle_cnt <= 1 && !special)
goto close_oracles; /*(shouldn't happen)*/
oracle_idx = special ? 0 : rnd((int) oracle_cnt - 1);
@@ -60,10 +163,11 @@ diff -Naur NetHack-NetHack-3.6.6_Released/src/rumors.c NetHack-NetHack-3.6.6_Rel
if (!special) /* move offset of very last one into this slot */
oracle_loc[oracle_idx] = oracle_loc[--oracle_cnt];
-diff -Naur NetHack-NetHack-3.6.6_Released/util/makedefs.c NetHack-NetHack-3.6.6_Released.serenity/util/makedefs.c
---- NetHack-NetHack-3.6.6_Released/util/makedefs.c 2020-03-08 18:29:31.000000000 +0100
-+++ NetHack-NetHack-3.6.6_Released.serenity/util/makedefs.c 2021-04-11 22:52:12.216276961 +0200
-@@ -2626,7 +2626,7 @@
+diff --git a/util/makedefs.c b/util/makedefs.c
+index cd971bc..de2757e 100644
+--- a/util/makedefs.c
++++ b/util/makedefs.c
+@@ -2626,7 +2626,7 @@ adjust_qt_hdrs()
{
int i, j;
long count = 0L, hdr_offset = sizeof(int)
@@ -72,7 +176,7 @@ diff -Naur NetHack-NetHack-3.6.6_Released/util/makedefs.c NetHack-NetHack-3.6.6_
* qt_hdr.n_hdr;
for (i = 0; i < qt_hdr.n_hdr; i++) {
-@@ -2656,7 +2656,7 @@
+@@ -2656,7 +2656,7 @@ put_qt_hdrs()
(void) fwrite((genericptr_t) & (qt_hdr.n_hdr), sizeof(int), 1, ofp);
(void) fwrite((genericptr_t) & (qt_hdr.id[0][0]), sizeof(char) * LEN_HDR,
qt_hdr.n_hdr, ofp);
@@ -81,85 +185,6 @@ diff -Naur NetHack-NetHack-3.6.6_Released/util/makedefs.c NetHack-NetHack-3.6.6_
qt_hdr.n_hdr, ofp);
if (debug) {
for (i = 0; i < qt_hdr.n_hdr; i++)
-diff -Naur NetHack-NetHack-3.6.6_Released/include/qtext.h NetHack-NetHack-3.6.6_Released.serenity/include/qtext.h
---- NetHack-NetHack-3.6.6_Released/include/qtext.h 2021-04-11 23:02:18.288478651 +0200
-+++ NetHack-NetHack-3.6.6_Released.serenity/include/qtext.h 2021-04-11 23:02:34.328795871 +0200
-@@ -12,7 +12,7 @@
- struct qtmsg {
- int msgnum;
- char delivery;
-- long offset, size, summary_size;
-+ int32_t offset, size, summary_size;
- };
-
- #ifdef MAKEDEFS_C /***** MAKEDEFS *****/
-@@ -27,7 +27,7 @@
- struct qthdr {
- int n_hdr;
- char id[N_HDR][LEN_HDR];
-- long offset[N_HDR];
-+ int32_t offset[N_HDR];
- };
-
- /* Error message macros */
-diff -Naur NetHack-NetHack-3.6.6_Released/src/region.c NetHack-NetHack-3.6.6_Released.serenity/src/region.c
---- NetHack-NetHack-3.6.6_Released/src/region.c 2020-03-08 18:29:31.000000000 +0100
-+++ NetHack-NetHack-3.6.6_Released.serenity/src/region.c 2021-04-11 22:57:14.059084358 +0200
-@@ -663,7 +663,7 @@
- bwrite(fd, (genericptr_t) &n, sizeof n);
- if (n > 0)
- bwrite(fd, (genericptr_t) regions[i]->leave_msg, n);
-- bwrite(fd, (genericptr_t) &regions[i]->ttl, sizeof(long));
-+ bwrite(fd, (genericptr_t) &regions[i]->ttl, sizeof(int32_t));
- bwrite(fd, (genericptr_t) &regions[i]->expire_f, sizeof(short));
- bwrite(fd, (genericptr_t) &regions[i]->can_enter_f, sizeof(short));
- bwrite(fd, (genericptr_t) &regions[i]->enter_f, sizeof(short));
-@@ -693,7 +693,7 @@
- {
- int i, j;
- unsigned n;
-- long tmstamp;
-+ int32_t tmstamp;
- char *msg_buf;
-
- clear_regions(); /* Just for security */
-@@ -737,7 +737,7 @@
- } else
- regions[i]->leave_msg = (const char *) 0;
-
-- mread(fd, (genericptr_t) &regions[i]->ttl, sizeof(long));
-+ mread(fd, (genericptr_t) &regions[i]->ttl, sizeof(int32_t));
- /* check for expired region */
- if (regions[i]->ttl >= 0L)
- regions[i]->ttl =
-diff -Naur NetHack-NetHack-3.6.6_Released/include/global.h NetHack-NetHack-3.6.6_Released.serenity/include/global.h
---- NetHack-NetHack-3.6.6_Released/include/global.h 2021-04-11 22:32:59.310062482 +0200
-+++ NetHack-NetHack-3.6.6_Released.serenity/include/global.h 2021-04-11 22:32:31.736197272 +0200
-@@ -293,11 +293,11 @@
- /* Used for consistency checks of various data files; declare it here so
- that utility programs which include config.h but not hack.h can see it. */
- struct version_info {
-- unsigned long incarnation; /* actual version number */
-- unsigned long feature_set; /* bitmask of config settings */
-- unsigned long entity_count; /* # of monsters and objects */
-- unsigned long struct_sizes1; /* size of key structs */
-- unsigned long struct_sizes2; /* size of more key structs */
-+ uint32_t incarnation; /* actual version number */
-+ uint32_t feature_set; /* bitmask of config settings */
-+ uint32_t entity_count; /* # of monsters and objects */
-+ uint32_t struct_sizes1; /* size of key structs */
-+ uint32_t struct_sizes2; /* size of more key structs */
- };
-
- struct savefile_info {
-diff -Naur NetHack-NetHack-3.6.6_Released/include/unixconf.h NetHack-NetHack-3.6.6_Released.serenity/include/unixconf.h
---- NetHack-NetHack-3.6.6_Released/include/unixconf.h 2021-04-11 22:32:31.719530283 +0200
-+++ NetHack-NetHack-3.6.6_Released.serenity/include/unixconf.h 2021-04-11 22:33:55.461144660 +0200
-@@ -323,6 +323,7 @@
-
- #if defined(POSIX_TYPES) || defined(__GNUC__)
- #include <stdlib.h>
-+#include <stdint.h>
- #include <unistd.h>
- #endif
-
+--
+2.36.1
+
diff --git a/Ports/nethack/patches/host-tools.patch b/Ports/nethack/patches/0003-Use-host-tools-where-needed.patch
index a62e3c9c95..1ef232f0b7 100644
--- a/Ports/nethack/patches/host-tools.patch
+++ b/Ports/nethack/patches/0003-Use-host-tools-where-needed.patch
@@ -1,19 +1,56 @@
-diff -Naur NetHack-NetHack-3.6.6_Released/sys/unix/Makefile.top NetHack-NetHack-3.6.6_Released.serenity/sys/unix/Makefile.top
---- NetHack-NetHack-3.6.6_Released/sys/unix/Makefile.top 2020-03-08 18:29:31.000000000 +0100
-+++ NetHack-NetHack-3.6.6_Released.serenity/sys/unix/Makefile.top 2021-04-11 19:43:41.471996943 +0200
-@@ -188,7 +188,7 @@
+From 3d1ff1d1a12a4111b7ef29e8c6bbae05095c1bc1 Mon Sep 17 00:00:00 2001
+From: Gunnar Beutner <gbeutner@serenityos.org>
+Date: Sun, 11 Apr 2021 23:15:42 +0200
+Subject: [PATCH 3/5] Use host tools where needed
+
+---
+ sys/unix/Makefile.dat | 68 +++++++++++++++++++++----------------------
+ sys/unix/Makefile.src | 2 +-
+ sys/unix/Makefile.top | 2 +-
+ sys/unix/Makefile.utl | 6 ++--
+ 4 files changed, 39 insertions(+), 39 deletions(-)
+
+diff --git a/sys/unix/Makefile.dat b/sys/unix/Makefile.dat
+index 00f6043..68344d7 100644
+--- a/sys/unix/Makefile.dat
++++ b/sys/unix/Makefile.dat
+@@ -101,69 +101,69 @@ GEM_RSC.RSC:
+
+
+ data: data.base ../util/makedefs
+- ../util/makedefs -d
++ ../util/makedefs.host -d
+
+ rumors: rumors.tru rumors.fal ../util/makedefs
+- ../util/makedefs -r
++ ../util/makedefs.host -r
+
+ quest.dat: quest.txt ../util/makedefs
+- ../util/makedefs -q
++ ../util/makedefs.host -q
+
+ oracles: oracles.txt ../util/makedefs
+- ../util/makedefs -h
++ ../util/makedefs.host -h
+
+ engrave: engrave.txt ../util/makedefs
+- ../util/makedefs -s
++ ../util/makedefs.host -s
+
+ epitaph: epitaph.txt ../util/makedefs
+- ../util/makedefs -s
++ ../util/makedefs.host -s
+
+ bogusmon: bogusmon.txt ../util/makedefs
+- ../util/makedefs -s
++ ../util/makedefs.host -s
+
+ # note: 'options' should have already been made when include/date.h was created
+ options: ../util/makedefs
+- ../util/makedefs -v
++ ../util/makedefs.host -v
- dlb:
- ( cd util ; $(MAKE) dlb )
-- ( cd dat ; LC_ALL=C ; ../util/dlb cf nhdat $(DATDLB) )
-+ ( cd dat ; LC_ALL=C ; ../util/dlb.host cf nhdat $(DATDLB) )
- # recover can be used when INSURANCE is defined in include/config.h
- # and the checkpoint option is true
-diff -Naur NetHack-NetHack-3.6.6_Released/sys/unix/Makefile.dat NetHack-NetHack-3.6.6_Released.serenity/sys/unix/Makefile.dat
---- NetHack-NetHack-3.6.6_Released/sys/unix/Makefile.dat 2021-04-11 19:39:50.410956379 +0200
-+++ NetHack-NetHack-3.6.6_Released.serenity/sys/unix/Makefile.dat 2021-04-11 19:41:47.699843567 +0200
-@@ -129,36 +129,36 @@
spec_levs: ../util/lev_comp \
bigroom.des castle.des endgame.des gehennom.des knox.des medusa.des \
mines.des oracle.des sokoban.des tower.des yendor.des
@@ -74,10 +111,44 @@ diff -Naur NetHack-NetHack-3.6.6_Released/sys/unix/Makefile.dat NetHack-NetHack-
touch quest_levs
dungeon: dungeon.def ../util/makedefs ../util/dgn_comp
-diff -Naur NetHack-NetHack-3.6.6_Released/sys/unix/Makefile.utl NetHack-NetHack-3.6.6_Released.serenity/sys/unix/Makefile.utl
---- NetHack-NetHack-3.6.6_Released/sys/unix/Makefile.utl 2020-03-08 18:29:31.000000000 +0100
-+++ NetHack-NetHack-3.6.6_Released.serenity/sys/unix/Makefile.utl 2021-04-11 19:19:59.714969159 +0200
-@@ -239,11 +239,11 @@
+- ../util/makedefs -e
+- ../util/dgn_comp dungeon.pdf
++ ../util/makedefs.host -e
++ ../util/dgn_comp.host dungeon.pdf
+
+ # gitinfo.txt is optionally made by src/Makefile when creating date.h
+ clean:
+diff --git a/sys/unix/Makefile.src b/sys/unix/Makefile.src
+index 47ab9e0..5d94487 100644
+--- a/sys/unix/Makefile.src
++++ b/sys/unix/Makefile.src
+@@ -670,7 +670,7 @@ tile.c: ../win/share/tilemap.c $(HACK_H)
+ # up to date before being executed
+ ../include/date.h: $(VERSOURCES) $(HACK_H)
+ -$(SHELL) ../sys/unix/gitinfo.sh $(GITINFO) #before 'makedefs -v'
+- ../util/makedefs -v
++ ../util/makedefs.host -v
+
+
+ lint:
+diff --git a/sys/unix/Makefile.top b/sys/unix/Makefile.top
+index ad7607c..f0ee25d 100644
+--- a/sys/unix/Makefile.top
++++ b/sys/unix/Makefile.top
+@@ -188,7 +188,7 @@ check-dlb: options
+
+ dlb:
+ ( cd util ; $(MAKE) dlb )
+- ( cd dat ; LC_ALL=C ; ../util/dlb cf nhdat $(DATDLB) )
++ ( cd dat ; LC_ALL=C ; ../util/dlb.host cf nhdat $(DATDLB) )
+
+ # recover can be used when INSURANCE is defined in include/config.h
+ # and the checkpoint option is true
+diff --git a/sys/unix/Makefile.utl b/sys/unix/Makefile.utl
+index 78e9d72..1a7efca 100644
+--- a/sys/unix/Makefile.utl
++++ b/sys/unix/Makefile.utl
+@@ -239,11 +239,11 @@ mdgreph: mdgrep.pl
perl mdgrep.pl
../include/onames.h: makedefs
@@ -92,66 +163,6 @@ diff -Naur NetHack-NetHack-3.6.6_Released/sys/unix/Makefile.utl NetHack-NetHack-
# makedefs -z makes both vis_tab.h and vis_tab.c, but writes the .h first
../src/vis_tab.c: ../include/vis_tab.h
-diff -Naur NetHack-NetHack-3.6.6_Released/sys/unix/Makefile.dat NetHack-NetHack-3.6.6_Released.serenity/sys/unix/Makefile.dat
---- NetHack-NetHack-3.6.6_Released/sys/unix/Makefile.dat 2020-03-08 18:29:31.000000000 +0100
-+++ NetHack-NetHack-3.6.6_Released.serenity/sys/unix/Makefile.dat 2021-04-11 19:32:23.365816407 +0200
-@@ -101,29 +101,29 @@
-
-
- data: data.base ../util/makedefs
-- ../util/makedefs -d
-+ ../util/makedefs.host -d
-
- rumors: rumors.tru rumors.fal ../util/makedefs
-- ../util/makedefs -r
-+ ../util/makedefs.host -r
-
- quest.dat: quest.txt ../util/makedefs
-- ../util/makedefs -q
-+ ../util/makedefs.host -q
-
- oracles: oracles.txt ../util/makedefs
-- ../util/makedefs -h
-+ ../util/makedefs.host -h
-
- engrave: engrave.txt ../util/makedefs
-- ../util/makedefs -s
-+ ../util/makedefs.host -s
-
- epitaph: epitaph.txt ../util/makedefs
-- ../util/makedefs -s
-+ ../util/makedefs.host -s
-
- bogusmon: bogusmon.txt ../util/makedefs
-- ../util/makedefs -s
-+ ../util/makedefs.host -s
-
- # note: 'options' should have already been made when include/date.h was created
- options: ../util/makedefs
-- ../util/makedefs -v
-+ ../util/makedefs.host -v
-
-
- spec_levs: ../util/lev_comp \
-@@ -162,7 +162,7 @@
- touch quest_levs
-
- dungeon: dungeon.def ../util/makedefs ../util/dgn_comp
-- ../util/makedefs -e
-+ ../util/makedefs.host -e
-- ../util/dgn_comp dungeon.pdf
-+ ../util/dgn_comp.host dungeon.pdf
-
- # gitinfo.txt is optionally made by src/Makefile when creating date.h
-diff -Naur NetHack-NetHack-3.6.6_Released/sys/unix/Makefile.src NetHack-NetHack-3.6.6_Released.serenity/sys/unix/Makefile.src
---- NetHack-NetHack-3.6.6_Released/sys/unix/Makefile.src 2020-03-08 18:29:31.000000000 +0100
-+++ NetHack-NetHack-3.6.6_Released.serenity/sys/unix/Makefile.src 2021-04-11 19:32:32.012647179 +0200
-@@ -670,7 +670,7 @@
- # up to date before being executed
- ../include/date.h: $(VERSOURCES) $(HACK_H)
- -$(SHELL) ../sys/unix/gitinfo.sh $(GITINFO) #before 'makedefs -v'
-- ../util/makedefs -v
-+ ../util/makedefs.host -v
-
-
- lint:
+--
+2.36.1
+
diff --git a/Ports/nethack/patches/install-path.patch b/Ports/nethack/patches/0004-Set-the-install-path-correctly.patch
index 77ff043345..b22cb4378a 100644
--- a/Ports/nethack/patches/install-path.patch
+++ b/Ports/nethack/patches/0004-Set-the-install-path-correctly.patch
@@ -1,6 +1,33 @@
-diff -Naur NetHack-NetHack-3.6.6_Released/sys/unix/nethack.sh NetHack-NetHack-3.6.6_Released.serenity/sys/unix/nethack.sh
---- NetHack-NetHack-3.6.6_Released/sys/unix/nethack.sh 2020-03-08 18:29:31.000000000 +0100
-+++ NetHack-NetHack-3.6.6_Released.serenity/sys/unix/nethack.sh 2021-04-11 21:58:43.846512264 +0200
+From c8dc69d845ea82c85222882e62af76a11d71695f Mon Sep 17 00:00:00 2001
+From: Gunnar Beutner <gbeutner@serenityos.org>
+Date: Thu, 15 Apr 2021 15:43:18 +0200
+Subject: [PATCH 4/5] Set the install path correctly
+
+---
+ sys/unix/Makefile.top | 4 ++--
+ sys/unix/nethack.sh | 6 +++---
+ 2 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/sys/unix/Makefile.top b/sys/unix/Makefile.top
+index f0ee25d..1dc6e9c 100644
+--- a/sys/unix/Makefile.top
++++ b/sys/unix/Makefile.top
+@@ -223,9 +223,9 @@ dofiles:
+ chmod $(EXEPERM) $(SHELLDIR)/$(GAME); fi
+
+ dofiles-dlb: check-dlb
+- ( cd dat ; cp nhdat $(DATNODLB) $(INSTDIR) )
++ ( cd dat ; cp nhdat $(DATNODLB) $(VARDIR) )
+ # set up their permissions
+- -( cd $(INSTDIR) ; $(CHOWN) $(GAMEUID) nhdat $(DATNODLB) ; \
++ -( cd $(VARDIR) ; $(CHOWN) $(GAMEUID) nhdat $(DATNODLB) ; \
+ $(CHGRP) $(GAMEGRP) nhdat $(DATNODLB) ; \
+ chmod $(FILEPERM) nhdat $(DATNODLB) )
+
+diff --git a/sys/unix/nethack.sh b/sys/unix/nethack.sh
+index 2c2b62c..70857b6 100755
+--- a/sys/unix/nethack.sh
++++ b/sys/unix/nethack.sh
@@ -1,11 +1,11 @@
-#!/bin/sh
+#!/bin/bash
@@ -16,18 +43,6 @@ diff -Naur NetHack-NetHack-3.6.6_Released/sys/unix/nethack.sh NetHack-NetHack-3.
# Since Nethack.ad is installed in HACKDIR, add it to XUSERFILESEARCHPATH
case "x$XUSERFILESEARCHPATH" in
-diff -Naur NetHack-NetHack-3.6.6_Released/sys/unix/Makefile.top NetHack-NetHack-3.6.6_Released.serenity/sys/unix/Makefile.top
---- NetHack-NetHack-3.6.6_Released/sys/unix/Makefile.top 2021-04-11 22:16:46.240897370 +0200
-+++ NetHack-NetHack-3.6.6_Released.serenity/sys/unix/Makefile.top 2021-04-11 22:19:45.264521466 +0200
-@@ -223,9 +223,9 @@
- chmod $(EXEPERM) $(SHELLDIR)/$(GAME); fi
-
- dofiles-dlb: check-dlb
-- ( cd dat ; cp nhdat $(DATNODLB) $(INSTDIR) )
-+ ( cd dat ; cp nhdat $(DATNODLB) $(VARDIR) )
- # set up their permissions
-- -( cd $(INSTDIR) ; $(CHOWN) $(GAMEUID) nhdat $(DATNODLB) ; \
-+ -( cd $(VARDIR) ; $(CHOWN) $(GAMEUID) nhdat $(DATNODLB) ; \
- $(CHGRP) $(GAMEGRP) nhdat $(DATNODLB) ; \
- chmod $(FILEPERM) nhdat $(DATNODLB) )
-
+--
+2.36.1
+
diff --git a/Ports/nethack/patches/serenity-hints.patch b/Ports/nethack/patches/0005-Add-hints-for-serenity.patch
index 03d7b9b0ac..e9d2cba10d 100644
--- a/Ports/nethack/patches/serenity-hints.patch
+++ b/Ports/nethack/patches/0005-Add-hints-for-serenity.patch
@@ -1,6 +1,18 @@
-diff -Naur NetHack-NetHack-3.6.6_Released/sys/unix/hints/serenity NetHack-NetHack-3.6.6_Released.serenity/sys/unix/hints/serenity
---- NetHack-NetHack-3.6.6_Released/sys/unix/hints/serenity 1970-01-01 01:00:00.000000000 +0100
-+++ NetHack-NetHack-3.6.6_Released.serenity/sys/unix/hints/serenity 2021-04-11 19:08:45.051777994 +0200
+From cac4f570dfb4cb392eaa4f6e8b2845a2875cf17e Mon Sep 17 00:00:00 2001
+From: Gunnar Beutner <gbeutner@serenityos.org>
+Date: Thu, 15 Apr 2021 15:43:18 +0200
+Subject: [PATCH 5/5] Add hints for serenity
+
+---
+ sys/unix/hints/serenity | 54 +++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 54 insertions(+)
+ create mode 100644 sys/unix/hints/serenity
+
+diff --git a/sys/unix/hints/serenity b/sys/unix/hints/serenity
+new file mode 100644
+index 0000000..1e0ed46
+--- /dev/null
++++ b/sys/unix/hints/serenity
@@ -0,0 +1,54 @@
+#
+# NetHack 3.6 linux $NHDT-Date: 1432512814 2015/05/25 00:13:34 $ $NHDT-Branch: master $:$NHDT-Revision: 1.12 $
@@ -56,3 +68,6 @@ diff -Naur NetHack-NetHack-3.6.6_Released/sys/unix/hints/serenity NetHack-NetHac
+VARDIRPERM = 0755
+VARFILEPERM = 0600
+GAMEPERM = 0755
+--
+2.36.1
+
diff --git a/Ports/nethack/patches/ReadMe.md b/Ports/nethack/patches/ReadMe.md
new file mode 100644
index 0000000000..f36e377613
--- /dev/null
+++ b/Ports/nethack/patches/ReadMe.md
@@ -0,0 +1,27 @@
+# Patches for nethack on SerenityOS
+
+## `0001-Don-t-use-fcntl-on-serenity.patch`
+
+Don't use fcntl on serenity
+
+
+## `0002-Use-explicitly-sized-types.patch`
+
+Use explicitly sized types
+
+
+## `0003-Use-host-tools-where-needed.patch`
+
+Use host tools where needed
+
+
+## `0004-Set-the-install-path-correctly.patch`
+
+Set the install path correctly
+
+
+## `0005-Add-hints-for-serenity.patch`
+
+Add hints for serenity
+
+
diff --git a/Ports/nethack/patches/fcntl.patch b/Ports/nethack/patches/fcntl.patch
deleted file mode 100644
index ccef31407a..0000000000
--- a/Ports/nethack/patches/fcntl.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-diff -Naur NetHack-NetHack-3.6.6_Released/include/unixconf.h NetHack-NetHack-3.6.6_Released.serenity/include/unixconf.h
---- NetHack-NetHack-3.6.6_Released/include/unixconf.h 2020-03-08 18:29:31.000000000 +0100
-+++ NetHack-NetHack-3.6.6_Released.serenity/include/unixconf.h 2021-04-11 21:54:47.295254864 +0200
-@@ -246,8 +246,10 @@
- * Comment out the USE_FCNTL if for some reason you have a strange
- * OS/filesystem combination for which fcntl(2) does not work. */
- #ifdef POSIX_TYPES
-+#ifndef __serenity__
- #define USE_FCNTL
- #endif
-+#endif
-
- /*
- * The remainder of the file should not need to be changed.