Cygwin-mingw compilation

View: New views
1 Messages — Rating Filter:   Alert me  

Cygwin-mingw compilation

by Silas Dunsmore :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Using the Configure Script to Compile Under Cygwin; and Musings Upon Regexps

I have submitted the enclosed patches to the tracker.

This was written to document a way to build Slash'EM.  It also is intended
to point out a few problems with the current 8E0F1 sourcetree, and provide
suggested patches where possible.

We will use the Cygwin toolset to compile Slash'EM.  We want to be able to
use tile graphics and sounds, as well as the traditional text mode.  We
also want the resulting executables to be usable on any Windows install
without needing Cygwin to be installed.

I banged on the provided makefile for Cygwin enough to know that I wasn't
going to be able to use it to compile.  Besides, we want to be able to run
the game anywhere.  So we'll target the mingw subsystem of Cygwin.  And
we'll use the automake configurator.  I was surprised how well it works.

Note: the toolchain used is called mingw, but the Cygwin FAQ (6.10) claims
that the actual MinGW project is a "completely separate effort."  So I
guess it's not really MinGW.

These Cygwin packages are required or desired:
        base:coreutils
        base:bash
        base:grep
        base:gzip
        base:tar
        devel:binutils
        devel:bison (optional)
        devel:flex (optional)
        devel:gcc
        devel:gcc-mingw
        devel:gdb (optional)
        devel:make
        devel:mingw-runtime
        utils:cygutils
        utils:diffutils
        utils:patch
        (possibly more....)

A hint on the Cygwin setup program: it's much easier to use if you maximize
the window.

Start a bash shell using one of the shortcuts, or start a rxvt window if you
have that installed.  Enter "gcc" to check that you can run the compiler.  
It should give the error "gcc: no input files".

Move the archive to the place where you want to keep the game.  If you want
to use unix-isms, put it in /usr/local/src.  If you want to use windows-
isms, put it in C:\Program Files\SlashEM, which Cygwin knows by the name
"/cygdrive/c/Program Files/SlashEM" (with the quotes).  Note: Cygwin uses
case-sensitive filename conventions by default, so get the case right.  (Or
turn it off by setting an environment variable "CYGWIN=glob:ignorecase".)

Unpack the archive:
        tar xzvf se008e0f1.tar.gz

Apply these patches:
chdir into the slashem-0.0.8E0F1 subdirectory and issue this command:
        PATCH_VERSION_CONTROL=numbered  patch -p1 -N -b < {location_of_this_file}
That will apply all of the patches in this file, unless they have already
been applied and are therefore not needed.


The configure script needs a slight tweak:
===============================================================================
diff -rU5 slashem-0.0.8E0F1-pristine/configure slashem-0.0.8E0F1/configure
--- slashem-0.0.8E0F1-pristine/configure 2006-12-30 05:04:53.000000000 -0800
+++ slashem-0.0.8E0F1/configure 2007-07-28 08:15:47.926500000 -0700
@@ -4230,11 +4230,11 @@
 CNF_SHARE_DATND=
 
 WINTTYLIB=
 if test "$enable_tty_graphics" != "no"; then
     if test $host_os = mingw32; then
- EXTRA_UNSHARE=nhdefkey.dll nh340key.dll nhraykey.dll
+ EXTRA_UNSHARE='nhdefkey.dll nh340key.dll nhraykey.dll'
 
  CFLAGS="$CFLAGS -DWIN32CON"
  WINTTYLIB=""
  WINSRC="${WINSRC} \$(WINTTYSRC)"
  WINOBJ="${WINOBJ} \$(WINTTYOBJ)"
===============================================================================

Note for automake/makefile maintainer: it would be strongly preferred to have
one LFLAGS for the main game executable, one for the ancillary utilities, and
a third for the DLLs.  Thusly:
        LFLAGS=-mno-cygwin -mconsole
        GAME_LFLAGS=-mno-cygwin -mwindows
        DLL_LFLAGS=-mno-cygwin -shared -Wl,--export-all-symbols \
                -Wl,--add-stdcall-alias
