Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Installing Nethack 3.6.0 on Cygwin

160 views
Skip to first unread message

ch...@chrisolin.com

unread,
May 14, 2018, 5:23:06 PM5/14/18
to
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

unread,
May 15, 2018, 3:06:09 AM5/15/18
to
On 14.05.2018 23:23, ch...@chrisolin.com wrote:
> Seeing how there currently isn't any instructions on how to do this,

The Newinstall.unx file in sys/unix didn't help?

> 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

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

Pat Rankin

unread,
May 15, 2018, 11:27:35 AM5/15/18
to
On Tuesday, May 15, 2018 at 12:06:09 AM UTC-7, Janis wrote:
> On 14.05.2018 23:23, chris wrote:
[...]
>> 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
>
> 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

unread,
May 15, 2018, 2:32:19 PM5/15/18
to
On 15.05.2018 17:27, Pat Rankin wrote:
> [...]
>
> 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

unread,
May 15, 2018, 6:53:25 PM5/15/18
to
On Tuesday, May 15, 2018 at 11:32:19 AM UTC-7, Janis wrote:
> 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.)

> 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.
0 new messages