fix lua tmpname() vs mkstemp() on linux

Avoid the warning that tmpname should be replaced by mkstemp by
replacing tmpname with mkstemp.  lua has code to do that but it isn't
trivial to activate while leaving the lua distribution unmodified.
[I've no idea whether nethack's usage even results in liblua ever
creating any temporary files.]

Using nethack's hints to pass -DLUA_USE_POSIX from top Makefile to
lib/lua-$(LUA_VERSION)/Makefile has been tested, building liblua.a
on linux with that has not.
This commit is contained in:
PatR
2020-05-18 12:01:23 -07:00
parent 82ccfaa3ac
commit ce5eebcb9b
7 changed files with 39 additions and 8 deletions

View File

@@ -1,5 +1,5 @@
# NetHack Top-level Makefile.
# NetHack 3.6 Makefile.top $NHDT-Date: 1575932543 2019/12/09 23:02:23 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.44 $
# NetHack 3.6 Makefile.top $NHDT-Date: 1589828477 2020/05/18 19:01:17 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.48 $
# Copyright (c) 2015 by Kenneth Lorber, Kensington, Maryland
# NetHack may be freely redistributed. See license for details.
@@ -105,7 +105,8 @@ $(GAME): lua_support
lua_support: lib/lua/liblua.a include/nhlua.h
@true
lib/lua-$(LUA_VERSION)/src/liblua.a: lib/lua-$(LUA_VERSION)/src/lua.h
( cd lib/lua-$(LUA_VERSION)/src ; make a ; cd ../../.. )
( cd lib/lua-$(LUA_VERSION)/src \
&& make SYSCFLAGS=$(SYSCFLAGS) a && cd ../../.. )
lib/lua/liblua.a: lib/lua-$(LUA_VERSION)/src/liblua.a
@( if [ ! -d lib/lua ] ; then mkdir -p lib/lua ; fi )
cp lib/lua-$(LUA_VERSION)/src/liblua.a $@

View File

@@ -1,5 +1,5 @@
#
# NetHack 3.6 linux $NHDT-Date: 1432512814 2015/05/25 00:13:34 $ $NHDT-Branch: master $:$NHDT-Revision: 1.12 $
# NetHack 3.6 linux $NHDT-Date: 1589828478 2020/05/18 19:01:18 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.31 $
# Copyright (c) Kenneth Lorber, Kensington, Maryland, 2007.
# NetHack may be freely redistributed. See license for details.
#
@@ -35,6 +35,11 @@ CFLAGS+=-DCURSES_GRAPHICS
#CFLAGS+=-DMSGHANDLER
#CFLAGS+=-DTTY_TILES_ESCCODES
# when building liblua.a, avoid warning that use of tmpnam() should be
# replaced by mkstemp(); the lua code doesn't use nethack's config.h so
# this needs to be passed via make rather than defined in unixconf.h
SYSCFLAGS=-DLUA_USE_POSIX
LINK=$(CC)
# Only needed for GLIBC stack trace:
LFLAGS=-rdynamic

View File

@@ -1,5 +1,5 @@
#
# NetHack 3.5 linux $NHDT-Date: 1524684267 2018/04/25 19:24:27 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.1 $
# NetHack 3.5 linux $NHDT-Date: 1589828479 2020/05/18 19:01:19 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.3 $
# NetHack 3.5 linux $Date: 2010/01/15 19:54:37 $ $Revision: 1.8 $
# Copyright (c) Kenneth Lorber, Kensington, Maryland, 2007.
# NetHack may be freely redistributed. See license for details.
@@ -31,6 +31,11 @@ CFLAGS+=-DTIMED_DELAY
CFLAGS+=-DHACKDIR=\"$(HACKDIR)\"
CFLAGS+=-DVAR_PLAYGROUND=\"$(HACKDIR)/var\"
# when building liblua.a, avoid warning that use of tmpnam() should be
# replaced by mkstemp(); the lua code doesn't use nethack's config.h so
# this needs to be passed via make rather than defined in unixconf.h
SYSCFLAGS=-DLUA_USE_POSIX
LINK=$(CC)
# Only needed for GLIBC stack trace:
LFLAGS=-rdynamic

View File

