Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 18 Aug 2018 07:41:01 +0000 (UTC)
From:      David Naylor <dbn@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r477483 - in head/lang/lua53: . files
Message-ID:  <201808180741.w7I7f1pt093184@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dbn
Date: Sat Aug 18 07:41:00 2018
New Revision: 477483
URL: https://svnweb.freebsd.org/changeset/ports/477483

Log:
  lang/lua53: update to 5.3.5 (final release for 5.3)
  
   - Cleanup of variables
   - Use the 'bsd' target for build stage
   - Add options to to select interactive command line editing
   - Add options to control debug options
   - Add option for HTML documentation
   - No change log provided upstream
  
  Submitted by:	Russel Haley (russ.haley@gmail.com)
  		Andrew Gierth (andrew_tao173.riddles.org.uk)
  Differential Revision:	https://reviews.freebsd.org/D13690

Added:
  head/lang/lua53/files/extra-patch-assert   (contents, props changed)
  head/lang/lua53/files/patch-src_lua.c   (contents, props changed)
Deleted:
  head/lang/lua53/files/patch-src__ldebug.c
  head/lang/lua53/files/patch-src__lgc.c
  head/lang/lua53/files/patch-src__liolib.c
  head/lang/lua53/files/patch-src__lparser.c
Modified:
  head/lang/lua53/Makefile
  head/lang/lua53/distinfo
  head/lang/lua53/files/lua-5.3.pc.in
  head/lang/lua53/files/patch-src__Makefile

Modified: head/lang/lua53/Makefile
==============================================================================
--- head/lang/lua53/Makefile	Sat Aug 18 07:25:40 2018	(r477482)
+++ head/lang/lua53/Makefile	Sat Aug 18 07:41:00 2018	(r477483)
@@ -2,18 +2,16 @@
 # $FreeBSD$
 
 PORTNAME=	lua
-PORTVERSION=	5.3.4
-PORTREVISION=	2
+DISTVERSION=	5.3.5
 CATEGORIES=	lang
-MASTER_SITES=	http://www.lua.org/ftp/
+MASTER_SITES=	https://www.lua.org/ftp/
 PKGNAMESUFFIX=	53
 
 MAINTAINER=	russ.haley@gmail.com
-COMMENT=	Small, compilable scripting language providing easy access to C code
+COMMENT=	Powerful, efficient, lightweight, embeddable scripting language
 
 LICENSE=	MIT
 
-USES=		libedit
 LUA_VER=	5.3
 USE_LDCONFIG=	yes
 
@@ -24,57 +22,135 @@ USE_LDCONFIG=	yes
 # have its settings when we get here.
 # See http://wiki.freebsd.org/MatthiasAndree/LuaLessonsLearnt
 MAKE_ARGS=	__MAKE_CONF=${NONEXISTENT}
-# liblua.so requires libm, so make sure it has an explicit dependency
-# so that applications need not second-guess lua's dependencies.
-CPPFLAGS+=	-I${LOCALBASE}/include
-LDFLAGS+=	-lm -pthread
+
 BUILD_WRKSRC=	${WRKSRC}/src
