Discussion:
Installing Nethack 3.6.0 on Cygwin
(too old to reply)
c***@chrisolin.com
2018-05-14 21:23:03 UTC
Permalink
Raw Message
Seeing how there currently isn't any instructions on how to do this, I was forced to figure it out myself. Here's what I did:

1). Make sure all of the dependencies are installed in Cygwin (bison, flex, curses-devel, gcc, etc).

2). git clone https://github.com/NetHack/NetHack

3). cd nethack/sys/unix

4). Run the following commands:

/bin/sh ./mkmkfile.sh Makefile.top TOP ../../Makefile hints/linux setup.sh
/bin/sh ./mkmkfile.sh Makefile.dat DAT ../../dat/Makefile hints/linux setup.sh
/bin/sh ./mkmkfile.sh Makefile.doc DOC ../../doc/Makefile hints/linux setup.sh
/bin/sh ./mkmkfile.sh Makefile.src SRC ../../src/Makefile hints/linux setup.sh
/bin/sh ./mkmkfile.sh Makefile.utl UTL ../../util/Makefile hints/linux setup.sh

5). cd ../../

6). make

7). make install

After `make install` is finished running, the nethack executable can be found in ~/nh/install/games/nethack.
Janis Papanagnou
2018-05-15 07:06:06 UTC
Permalink
Raw Message
Post by c***@chrisolin.com
Seeing how there currently isn't any instructions on how to do this,
The Newinstall.unx file in sys/unix didn't help?
Post by c***@chrisolin.com
1). Make sure all of the dependencies are installed in Cygwin (bison, flex, curses-devel, gcc, etc).
2). git clone https://github.com/NetHack/NetHack
3). cd nethack/sys/unix
/bin/sh ./mkmkfile.sh Makefile.top TOP ../../Makefile hints/linux setup.sh
/bin/sh ./mkmkfile.sh Makefile.dat DAT ../../dat/Makefile hints/linux setup.sh
/bin/sh ./mkmkfile.sh Makefile.doc DOC ../../doc/Makefile hints/linux setup.sh
/bin/sh ./mkmkfile.sh Makefile.src SRC ../../src/Makefile hints/linux setup.sh
/bin/sh ./mkmkfile.sh Makefile.utl UTL ../../util/Makefile hints/linux setup.sh
Hmm.. - I am wondering about these individual setup commands. Were there no
Makefile.* files already in your clone - there are in mine -, or didn't they
work?

The Newinstall.unx file in sys/unix suggests (adjusting $Top and hints-file)

cd $Top/sys/unix
sh setup.sh hints/NAME_OF_HINTS_FILE
cd ../..
make all

Were the hints files (say, e.g., sys/unix/hints/unix) inappopriate for Cygwin?

I'd be surprised if there's no configuration that works for the common Cygwin
platform. But if nothing works I'd try to define a hints file for Cygwin to
have a simpler setup and provide it to the Devteam for incorporation.

Janis, curious
Post by c***@chrisolin.com
5). cd ../../
6). make
7). make install
After `make install` is finished running, the nethack executable can be found in ~/nh/install/games/nethack.
Pat Rankin
2018-05-15 15:27:33 UTC
Permalink
Raw Message
[...]
Post by Janis Papanagnou
Post by c***@chrisolin.com
/bin/sh ./mkmkfile.sh Makefile.top TOP ../../Makefile hints/linux setup.sh
/bin/sh ./mkmkfile.sh Makefile.dat DAT ../../dat/Makefile hints/linux setup.sh
/bin/sh ./mkmkfile.sh Makefile.doc DOC ../../doc/Makefile hints/linux setup.sh
/bin/sh ./mkmkfile.sh Makefile.src SRC ../../src/Makefile hints/linux setup.sh
/bin/sh ./mkmkfile.sh Makefile.utl UTL ../../util/Makefile hints/linux setup.sh
Hmm.. - I am wondering about these individual setup commands. Were there no
Makefile.* files already in your clone - there are in mine -, or didn't they
work?
./setup.sh hints/linux
should have accomplished the same thing.

There's been at least one report that failing to specify any hints file
doesn't work any more even though it's supposed to be optional.
(Something about the script's use of /dev/null as a placeholder and
some system not liking the way that's being used by [ -f ]. I'm not
sure of the details aside from the fact that whatever the issue is, it
hasn't been fixed yet. I won't be surprised if cygwin is the system
that has the problem.)
Janis Papanagnou
2018-05-15 18:32:16 UTC
Permalink
Raw Message
Post by Pat Rankin
[...]
There's been at least one report that failing to specify any hints file
doesn't work any more even though it's supposed to be optional.
(Something about the script's use of /dev/null as a placeholder and
some system not liking the way that's being used by [ -f ]. I'm not
sure of the details aside from the fact that whatever the issue is, it
hasn't been fixed yet. I won't be surprised if cygwin is the system
that has the problem.)
Well, the logic

if [ ! -f /dev/null ] ; then echo "no file" ; fi

will produce (with modern shells, on linux) "no file". That means that
using a default setup.sh call (i.e. without arguments) will always fail
due to the if-test that follows the case-statement. Relocating the if-
condition into the case branch might already fix that inherent problem.

case "x$1" in
x) hints=/dev/null
hfile=/dev/null
;;
*) hints=$prefix/$1
hfile=$1
if [ ! -f "$hints" ]; then
echo "Cannot find hints file $hfile"
exit 1
fi
;;
esac


Another option could be to check for the "/dev/null" special case in the
if-statement to prevent the exit in case the default is used.

if [ ! -f "$hints" ] && [ "$hints" != "/dev/null" ]; then
echo "Cannot find hints file $hfile"
exit 1
fi


It seems that the mkmkfile.sh program will not mind a "/dev/null" being
passed as argument, although the awk calls

awk '/^#-POST/,/^#-PRE/{ \
if(index($0, "#-POST") == 1) print "# (new segment at source
line",NR,")"; \
if(index($0, "#-P") != 1) print}' $4 >> $3

(with $4 expanded to /dev/null) will not contribute any content then.
(Not sure if that's intended. I'm too lazy to dive into that.)

Janis
Pat Rankin
2018-05-15 22:53:22 UTC
Permalink
Raw Message
Post by Janis Papanagnou
Well, the logic
if [ ! -f /dev/null ] ; then echo "no file" ; fi
will produce (with modern shells, on linux) "no file". That means that
using a default setup.sh call (i.e. without arguments) will always fail
due to the if-test that follows the case-statement.
Yes, that's the problem, and it isn't specific to any particular system.
(The report came from debian linux rather than cygwin; the logic error
applies to all UNIX-like systems.)
Post by Janis Papanagnou
Relocating the if-
condition into the case branch might already fix that inherent problem.
And that solution has now been put into place for the next version.

Having /dev/null contribute nothing to the constructed Makefiles is the
intended behavior, to avoid the need to use extra conditional logic for
the case where no hints file has been supplied.

Loading...