# HG changeset patch # User John "Elwin" Edwards # Date 1399496918 25200 # Node ID 65f3da34578a4bdecfe459ecee0a1b8282c37340 # Parent e6c8652473fe828a84df210ec4ad24f21b0b6992 rogue4, arogue5: improve portability. Most changes merely prevent including header files that don't exist. All games now build and run on MinGW, though bugs remain. diff -r e6c8652473fe -r 65f3da34578a README.txt --- a/README.txt Sat May 03 10:31:30 2014 -0700 +++ b/README.txt Wed May 07 14:08:38 2014 -0700 @@ -7,7 +7,7 @@ the build process slightly improved. The essential flavor of a codebase half as old as stored-program computing machinery remains unchanged. -To install on Unix: +To install on Unix (including OS X): If you checked out the source from Mercurial, run 'autoreconf' first. @@ -26,6 +26,17 @@ Use the included Visual Studio solution files. Warning: they have not been tested recently. +You can also build on Windows using MinGW. Make sure pdcurses is installed. +You will have to go into the '/lib' folder and copy 'libpdcurses.a' to +'libcurses.a', and 'libpdcurses.dll.a' to 'libcurses.dll.a'; this should get +fixed soon. + +It is recommended to run 'configure' with the '--disable-logfile' option, and +'make' with the 'LDFLAGS=-static' option. + +The games should all build with MinGW, but there are still bugs with arrow keys +and saving/restoring. + See the individual games' subdirectories for further documentation. Some of the manpages may be outdated, but the guides to playing should be accurate. diff -r e6c8652473fe -r 65f3da34578a arogue5/configure.ac --- a/arogue5/configure.ac Sat May 03 10:31:30 2014 -0700 +++ b/arogue5/configure.ac Wed May 07 14:08:38 2014 -0700 @@ -13,7 +13,7 @@ MP_WITH_CURSES # Checks for header files. AC_HEADER_STDC -AC_CHECK_HEADERS([pwd.h errno.h fcntl.h limits.h nlist.h stdlib.h string.h sys/ioctl.h termios.h unistd.h utmp.h term.h ncurses/term.h process.h]) +AC_CHECK_HEADERS([pwd.h errno.h fcntl.h limits.h nlist.h stdlib.h string.h sys/ioctl.h sys/utsname.h termios.h unistd.h utmp.h term.h ncurses/term.h process.h]) # Checks for typedefs, structures, and compiler characteristics. AC_TYPE_SIZE_T diff -r e6c8652473fe -r 65f3da34578a arogue5/mdport.c --- a/arogue5/mdport.c Sat May 03 10:31:30 2014 -0700 +++ b/arogue5/mdport.c Wed May 07 14:08:38 2014 -0700 @@ -42,9 +42,15 @@ #undef MOUSE_MOVED #elif defined(__DJGPP__) #include -#else +#endif + +#ifdef HAVE_PWD_H #include +#endif +#ifdef HAVE_SYS_UTSNAME_H #include +#endif +#ifdef HAVE_UNISTD_H #include #endif @@ -57,12 +63,10 @@ #include -#if defined(__INTERIX) || defined(__MSYS__) +#if defined(HAVE_TERM_H) #include #elif defined(HAVE_NCURSES_TERM_H) #include -#else -#include #endif #include @@ -93,14 +97,20 @@ } int -md_hasclreol() +md_hasclreol(void) { -#ifndef attron - return(!CE); -#elif !defined(__PDCURSES__) - return(clr_eol != NULL); +#if defined(clr_eol) +#ifdef NCURSES_VERSION + if (cur_term == NULL) + return(0); + if (cur_term->type.Strings == NULL) + return(0); +#endif + return((clr_eol != NULL) && (*clr_eol != 0)); +#elif defined(__PDCURSES__) + return(TRUE); #else - return(TRUE); + return((CE != NULL) && (*CE != 0)); #endif } diff -r e6c8652473fe -r 65f3da34578a rogue4/configure.ac --- a/rogue4/configure.ac Sat May 03 10:31:30 2014 -0700 +++ b/rogue4/configure.ac Wed May 07 14:08:38 2014 -0700 @@ -14,9 +14,7 @@ MP_WITH_CURSES # Checks for header files. AC_HEADER_STDC -AC_CHECK_HEADERS([arpa/inet.h sys/utsname.h pwd.h fcntl.h limits.h nlist.h stdlib.h string.h sys/ioctl.h termios.h unistd.h utmp.h term.h ncurses/term.h process.h]) -# WARN: the sources often don't include the headers when needed. That is one -# reason why adding "-Wall" to CFLAGS produces 1246 lines of messages. +AC_CHECK_HEADERS([arpa/inet.h sys/utsname.h pwd.h fcntl.h limits.h nlist.h stdlib.h string.h sys/ioctl.h termios.h unistd.h utmpx.h term.h ncurses/term.h process.h]) # Checks for typedefs, structures, and compiler characteristics. AC_TYPE_UID_T diff -r e6c8652473fe -r 65f3da34578a rogue4/mdport.c --- a/rogue4/mdport.c Sat May 03 10:31:30 2014 -0700 +++ b/rogue4/mdport.c Wed May 07 14:08:38 2014 -0700 @@ -29,6 +29,10 @@ SUCH DAMAGE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #if defined(_WIN32) #include #include @@ -40,10 +44,15 @@ #undef MOUSE_MOVED #elif defined(__DJGPP__) #include -#else +#endif + +#ifdef HAVE_PWD_H #include -#include +#endif +#ifdef HAVE_UNISTD_H #include +#endif +#ifdef HAVE_UTMPX_H #include #endif @@ -60,7 +69,7 @@ #endif #include -#if !defined(DJGPP) +#ifdef HAVE_TERM_H #include #endif @@ -657,28 +666,6 @@ #endif } -char * -md_gethostname() -{ - static char nodename[80]; - char *n = NULL; -#if !defined(_WIN32) && !defined(__DJGPP__) - struct utsname ourname; - - if (uname(&ourname) == 0) - n = ourname.nodename; -#endif - if ((n == NULL) || (*n == '\0')) - if ( (n = getenv("COMPUTERNAME")) == NULL) - if ( (n = getenv("HOSTNAME")) == NULL) - n = "localhost"; - - strncpy(nodename, n, 80); - nodename[79] = 0; - - return(nodename); -} - int md_erasechar() {