-MAKE_ARGS+=	MYCFLAGS="${CFLAGS} ${CPPFLAGS} -DLUA_USE_LINUX" \
+
+# Source, destination, and filenames to copy for the DOCS option
+# (automatically added to pkg-plist if DOCS is set)
+# We override DOCSDIR to get a per-version subdir.
+# We put the docs for Lua proper in a lua/ subdir of the version subdir
+# so that ports for Lua modules can use the version subdir too without
+# making a mess.
+DOCSDIR=	${PREFIX}/share/doc/lua${PKGNAMESUFFIX}/lua
+PORTDOCS=	*
+BUILD_WRKDOC=	${WRKSRC}/doc
+
+LUA_PREFIX=	${PREFIX}
+
+# 2018-03-17: AG - These should match lua.mk, but we can't include that here
+LUA_CMD=	lua${PKGNAMESUFFIX}
+LUAC_CMD=	luac${PKGNAMESUFFIX}
+LUA_INCDIR=	${LUA_PREFIX}/include/lua${PKGNAMESUFFIX}
+LUA_LIBDIR=	${LUA_PREFIX}/lib
+
+LUA_LIB_STATIC=	liblua-${LUA_VER}.a
+LUA_LIB_SHARED=	liblua-${LUA_VER}.so
+LUA_PC_FILE=	lua-${LUA_VER}.pc
+
+# using the "bsd" target rather than "freebsd" saves patching out the
+# assumption of using base libedit in order to make it configurable. "bsd"
+# is "generic" plus the POSIX and DLOPEN options, plus -Wl,-E at link time;
+# it doesn't set CC either, which makes it easier for us to control that too.
+ALL_TARGET=bsd
+
+# Options
+
+OPTIONS_DEFAULT=LIBEDIT_DL DOCS
+
+OPTIONS_GROUP=	DOCSGRP DEBUGGRP
+OPTIONS_SINGLE=	EDITGRP
+
+OPTIONS_GROUP_DOCSGRP=	DOCS
+OPTIONS_GROUP_DEBUGGRP=	ASSERT APICHECK
+
+OPTIONS_SINGLE_EDITGRP=	EDITNONE LIBEDIT_DL LIBEDIT READLINE
+
+# Option descriptions
+
+DEBUGGRP_DESC=	Debugging options
+ASSERT_DESC=	Enable interpreter assertions
+APICHECK_DESC=	Enable API checks
+
+DOCSGRP_DESC=	Documentation options
+DOCS_DESC=	Install language and API reference (HTML, ~400kB)
+
+EDITGRP_DESC=	Interactive command-line editing
+EDITNONE_DESC=	No command-line editing
+LIBEDIT_DL_DESC=Use dynamically loaded libedit (recommended)
+LIBEDIT_DESC=	Use libedit (breaks lcurses)
+READLINE_DESC=	Use GNU Readline (breaks lcurses)
+
+# Option implementations
+
+ASSERT_EXTRA_PATCHES=	${PATCHDIR}/extra-patch-assert
+
+APICHECK_CPPFLAGS=	-DLUA_USE_APICHECK
+
+# EDITNONE currently requires no settings
+
+LIBEDIT_DL_USES=	libedit
+LIBEDIT_DL_CPPFLAGS=	-DLUA_USE_READLINE_DL
+
+LIBEDIT_USES=		libedit
+LIBEDIT_CPPFLAGS=	-DLUA_USE_READLINE
+LIBEDIT_LIBS=		-ledit
+
+READLINE_USES=		readline
+READLINE_CPPFLAGS=	-DLUA_USE_READLINE
+READLINE_LIBS=		-lreadline
+
+# end of option vars
+
+CFLAGS+=	-fPIC
+
+WITHOUT_NO_STRICT_ALIASING=yes
+
+MAKE_ARGS+=	CC="${CC}" \
+		MYCFLAGS="${CPPFLAGS} ${CFLAGS}" \
 		MYLDFLAGS="${LDFLAGS}" \
-		MYLIBS="-Wl,-E -L${LOCALBASE}/lib -ledit" \
-		CC="${CC}" \
-		LUA_T=lua53 \
-		LUAC_T=luac53 \
-		LUA_A=liblua-${LUA_VER}.a \
-		LUA_SO=liblua-${LUA_VER}.so \
-		LUA_SONAME=liblua-${LUA_VER}.so \
-		TO_BIN="lua53 luac53" \
-		TO_LIB="liblua-${LUA_VER}.a liblua-${LUA_VER}.so" \
+		MYLIBS="${LIBS}" \
+		LUA_T=${LUA_CMD} \
+		LUAC_T=${LUAC_CMD} \
+		LUA_A=${LUA_LIB_STATIC} \
+		LUA_SO=${LUA_LIB_SHARED} \
+		LUA_SONAME=${LUA_LIB_SHARED} \
+		TO_BIN="${LUA_CMD} ${LUAC_CMD}" \
+		TO_LIB="${LUA_LIB_SHARED} ${LUA_LIB_STATIC}" \
 		INSTALL_TOP=${STAGEDIR}${PREFIX} \