The -mconsole switch is needed for the utilities, but it causes a spurious
empty console window when running the game in graphics mode.  I believe that
is also true when compiling targetting Cygwin.  The MSC makefile "solves"
this by splitting the executable into two versions, text and graphics.


At 'make install' time, there are some chmod commands that are hardcoded
instead of using the $(CHMOD) variable.  We fix that in Makefile.top.
===============================================================================
diff -rU5 slashem-0.0.8E0F1-pristine/sys/autoconf/Makefile.top slashem-0.0.8E0F1/sys/autoconf/Makefile.top
--- slashem-0.0.8E0F1-pristine/sys/autoconf/Makefile.top 2006-12-30 05:04:53.000000000 -0800
+++ slashem-0.0.8E0F1/sys/autoconf/Makefile.top 2007-07-28 07:39:10.285080300 -0700
@@ -298,44 +298,44 @@
  @HOST_UNIX@ < $(srcdir)/sys/unix/nethack.sh \
  @HOST_UNIX@ > $(SHELLDIR)/$(SCRIPT)
 # set up their permissions
  -( cd $(FILE_AREA_UNSHARE) ; $(CHOWN) $(GAMEUID) $(GAME) recover$(EXEEXT) ; \
  $(CHGRP) $(GAMEGRP) $(GAME) recover$(EXEEXT) )
- chmod $(GAMEPERM) $(FILE_AREA_UNSHARE)/$(GAME)
- chmod $(EXEPERM) $(FILE_AREA_UNSHARE)/recover$(EXEEXT)
+ $(CHMOD) $(GAMEPERM) $(FILE_AREA_UNSHARE)/$(GAME)
+ $(CHMOD) $(EXEPERM) $(FILE_AREA_UNSHARE)/recover$(EXEEXT)
  -( cd $(FILE_AREA_DOC) ; \
  $(CHOWN) $(GAMEUID) license Guidebook.txt ; \
  $(CHGRP) $(GAMEGRP) license Guidebook.txt ; \
- chmod $(FILEPERM) license Guidebook.txt )
+ $(CHMOD) $(FILEPERM) license Guidebook.txt )
  @HOST_UNIX@-$(CHOWN) $(GAMEUID) $(SHELLDIR)/$(SCRIPT)
  @HOST_UNIX@$(CHGRP) $(GAMEGRP) $(SHELLDIR)/$(SCRIPT)
- @HOST_UNIX@chmod $(EXEPERM) $(SHELLDIR)/$(SCRIPT)
+ @HOST_UNIX@$(CHMOD) $(EXEPERM) $(SHELLDIR)/$(SCRIPT)
 
 dofiles-dlb: check-dlb
  ( cd dat ; cp nhshare $(SHARE_DATNODLB) $(FILE_AREA_SHARE) )
  ( cd dat ; cp nhushare $(UNSHARE_DATNODLB) $(FILE_AREA_UNSHARE) )
 # set up their permissions
  -( cd $(FILE_AREA_SHARE) ; \
  $(CHOWN) $(GAMEUID) nhshare $(SHARE_DATNODLB) ; \
  $(CHGRP) $(GAMEGRP) nhshare $(SHARE_DATNODLB) ; \
- chmod $(FILEPERM) nhshare $(SHARE_DATNODLB) )
+ $(CHMOD) $(FILEPERM) nhshare $(SHARE_DATNODLB) )
  -( cd $(FILE_AREA_UNSHARE) ; \
  $(CHOWN) $(GAMEUID) nhushare $(UNSHARE_DATNODLB) ; \
  $(CHGRP) $(GAMEGRP) nhushare $(UNSHARE_DATNODLB) ; \
- chmod $(FILEPERM) nhushare $(UNSHARE_DATNODLB) )
+ $(CHMOD) $(FILEPERM) nhushare $(UNSHARE_DATNODLB) )
 
 dofiles-nodlb:
 # copy over the game files
  ( cd dat ; cp $(SHARE_DAT) $(FILE_AREA_SHARE) )
  ( cd dat ; cp $(UNSHARE_DAT) $(FILE_AREA_UNSHARE) )
 # set up their permissions
  -( cd $(FILE_AREA_SHARE) ; $(CHOWN) $(GAMEUID) $(SHARE_DAT) ; \
  $(CHGRP) $(GAMEGRP) $(SHARE_DAT) ; \
- chmod $(FILEPERM) $(SHARE_DAT) )
+ $(CHMOD) $(FILEPERM) $(SHARE_DAT) )
  -( cd $(FILE_AREA_UNSHARE) ; $(CHOWN) $(GAMEUID) $(UNSHARE_DAT) ; \
  $(CHGRP) $(GAMEGRP) $(UNSHARE_DAT) ; \
- chmod $(FILEPERM) $(UNSHARE_DAT) )
+ $(CHMOD) $(FILEPERM) $(UNSHARE_DAT) )
 
 update: $(GAME) recover$(EXEEXT) $(CNF_SHARE_DAT) dungeon spec_levs Guidebook.txt
 # (don't yank the old version out from under people who're playing it)
  -mv $(FILE_AREA_UNSHARE)/$(GAME) $(FILE_AREA_UNSHARE)/$(GAME).old
 # quest.dat is also kept open and has the same problems over NFS
