From owner-svn-src-head@freebsd.org Sat Nov 2 03:38:00 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2DF9615FC51; Sat, 2 Nov 2019 03:38:00 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 474lBc0TvKz477M; Sat, 2 Nov 2019 03:38:00 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E84281D602; Sat, 2 Nov 2019 03:37:59 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA23bxLo070873; Sat, 2 Nov 2019 03:37:59 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA23bw40070867; Sat, 2 Nov 2019 03:37:58 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201911020337.xA23bw40070867@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 2 Nov 2019 03:37:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354245 - in head/stand: . common liblua lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head/stand: . common liblua lua X-SVN-Commit-Revision: 354245 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Nov 2019 03:38:00 -0000 Author: kevans Date: Sat Nov 2 03:37:58 2019 New Revision: 354245 URL: https://svnweb.freebsd.org/changeset/base/354245 Log: stand: consolidate knowledge of lua path Multiple places coordinate to 'know' where lua scripts are installed. Knock this down to being formally defined (and overridable) in exactly one spot, defs.mk, and spread the knowledge to loaders and liblua alike. A future commit will expose this to lua as loader.lua_path, so it can build absolute paths to lua scripts as needed. MFC after: 1 week Modified: head/stand/common/interp_lua.c head/stand/defs.mk head/stand/liblua/Makefile head/stand/liblua/luaconf.h head/stand/loader.mk head/stand/lua/Makefile Modified: head/stand/common/interp_lua.c ============================================================================== --- head/stand/common/interp_lua.c Sat Nov 2 03:09:17 2019 (r354244) +++ head/stand/common/interp_lua.c Sat Nov 2 03:37:58 2019 (r354245) @@ -60,6 +60,8 @@ static struct interp_lua_softc lua_softc; #define LDBG(...) #endif +#define LOADER_LUA LUA_PATH "/loader.lua" + INTERP_DEFINE("lua"); static void * @@ -120,7 +122,7 @@ interp_init(void) lua_pop(luap, 1); /* remove lib */ } - filename = "/boot/lua/loader.lua"; + filename = LOADER_LUA; if (interp_include(filename) != 0) { const char *errstr = lua_tostring(luap, -1); errstr = errstr == NULL ? "unknown" : errstr; Modified: head/stand/defs.mk ============================================================================== --- head/stand/defs.mk Sat Nov 2 03:09:17 2019 (r354244) +++ head/stand/defs.mk Sat Nov 2 03:37:58 2019 (r354245) @@ -40,6 +40,9 @@ BOOTOBJ= ${OBJTOP}/stand # BINDIR is where we install BINDIR?= /boot +# LUAPATH is where we search for and install lua scripts. +LUAPATH?= /boot/lua + LIBSA= ${BOOTOBJ}/libsa/libsa.a .if ${MACHINE} == "i386" LIBSA32= ${LIBSA} Modified: head/stand/liblua/Makefile ============================================================================== --- head/stand/liblua/Makefile Sat Nov 2 03:09:17 2019 (r354244) +++ head/stand/liblua/Makefile Sat Nov 2 03:37:58 2019 (r354245) @@ -27,7 +27,7 @@ SRCS+= lerrno.c lfs.c lstd.c lutils.c WARNS= 3 -CFLAGS+= -DLUA_PATH_DEFAULT=\"/boot/lua/\?.lua\" +CFLAGS+= -DLUA_PATH=\"${LUAPATH}\" -DLUA_PATH_DEFAULT=\"${LUAPATH}/\?.lua\" CFLAGS+= -ffreestanding -nostdlib -DLUA_USE_POSIX CFLAGS+= -fno-stack-protector -D__BSD_VISIBLE CFLAGS+= -I${BOOTSRC}/include -I${LIBLUASRC} -I${LUASRC} -I${LDRSRC} Modified: head/stand/liblua/luaconf.h ============================================================================== --- head/stand/liblua/luaconf.h Sat Nov 2 03:09:17 2019 (r354244) +++ head/stand/liblua/luaconf.h Sat Nov 2 03:37:58 2019 (r354245) @@ -202,7 +202,7 @@ #else /* }{ */ -#define LUA_ROOT "/boot/lua/" LUA_VDIR "/" +#define LUA_ROOT LUA_PATH "/" LUA_VDIR "/" #define LUA_LDIR LUA_ROOT "share/" #define LUA_CDIR LUA_ROOT "lib/" #ifndef LUA_PATH_DEFAULT Modified: head/stand/loader.mk ============================================================================== --- head/stand/loader.mk Sat Nov 2 03:09:17 2019 (r354244) +++ head/stand/loader.mk Sat Nov 2 03:37:58 2019 (r354245) @@ -62,6 +62,7 @@ SRCS+= interp_lua.c .include "${BOOTSRC}/lua.mk" LDR_INTERP= ${LIBLUA} LDR_INTERP32= ${LIBLUA32} +CFLAGS+= -DLUA_PATH=\"${LUAPATH}\" .elif ${LOADER_INTERP} == "4th" SRCS+= interp_forth.c .include "${BOOTSRC}/ficl.mk" Modified: head/stand/lua/Makefile ============================================================================== --- head/stand/lua/Makefile Sat Nov 2 03:09:17 2019 (r354244) +++ head/stand/lua/Makefile Sat Nov 2 03:37:58 2019 (r354245) @@ -12,7 +12,7 @@ MAN= cli.lua.8 \ password.lua.8 \ screen.lua.8 -FILESDIR= /boot/lua +FILESDIR= ${LUAPATH} FILES= cli.lua \ color.lua \ config.lua \