libnethack pr385

roll parts of pr385 into source tree

This does not take the PR as is.

Unlike the PR, this streamlines and minimizes the integration somewhat:

- use hints/include mechanism instead of creating alternative
  Makefile.dat, Makefile.src, Makefile.top, Makefile.utl in sys/lib;
  those would have been a maintenance nightmare.

- don't have alternative mkmkfile.sh and setup.sh in sys/lib.

- sys/lib/libnethackmain.c differed from sys/unix/unixmain.c by
  very little, so just place a small bit of conditional code at the
  top of sys/unix/unixmain.c instead.

- changed the conditional code bits from __EMSCRIPTEN__ to
  CROSS_TO_WASM.

- You should be able to build the wasm result by:
    cd sys/unix ; sh setup.sh hints/linux.2020 ; cd ../..
    make fetch-lua    (<-one time)
    make WANT_LIBNH all

- You should be able to build LIBNBH by:
    cd sys/unix ; sh setup.sh hints/linux.2020 ; cd ../..
    make fetch-lua    (<-one time)
    make CROSS_TO_WASM=1 all

As it is currently coded, winshim.c requires C99.
This commit is contained in:
Adam Powers
2020-08-26 19:22:00 -07:00
committed by nhmall
parent 741e6fd5b7
commit dc2d757399
28 changed files with 1555 additions and 120 deletions

View File

@@ -399,11 +399,14 @@ struct savefile_info {
#ifdef UNIX
#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED)
/* see end.c */
#if !defined(CROSS_TO_WASM)
#ifndef PANICTRACE
#define PANICTRACE
#endif
#endif
#endif
#endif /* PANICTRACE */
#endif /* CROSS_TO_WASM */
#endif /* NH_DEVEL_STATUS != NH_STATUS_RELEASED */
#endif /* UNIX */
/* The following are meaningless if PANICTRACE is not defined: */
#if defined(__linux__) && defined(__GLIBC__) && (__GLIBC__ >= 2)
#define PANICTRACE_LIBC
@@ -412,8 +415,10 @@ struct savefile_info {
#define PANICTRACE_LIBC
#endif
#ifdef UNIX
#if !defined(CROSS_TO_WASM) /* no popen in WASM */
#define PANICTRACE_GDB
#endif
#endif
/* Supply nethack_enter macro if not supplied by port */
#ifndef nethack_enter

View File

@@ -389,7 +389,7 @@
#endif /* LINUX */
#endif /* GNOME_GRAPHICS */
#ifdef MACOSX
#if defined(MACOSX) && !defined(LIBNH)
# define RUNTIME_PASTEBUF_SUPPORT
#endif