@@ -362,21 +362,21 @@
  -mkdir -p $(FILE_AREA_LEVL) $(FILE_AREA_SHARE) $(FILE_AREA_UNSHARE)
  -mkdir -p $(FILE_AREA_DOC)
  -rmdir ./-p
  -$(CHOWN) $(GAMEUID) $(FILE_AREA_VAR) $(FILE_AREA_BONES) $(FILE_AREA_SAVE) $(FILE_AREA_LEVL)
  $(CHGRP) $(GAMEGRP) $(FILE_AREA_VAR) $(FILE_AREA_BONES) $(FILE_AREA_SAVE) $(FILE_AREA_LEVL)
- chmod $(VARDIRPERM) $(FILE_AREA_VAR) $(FILE_AREA_BONES) $(FILE_AREA_SAVE) $(FILE_AREA_LEVL)
+ $(CHMOD) $(VARDIRPERM) $(FILE_AREA_VAR) $(FILE_AREA_BONES) $(FILE_AREA_SAVE) $(FILE_AREA_LEVL)
  -$(CHOWN) $(GAMEUID) $(FILE_AREA_SHARE) $(FILE_AREA_UNSHARE)
  $(CHGRP) $(GAMEGRP) $(FILE_AREA_SHARE) $(FILE_AREA_UNSHARE)
- chmod $(DIRPERM) $(FILE_AREA_SHARE) $(FILE_AREA_UNSHARE)
+ $(CHMOD) $(DIRPERM) $(FILE_AREA_SHARE) $(FILE_AREA_UNSHARE)
 # set up the game files
  ( $(MAKE) dofiles )
 # set up some additional files
  touch $(FILE_AREA_VAR)/perm $(FILE_AREA_VAR)/record $(FILE_AREA_VAR)/logfile
  -( cd $(FILE_AREA_VAR) ; $(CHOWN) $(GAMEUID) perm record logfile ; \
  $(CHGRP) $(GAMEGRP) perm record logfile ; \
- chmod $(VARFILEPERM) perm record logfile )
+ $(CHMOD) $(VARFILEPERM) perm record logfile )
 # and a reminder
  @echo You may also want to reinstall the man pages via the doc Makefile.
 
 
 # 'make clean' removes all the .o files, but leaves around all the executables
===============================================================================


We need to add tile graphics support and sound support.  We also need to
tweak the way that the keyboard-handler DLLs are compiled.

Note to automake/makefile maintainer: it would be preferable to finish
making the tile support conditional, and to make the sound support
conditional.