@@ -1,5 +1,5 @@
#
# NetHack 3.6 linux $NHDT-Date: 1432512814 2018/11/23 16:00:00 $ $NHDT-Branch: master $:$NHDT-Revision: 1.12 $
# NetHack 3.6 linux $NHDT-Date: 1589828479 2020/05/18 19:01:19 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1 $
# Copyright (c) Patric Mueller
# NetHack may be freely redistributed. See license for details.
#
@@ -15,6 +15,11 @@ VARDIR=$(HACKDIR)
CFLAGS=-g -I../include
# when building liblua.a, avoid warning that use of tmpnam() should be
# replaced by mkstemp(); the lua code doesn't use nethack's config.h so
# this needs to be passed via make rather than defined in unixconf.h
SYSCFLAGS=-DLUA_USE_POSIX
LINK=$(CC)
WINSRC = $(WINTTYSRC)

View File

@@ -1,5 +1,5 @@
#
# NetHack 3.6 linux-qt4 $NHDT-Date: 1566346592 2019/08/21 00:16:32 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.27 $
# NetHack 3.6 linux-qt4 $NHDT-Date: 1589828479 2020/05/18 19:01:19 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.28 $
# Copyright (c) Kenneth Lorber, Kensington, Maryland, 2007.
# NetHack may be freely redistributed. See license for details.
#
@@ -30,6 +30,11 @@ CFLAGS+=-DCONFIG_ERROR_SECURE=FALSE
CFLAGS+=-DQT_GRAPHICS -DDEFAULT_WINDOW_SYS=\"Qt\" -DNOTTYGRAPHICS
CFLAGS+=`pkg-config QtGui --cflags`
# when building liblua.a, avoid warning that use of tmpnam() should be
# replaced by mkstemp(); the lua code doesn't use nethack's config.h so
# this needs to be passed via make rather than defined in unixconf.h
SYSCFLAGS=-DLUA_USE_POSIX
LINK=g++
CXX=g++ -std=gnu++11

View File

@@ -1,5 +1,5 @@
#
# NetHack 3.6 linux-qt5 $NHDT-Date: 1566346602 2019/08/21 00:16:42 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.27 $
# NetHack 3.6 linux-qt5 $NHDT-Date: 1589828480 2020/05/18 19:01:20 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.29 $
# Copyright (c) Kenneth Lorber, Kensington, Maryland, 2007.
# NetHack may be freely redistributed. See license for details.
#
@@ -30,6 +30,11 @@ CFLAGS+=-DCONFIG_ERROR_SECURE=FALSE
CFLAGS+=-DQT_GRAPHICS -DDEFAULT_WINDOW_SYS=\"Qt\" -DNOTTYGRAPHICS
CFLAGS+=`pkg-config Qt5Gui Qt5Widgets Qt5Multimedia --cflags` -fPIC
# when building liblua.a, avoid warning that use of tmpnam() should be
# replaced by mkstemp(); the lua code doesn't use nethack's config.h so
# this needs to be passed via make rather than defined in unixconf.h
SYSCFLAGS=-DLUA_USE_POSIX
LINK=g++
CXX=g++ -std=gnu++11

View File

@@ -1,5 +1,5 @@
#
# NetHack 3.6 linux-x11 $NHDT-Date: 1566346602 2019/08/21 00:16:42 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.24 $
# NetHack 3.6 linux-x11 $NHDT-Date: 1589828480 2020/05/18 19:01:20 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.25 $
# Copyright (c) Kenneth Lorber, Kensington, Maryland, 2007.
# NetHack may be freely redistributed. See license for details.
#
@@ -27,6 +27,11 @@ CFLAGS+=-DX11_GRAPHICS -DDEFAULT_WINDOW_SYS=\"X11\" -DNOTTYGRAPHICS
CFLAGS+=-DDUMPLOG
CFLAGS+=-DCONFIG_ERROR_SECURE=FALSE
# when building liblua.a, avoid warning that use of tmpnam() should be
# replaced by mkstemp(); the lua code doesn't use nethack's config.h so
# this needs to be passed via make rather than defined in unixconf.h
SYSCFLAGS=-DLUA_USE_POSIX
LINK=$(CC)
WINSRC = $(WINX11SRC)