-		INSTALL_INC=${STAGEDIR}${PREFIX}/include/lua53 \
+		INSTALL_INC=${STAGEDIR}${LUA_INCDIR} \
 		INSTALL_EXEC="${INSTALL_PROGRAM}"
 
-# Cope with the lack of support for Lua 5.2 in bsd.lua.mk.  These
-# overrides, which are required below, should be removed once bsd.lua.mk
-# understands this lua version.
-LUA_PREFIX?=	${PREFIX}
-LUA_SUBDIR?=	lua${PKGNAMESUFFIX}
-LUA_INCDIR?=	${LUA_PREFIX}/include/${LUA_SUBDIR}
-LUA_LIBDIR?=	${LUA_PREFIX}/lib
-
-SUB_FILES=	lua-${LUA_VER}.pc
+SUB_FILES=	${LUA_PC_FILE}
 SUB_LIST=	version=${PORTVERSION} \
 		includedir=${LUA_INCDIR} \
 		libdir=${LUA_LIBDIR} \
 		soname=lua-${LUA_VER}
 
-CFLAGS+=	-fPIC
-
 post-patch:
-	@${REINPLACE_CMD} -e 's,rand *(,random(,g' \
-		${WRKSRC}/src/lmathlib.c
-	@${REINPLACE_CMD} -e "/LUA_ROOT/s|/usr/local|${LUA_PREFIX}| ; \
-		s,readline/,editline/,g ; \
-		/history\.h/d" \
-		${WRKSRC}/src/luaconf.h ${WRKSRC}/src/lua.c
+	@${REINPLACE_CMD} -e "/LUA_ROOT/s,/usr/local,${LUA_PREFIX}," \
+		${WRKSRC}/src/luaconf.h
 
+post-patch-LIBEDIT-on:
+	@${REINPLACE_CMD} -e "s,readline/,editline/,g ; \
+		/history\.h/d" ${WRKSRC}/src/lua.c
+
+post-patch-LIBEDIT_DL-on:
+	@${REINPLACE_CMD} \
+		-e "/^#def.*LUA_READLINE_LIBPATH/s,/usr/local,${LOCALBASE}," \
+		${WRKSRC}/src/lua.c
+
 post-install:
-	@${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/liblua-${LUA_VER}.so
-	@${MV} ${STAGEDIR}${PREFIX}/man/man1/lua.1 \
-		${STAGEDIR}${PREFIX}/man/man1/lua53.1
-	@${MV} ${STAGEDIR}${PREFIX}/man/man1/luac.1 \
-		${STAGEDIR}${PREFIX}/man/man1/luac53.1
-	${INSTALL_DATA} ${WRKDIR}/lua-${LUA_VER}.pc \
+	${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/${LUA_LIB_SHARED}
+	${MV} ${STAGEDIR}${PREFIX}/man/man1/lua.1 \
+		${STAGEDIR}${PREFIX}/man/man1/${LUA_CMD}.1
+	${MV} ${STAGEDIR}${PREFIX}/man/man1/luac.1 \
+		${STAGEDIR}${PREFIX}/man/man1/${LUAC_CMD}.1
+	${INSTALL_DATA} ${WRKDIR}/${LUA_PC_FILE} \
 		${STAGEDIR}${PREFIX}/libdata/pkgconfig
+
+post-install-DOCS-on:
+	${MKDIR} ${STAGEDIR}${DOCSDIR}
+	(cd ${BUILD_WRKDOC} && \
+		${COPYTREE_SHARE} . ${STAGEDIR}${DOCSDIR} '-not -name *\.1')
 
 .include <bsd.port.mk>

Modified: head/lang/lua53/distinfo
==============================================================================
--- head/lang/lua53/distinfo	Sat Aug 18 07:25:40 2018	(r477482)
+++ head/lang/lua53/distinfo	Sat Aug 18 07:41:00 2018	(r477483)
@@ -1,3 +1,3 @@
-TIMESTAMP = 1489025786
-SHA256 (lua-5.3.4.tar.gz) = f681aa518233bc407e23acf0f5887c884f17436f000d453b2491a9f11a52400c
-SIZE (lua-5.3.4.tar.gz) = 303586
+TIMESTAMP = 1531618645
+SHA256 (lua-5.3.5.tar.gz) = 0c2eed3f960446e1a3e4b9a1ca2f3ff893b6ce41942cf54d5dd59ab4b3b058ac
+SIZE (lua-5.3.5.tar.gz) = 303543

Added: head/lang/lua53/files/extra-patch-assert
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/lang/lua53/files/extra-patch-assert	Sat Aug 18 07:41:00 2018	(r477483)
@@ -0,0 +1,11 @@
+--- src/lprefix.h.orig	2018-07-14 23:49:59.792621000 +0100
++++ src/lprefix.h	2018-07-14 23:50:20.856546000 +0100
+@@ -7,6 +7,8 @@
+ #ifndef lprefix_h
+ #define lprefix_h
+ 
++#include <assert.h>
++#define lua_assert(c_) assert(c_)
+ 
+ /*
+ ** Allows POSIX/XSI stuff

Modified: head/lang/lua53/files/lua-5.3.pc.in
==============================================================================
--- head/lang/lua53/files/lua-5.3.pc.in	Sat Aug 18 07:25:40 2018	(r477482)
+++ head/lang/lua53/files/lua-5.3.pc.in	Sat Aug 18 07:41:00 2018	(r477483)
@@ -4,7 +4,7 @@ includedir=%%includedir%%
 soname=%%soname%%
 
 Name: Lua
-Description: An Extensible Extension Language
+Description: Powerful, efficient, lightweight, embeddable scripting language.
 Version: ${version}
 Libs: -L${libdir} -l${soname} -lm
 Cflags: -I${includedir}

Modified: head/lang/lua53/files/patch-src__Makefile
==============================================================================
--- head/lang/lua53/files/patch-src__Makefile	Sat Aug 18 07:25:40 2018	(r477482)
+++ head/lang/lua53/files/patch-src__Makefile	Sat Aug 18 07:41:00 2018	(r477483)
@@ -1,6 +1,6 @@
---- src/Makefile.orig	2015-01-05 16:04:52 UTC
+--- src/Makefile.orig	2018-06-25 17:46:36 UTC
 +++ src/Makefile
-@@ -6,12 +6,12 @@
+@@ -6,12 +6,13 @@
  # Your platform. See PLATS for possible values.
  PLAT= none
  
@@ -10,13 +10,14 @@
 +CFLAGS= -Wall -Wextra -DLUA_COMPAT_5_2 $(SYSCFLAGS) $(MYCFLAGS)
  LDFLAGS= $(SYSLDFLAGS) $(MYLDFLAGS)
  LIBS= -lm $(SYSLIBS) $(MYLIBS)
++SOLIBS= -lm
  
 -AR= ar rcu
 +AR= ar
  RANLIB= ranlib
  RM= rm -f
  
-@@ -19,8 +19,8 @@ SYSCFLAGS=
+@@ -19,8 +20,8 @@ SYSCFLAGS=
  SYSLDFLAGS=
  SYSLIBS=
  
@@ -27,7 +28,7 @@
  MYLIBS=
  MYOBJS=
  
-@@ -38,12 +38,13 @@ BASE_O= $(CORE_O) $(LIB_O) $(MYOBJS)
+@@ -38,12 +39,13 @@ BASE_O= $(CORE_O) $(LIB_O) $(MYOBJS)
  
  LUA_T=	lua
  LUA_O=	lua.o
@@ -42,12 +43,12 @@
  ALL_A= $(LUA_A)
  
  # Targets start here.
-@@ -55,8 +56,11 @@ o:	$(ALL_O)
+@@ -55,8 +57,11 @@ o:	$(ALL_O)
  
  a:	$(ALL_A)
  
 +$(LUA_SO):	$(CORE_O) $(LIB_O)
-+	$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(MYLDFLAGS) -shared -Wl,-soname=$(LUA_SONAME) $?
++	$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(MYLDFLAGS) -shared -Wl,-soname=$(LUA_SONAME) $? $(SOLIBS)
 +
  $(LUA_A): $(BASE_O)
 -	$(AR) $@ $(BASE_O)

Added: head/lang/lua53/files/patch-src_lua.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/lang/lua53/files/patch-src_lua.c	Sat Aug 18 07:41:00 2018	(r477483)
@@ -0,0 +1,78 @@
+--- src/lua.c.orig	2017-04-19 17:29:57 UTC
++++ src/lua.c
+@@ -77,16 +77,66 @@
+ */
+ #if !defined(lua_readline)	/* { */
+ 
+-#if defined(LUA_USE_READLINE)	/* { */
++#if defined(LUA_USE_READLINE_DL)/* { */
++
++#include <dlfcn.h>
++
++#ifndef LUA_READLINE_LIBPATH
++#define LUA_READLINE_LIBPATH "/usr/local/lib/libedit.so"
++#endif
++
++typedef char *readline_functype(const char *);
++typedef int add_history_functype(const char *);
++
++static readline_functype *lua_readline_p = NULL;
++static add_history_functype *lua_saveline_p = NULL;
++
++static void lua_initreadline(lua_State *L)
++{
++  void *editlib = NULL;
++  union dl_func_hack {
++    void *ptr;
++    readline_functype *rlfunc;
++    add_history_functype *ahfunc;
++    char **rlnamevar;
++    int *icompvar;
++  } u;
++  (void) L;
++  if ((editlib = dlopen(LUA_READLINE_LIBPATH, RTLD_LAZY | RTLD_LOCAL))) {
++    u.ptr = dlsym(editlib, "readline");
++    lua_readline_p = u.rlfunc;
++    u.ptr = dlsym(editlib, "add_history");
++    lua_saveline_p = u.ahfunc;
++    if ((u.ptr = dlsym(editlib, "rl_readline_name")))
++      *u.rlnamevar = "lua";
++    if ((u.ptr = dlsym(editlib, "rl_inhibit_completion")))
++      *u.icompvar = 1;
++  }
++}
++
++#define lua_readline(L,b,p) \
++  ((void)L,                                                          \
++   (lua_readline_p)                                                  \
++   ? (((b)=lua_readline_p(p)) != NULL)                               \
++   : (fputs(p, stdout), fflush(stdout), fgets(b, LUA_MAXINPUT, stdin) != NULL))
++#define lua_saveline(L,line)	\
++  do { (void)L; if (lua_saveline_p) lua_saveline_p(line); } while(0)
++#define lua_freeline(L,b)	\
++  do { (void)L; if (lua_readline_p) free(b); } while(0)
++
++#elif defined(LUA_USE_READLINE)	/* { */
+ 
+ #include <readline/readline.h>
+ #include <readline/history.h>
++#define lua_initreadline(L)  \
++	((void)L, rl_readline_name="lua", rl_inhibit_completion=1)
+ #define lua_readline(L,b,p)	((void)L, ((b)=readline(p)) != NULL)
+ #define lua_saveline(L,line)	((void)L, add_history(line))
+ #define lua_freeline(L,b)	((void)L, free(b))
+ 
+ #else				/* }{ */
+ 
++#define lua_initreadline(L)	((void) L)
+ #define lua_readline(L,b,p) \
+         ((void)L, fputs(p, stdout), fflush(stdout),  /* show prompt */ \
+         fgets(b, LUA_MAXINPUT, stdin) != NULL)  /* get line */
+@@ -406,6 +456,7 @@ static void doREPL (lua_State *L) {
+   int status;
+   const char *oldprogname = progname;
+   progname = NULL;  /* no 'progname' on errors in interactive mode */
++  lua_initreadline(L);
+   while ((status = loadline(L)) != -1) {
+     if (status == LUA_OK)
+       status = docall(L, 0, LUA_MULTRET);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201808180741.w7I7f1pt093184>