Note to makefile maintainer: if you can use the meta-variables $@ and $<
to compile the DLLs, why not use them everywhere?  Portability concerns?
===============================================================================
diff -rU5 slashem-0.0.8E0F1-pristine/sys/autoconf/Makefile.src slashem-0.0.8E0F1/sys/autoconf/Makefile.src
--- slashem-0.0.8E0F1-pristine/sys/autoconf/Makefile.src 2006-12-30 05:04:53.000000000 -0800
+++ slashem-0.0.8E0F1/sys/autoconf/Makefile.src 2007-07-28 08:41:00.020250000 -0700
@@ -19,12 +19,12 @@
 SYSUNIXOBJ = ioctl.o unixmain.o unixtty.o unixunix.o unixres.o
 # for Microsoft Window systems
 SYSMSWINSRC = $(srcdir)/../sys/winnt/nttty.c $(srcdir)/../sys/winnt/winnt.c \
  $(srcdir)/../sys/share/pcsys.c $(srcdir)/../sys/share/pcunix.c \
  $(srcdir)/../sys/share/pcmain.c $(srcdir)/../sys/share/random.c \
- $(srcdir)/../sys/share/nhlan.c
-SYSMSWINOBJ = nttty.o winnt.o pcsys.o pcunix.o pcmain.o random.o nhlan.o
+ $(srcdir)/../sys/share/nhlan.c $(srcdir)/../sys/winnt/ntsound.o
+SYSMSWINOBJ = nttty.o winnt.o pcsys.o pcunix.o pcmain.o random.o nhlan.o ntsound.o
 #
 SYSSRC=@SYSSRC@
 SYSOBJ=@SYSOBJ@
 
 CC = @CC@ -DAUTOCONF
@@ -121,11 +121,11 @@
  $(srcdir)/../win/win32/mhsplash.c $(srcdir)/../win/win32/mhstatus.c \
  $(srcdir)/../win/win32/mhtext.c $(srcdir)/../win/win32/mhmenu.c \
          $(srcdir)/../win/win32/mhmap.c $(srcdir)/../win/win32/mhrip.c
 WINMSOBJ = mswproc.o winhack.o mhdlg.o mhaskyn.o mhfont.o mhinput.o mhmain.o \
  mhmsgwnd.o mhsplash.o mhstatus.o mhtext.o mhmenu.o mhmap.o mhrip.o \
- winres.o
+ winres.o tile.o
 WINMSCFLAGS=-I$(srcdir)/../win/win32 -D_WIN32_IE=0x0400
 
 WINSRC = @WINSRC@
 WINOBJ = @WINOBJ@
 WINTTYLIB = @WINTTYLIB@
@@ -149,11 +149,11 @@
 # libraries for SDL/GL window port
 WINSDLLIB = @SDL_CONFIG_LIBS@ -lz -lpng
 WINGLLIB = -lGL
 #
 # libraries for native MS-Windows
-WINMSLIB = -lcomctl32 -lgdi32
+WINMSLIB = -lcomctl32 -lgdi32 -lwinmm
 
 WINLIB = @WINLIB@
 
 LIBS =
 
@@ -214,11 +214,11 @@
  $(srcdir)/../sys/share/pctty.c $(srcdir)/../sys/share/pcunix.c \
  $(srcdir)/../sys/share/random.c $(srcdir)/../sys/share/unixtty.c \
  $(srcdir)/../sys/atari/tos.c $(srcdir)/../sys/be/bemain.c \
  $(srcdir)/../sys/unix/unixmain.c $(srcdir)/../sys/unix/unixres.c \
  $(srcdir)/../sys/unix/unixunix.c $(srcdir)/../sys/winnt/nttty.c \
- $(srcdir)/../sys/winnt/winnt.c
+ $(srcdir)/../sys/winnt/winnt.c $(srcdir)/../sys/winnt/ntsound.c
 
 # generated source files (tile.c is handled separately)
 GENCSRC = monstr.c vis_tab.c  #tile.c
 
 # all windowing-system-dependent .c (for dependencies and such)
@@ -334,11 +334,11 @@
  @touch DUMB.Setup
 
 .SUFFIXES: .dll .o
 
 .o.dll:
- @NHKEYDLL_GCC@$(CC) -shared -Wl,--export-all-symbols \
+ @NHKEYDLL_GCC@$(CC) $(LFLAGS) -shared -Wl,--export-all-symbols \
  @NHKEYDLL_GCC@ -Wl,--add-stdcall-alias -o $@ $<
 
 nhdefkey.o: $(srcdir)/../sys/winnt/nhdefkey.c
  $(CC) $(CFLAGS) -DBUILD_DLL -c $(srcdir)/../sys/winnt/nhdefkey.c
 
