Merge branch 'fix/libnh-native-build' of https://github.com/YttriumOx/NetHack into YttriumOx-fix/libnh-native-build
This commit is contained in:
@@ -37,7 +37,7 @@ extern struct passwd *getpwnam(const char *);
|
|||||||
#ifdef CHDIR
|
#ifdef CHDIR
|
||||||
static void chdirx(const char *, boolean);
|
static void chdirx(const char *, boolean);
|
||||||
#endif /* CHDIR */
|
#endif /* CHDIR */
|
||||||
static boolean whoami(void);
|
boolean whoami(void);
|
||||||
static void process_options(int, char **);
|
static void process_options(int, char **);
|
||||||
|
|
||||||
#ifdef _M_UNIX
|
#ifdef _M_UNIX
|
||||||
@@ -516,7 +516,7 @@ chdirx(const char *dir, boolean wr)
|
|||||||
#endif /* CHDIR */
|
#endif /* CHDIR */
|
||||||
|
|
||||||
/* returns True iff we set plname[] to username which contains a hyphen */
|
/* returns True iff we set plname[] to username which contains a hyphen */
|
||||||
static boolean
|
boolean
|
||||||
whoami(void)
|
whoami(void)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@@ -805,7 +805,7 @@ get_nhuuid(void)
|
|||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||||
char *uuid = (char *) &stmp[0];
|
char *uuid = (char *) &stmp[0];
|
||||||
#ifndef NONHUUID
|
#ifndef NONHUUID
|
||||||
#ifdef NHUUID
|
#ifdef __EMSCRIPTEN__
|
||||||
int uuid_available = 0;
|
int uuid_available = 0;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@@ -814,7 +814,7 @@ get_nhuuid(void)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
#ifndef NONHUUID
|
#ifndef NONHUUID
|
||||||
#ifdef NHUUID
|
#ifdef __EMSCRIPTEN__
|
||||||
uuid_available = emscripten_run_script_int(
|
uuid_available = emscripten_run_script_int(
|
||||||
"typeof crypto !== 'undefined'"
|
"typeof crypto !== 'undefined'"
|
||||||
" && typeof crypto.randomUUID === 'function'");
|
" && typeof crypto.randomUUID === 'function'");
|
||||||
@@ -824,7 +824,7 @@ get_nhuuid(void)
|
|||||||
uuid = (char *) &stmp[0];
|
uuid = (char *) &stmp[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* NHUUID */
|
#endif /* __EMSCRIPTEN__ */
|
||||||
#endif /* NONHUUID */
|
#endif /* NONHUUID */
|
||||||
Snprintf(svn.nhuuid, sizeof svn.nhuuid, "%s", uuid);
|
Snprintf(svn.nhuuid, sizeof svn.nhuuid, "%s", uuid);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -345,6 +345,12 @@ LIBNHSYSOBJ = $(TARGETPFX)libnhmain.o $(TARGETPFX)ioctl.o \
|
|||||||
#without winshim
|
#without winshim
|
||||||
override GAME=
|
override GAME=
|
||||||
MOREALL += ( cd src ; $(MAKE) pregame ; $(MAKE) $(TARGETPFX)libnh.a )
|
MOREALL += ( cd src ; $(MAKE) pregame ; $(MAKE) $(TARGETPFX)libnh.a )
|
||||||
|
# With $(GAME) empty, the regular `recover: $(GAME)` chain no longer
|
||||||
|
# triggers lua_support, but recover.c still pulls in hack.h -> nhlua.h
|
||||||
|
# transitively. Make recover depend on lua_support explicitly.
|
||||||
|
ifdef MAKEFILE_TOP
|
||||||
|
recover: lua_support
|
||||||
|
endif
|
||||||
endif # WANT_LIBNH
|
endif # WANT_LIBNH
|
||||||
|
|
||||||
# Lua
|
# Lua
|
||||||
@@ -568,8 +574,20 @@ $(TARGETPFX)macuuid.o: ../sys/unix/macuuid.m
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef WANT_LIBNH
|
ifdef WANT_LIBNH
|
||||||
$(TARGETPFX)libnh.a: $(HOBJ) $(LIBNHSYSOBJ) ../lib/lua/liblua-$(LUA_VERSION).a
|
# Build libnh.a by merging the engine objects, the shim windowport,
|
||||||
$(AR) rcs $@ $(HOBJ) $(LIBNHSYSOBJ) ../lib/lua/liblua-$(LUA_VERSION).a
|
# date.o (separate from $(HOBJ) per Makefile.src), hacklib.a, and Lua's
|
||||||
|
# static archive. Use libtool -static rather than ar so hacklib.a and
|
||||||
|
# liblua-$(LUA_VERSION).a have their members merged in -- ar would archive
|
||||||
|
# them as opaque .a members and macOS ld can't dereference those.
|
||||||
|
# Depending on $(LUALIB) triggers the lua_support build (which generates
|
||||||
|
# include/nhlua.h); without it, $(HOBJ) won't compile.
|
||||||
|
# filter-out drops $(SYSOBJ) (which carries unixmain.o) and $(WINOBJ) (the
|
||||||
|
# tty windowport) from $(HOBJ); $(LIBNHSYSOBJ) supplies libnhmain.o and
|
||||||
|
# winshim.o in their place.
|
||||||
|
$(TARGETPFX)libnh.a: $(LUALIB) $(HOBJ) $(LIBNHSYSOBJ) $(DATE_O) $(TARGET_HACKLIB)
|
||||||
|
libtool -static -o $@ \
|
||||||
|
$(filter-out $(SYSOBJ) $(WINOBJ),$(HOBJ)) \
|
||||||
|
$(LIBNHSYSOBJ) $(DATE_O) $(TARGET_HACKLIB) $(LUALIB)
|
||||||
@echo "$@ built."
|
@echo "$@ built."
|
||||||
$(TARGETPFX)libnhmain.o : ../sys/libnh/libnhmain.c $(HACK_H)
|
$(TARGETPFX)libnhmain.o : ../sys/libnh/libnhmain.c $(HACK_H)
|
||||||
$(CC) $(CFLAGS) -c -o$@ $<
|
$(CC) $(CFLAGS) -c -o$@ $<
|
||||||
|
|||||||
Reference in New Issue
Block a user