@@ -523,10 +523,12 @@
  $(CC) $(CFLAGS) -c $(srcdir)/../sys/unix/unixres.c
 unixunix.o: $(srcdir)/../sys/unix/unixunix.c $(HACK_H)
  $(CC) $(CFLAGS) -c $(srcdir)/../sys/unix/unixunix.c
 nttty.o: $(srcdir)/../sys/winnt/nttty.c $(HACK_H) #../include/win32api.h
  $(CC) $(CFLAGS) -c $(srcdir)/../sys/winnt/nttty.c
+ntsound.o: $(srcdir)/../sys/winnt/ntsound.c $(HACK_H) #../include/win32api.h
+ $(CC) $(CFLAGS) -c $(srcdir)/../sys/winnt/ntsound.c
 winnt.o: $(srcdir)/../sys/winnt/winnt.c $(HACK_H) #../include/win32api.h
  $(CC) $(CFLAGS) -c $(srcdir)/../sys/winnt/winnt.c
 getline.o: $(srcdir)/../win/tty/getline.c $(HACK_H) ../include/func_tab.h
  $(CC) $(CFLAGS) -c $(srcdir)/../win/tty/getline.c
 termcap.o: $(srcdir)/../win/tty/termcap.c $(HACK_H) ../include/tcap.h
===============================================================================


The utility Makefile needs a tweak:
===============================================================================
diff -rU5 slashem-0.0.8E0F1-pristine/sys/autoconf/Makefile.utl slashem-0.0.8E0F1/sys/autoconf/Makefile.utl
--- slashem-0.0.8E0F1-pristine/sys/autoconf/Makefile.utl 2006-12-30 05:04:53.000000000 -0800
+++ slashem-0.0.8E0F1/sys/autoconf/Makefile.utl 2007-07-28 08:30:38.864000000 -0700
@@ -95,11 +95,11 @@
 
 # flags for debugging:
 # CFLAGS = -g -I../include -I$(srcdir)/../include
 
 CFLAGS = -O -I../include -I$(srcdir)/../include @CFLAGS@
-LFLAGS =
+LFLAGS = @LFLAGS@
 
 LIBS =
 
 # If you are cross-compiling, you must use this:
 #OBJDIR = .
===============================================================================


ntconf.h doesn't include system.h and therefore doesn't include autoconf.h.
It appears to be the only *conf.h that does this.  I chose to not include
system.h but include autoconf.h directly.  I also put in a #ifdef AUTOCONF
related to strncmpi().
===============================================================================
diff -rU5 slashem-0.0.8E0F1-pristine/include/ntconf.h slashem-0.0.8E0F1/include/ntconf.h
--- slashem-0.0.8E0F1-pristine/include/ntconf.h 2006-12-30 05:04:53.000000000 -0800
+++ slashem-0.0.8E0F1/include/ntconf.h 2007-07-28 08:16:53.957750000 -0700
@@ -27,10 +27,14 @@
 /*
  * -----------------------------------------------------------------
  *  The remaining code shouldn't need modification.
  * -----------------------------------------------------------------
  */
+#ifdef AUTOCONF
+#include <autoconf.h>
+#endif
+
 /* #define SHORT_FILENAMES */ /* All NT filesystems support long names now */
 
 #ifdef MICRO
 #undef MICRO /* never define this! */
 #endif
@@ -77,10 +81,14 @@
 #ifdef STRNCMPI
 #ifndef __CYGWIN__
 #define strncmpi(a,b,c) strnicmp(a,b,c)
 #endif
 #endif
+#else
+#if HAVE_DECL_STRNICMP && !HAVE_DECL_STRNCMPI
+#define strncmpi(a,b,c) strnicmp(a,b,c)
+#endif
 #endif /* AUTOCONF */
 
 #include <sys/types.h>
 #include <stdlib.h>
 #ifdef __BORLANDC__
===============================================================================


tiletext.c needs a line-ending hack.  There should be a better way; perhaps
someone else can see one?
===============================================================================
diff -rU5 slashem-0.0.8E0F1-pristine/win/share/tiletext.c slashem-0.0.8E0F1/win/share/tiletext.c
--- slashem-0.0.8E0F1-pristine/win/share/tiletext.c 2006-12-30 05:04:53.000000000 -0800
+++ slashem-0.0.8E0F1/win/share/tiletext.c 2007-07-28 08:31:09.801500000 -0700
@@ -569,12 +569,16 @@
  const char *p;
  int i;
  int write_mode;
  FILE *fp;
 
- if (!strcmp(type, RDTMODE))
+ if (!strcmp(type, RDTMODE)) {
  write_mode = FALSE;
+#ifdef __MINGW32__  /* for targetting MinGW under Cygwin */
+ type = "rb";
+#endif
+ }
  else if (!strcmp(type, WRTMODE)) {
  /* Seems like Mingw32's fscanf is confused by the CR/LF issue */
  /* Force text output in this case only */
 #ifdef WIN32
  type = "w+";
===============================================================================


winhack.c needs a #define tweak.
===============================================================================
diff -rU5 slashem-0.0.8E0F1-pristine/win/win32/winhack.c slashem-0.0.8E0F1/win/win32/winhack.c
--- slashem-0.0.8E0F1-pristine/win/win32/winhack.c 2006-12-30 05:04:53.000000000 -0800
+++ slashem-0.0.8E0F1/win/win32/winhack.c 2007-07-28 08:31:24.051500000 -0700
@@ -10,11 +10,11 @@
 #include "dlb.h"
 #include "resource.h"
 #include "mhmain.h"
 #include "mhmap.h"
 
-#ifndef __BORLANDC__
+#if !defined(__BORLANDC__) && !defined(__MINGW32__)
 #include <shlwapi.h>
 #else /* Borland redefines "boolean" in shlwapi.h so just use the little bit we need */
 typedef struct _DLLVERSIONINFO
 {
     DWORD cbSize;
===============================================================================


Paste this line into the bash shell:
        bash configure --prefix=/usr/local/games --host=mingw32-i386 --enable-mswin-graphics --enable-user-sounds --enable-autopickup-exceptions --enable-score-on-botl CFLAGS='-mno-cygwin -mms-bitfields -funsigned-char -DVISION_TABLES' LFLAGS='-mno-cygwin -mconsole' NHKEYDLL_GCC='' CHMOD='true' CHGRP='true' CHOWN='true'

Get a soda, this takes a couple of minutes.

configure doesn't have a way to set the vision tables define, so I hardcoded
it in CFLAGS.

chmod, chgrp, chown don't quite work as expected under Cygwin; I prefer not
to deal with the mess they can make.

As compiling for Windows puts everything in one directory, I would prefer to
have finer-grained control over where that directory is.

===============================================================================
I get the following warnings:

configure: WARNING: If you wanted to set the --build type, don't use --host.
    If a cross compiler is detected then cross compile mode will be used.
{This is expected, as we're not quite cross-compiling but not targetting
native Cygwin either.}

checking for NETHACK__LIBPNG... configure: WARNING: Can't enable proxy graphics (no useable libpng)
{I have not yet installed Cygwin's libpng.  I am not sure yet if it has
libpng usable by MinGW.  So this is expected.  Any hints on compiling
targetting proxy graphics would be appreciated.}

checking for regex.h... no
{Not a warning but surprising as I do have regex.h as well as rxposix.h.}
===============================================================================


Now we can do a "make all".  I get the following warnings:
===============================================================================
make[1]: Entering directory `/c/Games/SlashEM/slashem-0.0.8E0F1/slashem-0.0.8E0F1/src'
Makefile:887: warning: overriding commands for target `monst.o'
Makefile:360: warning: ignoring old commands for target `monst.o'
Makefile:901: warning: overriding commands for target `objects.o'
Makefile:364: warning: ignoring old commands for target `objects.o'
{This warning repeats several times during the make.  Harmless.}

gcc -DAUTOCONF -O -I../include -I./../include -mno-cygwin -mms-bitfields -DVISION_TABLES -DWIN32CON   -c -o panic.o panic.c
panic.c:55: warning: conflicting types for built-in function 'alloca'
{One way to make this compile without a warning is "#define alloca alloca".
That feels hacky, though.  Anyway, this warning seems harmless.}

gcc -DAUTOCONF -O -I../include -I./../include -mno-cygwin -mms-bitfields -DVISION_TABLES -DWIN32CON -c ./files.c
./files.c: In function `validate_prefix_locations':
./files.c:361: warning: assignment makes pointer from integer without a cast
{This is caused by a "details = strerror(errno)".  Grepping
/usr/include/mingw/* turns up two definitions:
    _CRTIMP char* __cdecl   strerror (int); /* NOTE: NOT an old name wrapper. */
    _CRTIMP char* __cdecl   _strerror (const char *);
It appears that the version with the underscore is being used.  I don't
know why.}

gcc -DAUTOCONF -O -I../include -I./../include -mno-cygwin -mms-bitfields -DVISION_TABLES -DWIN32CON -c ./potion.c
./potion.c: In function `upgrade_obj':
./potion.c:2517: warning: passing arg 2 of `artifact_name' from incompatible pointer type
{Caused by "artifact_name(ONAME(obj), &otyp2)".
Fix: "artifact_name(ONAME(obj), (short *)&otyp2)".}

gcc -DAUTOCONF -O -I../include -I./../include -mno-cygwin -mms-bitfields -DVISION_TABLES -DWIN32CON -I./../win/win32 -D_WIN32_IE=0x0400 -c ./../win/win32/mhmenu.c
./../win/win32/mhmenu.c: In function `onListChar':
./../win/win32/mhmenu.c:1141: warning: comparison is always false due to limited range of data type
{Expected; exists in vanilla nethack source; harmless.}

make[1]: Entering directory `/c/Games/SlashEM/slashem-0.0.8E0F1/slashem-0.0.8E0F1/doc'
tbl ./tmac.n ./Guidebook.mn | nroff | col -bx > Guidebook
/bin/sh: col: command not found
make[1]: *** [Guidebook] Error 127
make[1]: Leaving directory `/c/Games/SlashEM/slashem-0.0.8E0F1/slashem-0.0.8E0F1/doc'
make: *** [Guidebook] Error 2
{Because of the redirection, the Guidebook file is created but empty, so a
second 'make all' command won't try to create it again.
Suggested fix: when targetting Windows, don't worry about the Guidebook
source files; just use Guidebook.txt as is.}

gcc -DAUTOCONF -O -I../include -I./../include -mno-cygwin -mms-bitfields -DVISION_TABLES -DWIN32CON   -c -o lev_yacc.o lev_yacc.c
./lev_comp.y: In function `yyparse':
./lev_comp.y:600: warning: assignment from incompatible pointer type
{That's because of a "struct room_door *" that should be a "room_door *".
This error is also in sys/share/lev_yacc.c.}
===============================================================================

If everything worked, it's time to do a "make install".

The file 'Guidebook' doesn't get built properly as I am missing a tool
named 'col'.  It appears that col isn't provided by Cygwin; either that
or I simply can't figure out what package has it.  This is irrelevant
under Windows since the file that is installed is 'Guidebook.txt'.


A request: when compiling the level files, could we compile them all at
once?  Doing this:
        ../util/lev_comp ./beholder.des ./bigroom.des ./blkmar.des ./castle.des ./grund.des [...]
is much faster than:
        ../util/lev_comp ./beholder.des
        ../util/lev_comp ./bigroom.des
        ../util/lev_comp ./blkmar.des
        ../util/lev_comp ./castle.des
        ../util/lev_comp ./grund.des
        [...]


=== Optional to get regular expression support: ===============================

Getting support for regexps under Cygwin is not terribly hard.

First you need to get the GNU rx 1.5 tarball.  Build it for mingw.  The
trick is to set an env var CC='gcc -mno-cygwin' before running configure.
Both the old regex 0.12 and the new rx 1.5 appear to work, as long as you
compile targetting mingw.  However, regex.o must be put into a library
manually.  
        ar rc libregex.a regex.o; ranlib libregex.a
Put header files in \cygwin\usr\include\mingw; libs in \cygwin\lib\mingw.

I initially had crashes using the rx library, but I cannot reproduce them
anymore.  I might not have targetted MinGW when I first compiled it.

USER_SOUND_REGEX can only use the old regex library, not the newer rx
library.

Personally I prefer the rx library.  I like the operator syntax better.
And I don't care about sounds, and if I did, I'd be fine with the simple
globber.


Anyway.  To use the old regex 0.12 library, you need to put:
===============================================================================
#if 1
# define USE_REGEX_MATCH
# define GNU_REGEX
# define __need_size_t
# include <stddef.h> //SWD regex.h needs size_t but doesn't pull it in.
# include <regex.h> //SWD manually installed gnu regex 0.12 package.
# define USER_SOUNDS_REGEX // SWD only works with GNU_REGEX.
#endif
===============================================================================
at the end of include/config.h section 5.

In addition, comment out everything related to "REGEX" in include/autoconf.h.

Finally, edit src/Makefile, adding "-lregex" to the "WINMSLIB=" line.

make clean; make all

Regex power users may wish to tweak the reg_syntax_t variable to suit their
preferences.  See regex.h and regex.info for documentation on this.

Testing the regex library: add these lines to the defaults.nh file:
===============================================================================
OPTIONS=menucolors
MENUCOLOR=" 0%$"=white&bold
MENUCOLOR=" \([1-9]\|1[0-9]\)%$"=lightcyan
MENUCOLOR=" [234][0-9]%$"=yellow
MENUCOLOR=" [567][0-9]%$"=orange
MENUCOLOR=" \([89][0-9]\|100\)%$"=red
SOUNDDIR=c:\windows\media
SOUND=MESG "short sword" "start.wav" 100
SOUND=MESG "You \(throw\|shoot\)[^b-z]*\(dart\|arrow\|ya\|bolt\|dagger\|bullet\|grenade\|rock\)s*" "Windows XP Recycle.wav" 100
===============================================================================
That makes the spell menu (viewed by the plus key) highlight your chances
of casting each spell you know.  And there will be a tick every time you
see or manipulate a short sword, and a rustling every time you throw or
fire two or more missiles.  Rogues are good for testing this.

The firing regexp doesn't quite work as expected, since there is no message
at all if you fire exactly one projectile.


Alternately, to use the Posix-compliant rx library, put:
===============================================================================
#if 1
# define USE_REGEX_MATCH
# define POSIX_REGEX
# define __need_size_t
# include <stddef.h> //SWD rxposix.h needs size_t but doesn't pull it in.
# include <rxposix.h> //SWD manually installed gnu rx 1.5 package.
#endif
===============================================================================
at the end of include/config.h section 5.

In addition, comment out everything related to "REGEX" in include/autoconf.h.

Finally, edit src/Makefile, adding "-lrx" to the "WINMSLIB=" line.

make clean; make all

Testing the rx library: add these lines to the defaults.nh file:
===============================================================================
OPTIONS=menucolors
MENUCOLOR=" 0%$"=white&bold
MENUCOLOR=" ([1-9]|1[0-9])%$"=lightcyan
MENUCOLOR=" [234][0-9]%$"=yellow
MENUCOLOR=" [567][0-9]%$"=orange
MENUCOLOR=" ([89][0-9]|100)%$"=red
===============================================================================
That makes the spell menu (viewed by the plus key) highlight your chances
of casting each spell you know.

Note that AUTOPICKUP_EXCEPTIONs don't use regexps.  Only MENUCOLORs and
SOUNDs do.


I invite, even request, discussion of any or all parts of this post.

        Silas Dunsmore

--
Later, eh?    Silas

CUT TO:        Tight closeup of IGNATZ with microphone as TV reporter on a
               street in Los Angeles.

Ignatz:        And so Pancho, knowing the Secret of Power, created his own New
               Age cult.  he is now a millionaire and lives in Malibu.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Slashem-devel mailing list
Slashem-devel@...
https://lists.sourceforge.net/lists/listinfo/slashem-devel