tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: builtin.mk for lua [take 2]



On Tue, Oct 29, 2013 at 02:52:04AM +0100, Alistair Crooks wrote:
> We're missing a builtin.mk for lua. I'll attach a provisional one
> to this mail.
> 
> It gets me far enough to be able to get the following out of building
> monotone.
> 
> [18:50:13] agc@netbsd-vm3 ...pkgsrc/devel/monotone [3919] > make show-var VARNAME=USE_BUILTIN.lua
> yes
> [18:50:23] agc@netbsd-vm3 ...pkgsrc/devel/monotone [3920] > make show-var VARNAME=BUILTIN_VERSION.lua
> 5.1
> [18:50:33] agc@netbsd-vm3 ...pkgsrc/devel/monotone [3921] >
> 
> All comments gratefully received.
> 
> Best,
> Alistair

No feedback on the above, so I've brought the lua builtin.mk up to
date, and attached it to this mail.

Also, there's a diff for the lua buildlink3.mk file.

	[19:01:27] agc@netbsd-002 ...pkgsrc/lang/lua [10582] > cvsdiff .
	? builtin.mk
	cvs diff: Diffing .
	Index: buildlink3.mk
	===================================================================
	RCS file: /cvsroot/pkgsrc/lang/lua/buildlink3.mk,v
	retrieving revision 1.17
	diff -u -r1.17 buildlink3.mk
	--- buildlink3.mk       30 Oct 2013 06:18:09 -0000      1.17
	+++ buildlink3.mk       30 Dec 2014 03:04:25 -0000
	@@ -6,6 +6,7 @@
	 # It is intended to be included by packages that embed the Lua
	 # interpreter and therefore link against Lua.

	+.include "../../lang/lua/builtin.mk"
	 .include "../../lang/lua/luaversion.mk"
	 .include "${LUA_PKGSRCDIR}/buildlink3.mk"

	[19:04:25] agc@netbsd-002 ...pkgsrc/lang/lua [10583] >

Again, it lets me do the following in devel/monotone (on NetBSD-7.99.3):

	[19:00:17] agc@netbsd-002 ...pkgsrc/devel/monotone [10576] > make show-var VARNAME=USE_BUILTIN.lua
	yes
	[19:00:22] agc@netbsd-002 ...pkgsrc/devel/monotone [10577] > make show-var VARNAME=BUILTIN_VERSION.lua
	5.3
	[19:00:33] agc@netbsd-002 ...pkgsrc/devel/monotone [10578] >

Any objections?

Thanks,
Alistair
# $NetBSD$

BUILTIN_PKG:=	lua

BUILTIN_FIND_FILES_VAR:=	lua_h
BUILTIN_FIND_FILES.lua_h=	/usr/include/lua.h \
				/usr/include/lualib.h \

.include "../../mk/buildlink3/bsd.builtin.mk"

###
### Determine if there is a built-in implementation of the package and
### set IS_BUILTIN.<pkg> appropriately ("yes" or "no").
###
.if !defined(IS_BUILTIN.lua)
IS_BUILTIN.lua=	no
.  if empty(lua_h:M__nonexistent__) && empty(lua_h:M${LOCALBASE}/*)
IS_BUILTIN.lua=	yes
.  endif
.endif
MAKEVARS+=	IS_BUILTIN.lua

###
### If there is a built-in implementation, then set BUILTIN_PKG.<pkg> to
### a package name to represent the built-in package.
###
.if !defined(BUILTIN_PKG.lua) && \
    !empty(IS_BUILTIN.lua:M[yY][eE][sS]) && \
    empty(lua_h:M__nonexistent__)
BUILTIN_VERSION.lua!=							\
	${AWK} '/\#define[ 	]*LUA_VERSION_NUM/ {			\
			vers = $$3;					\
			gsub("0", ".", vers);				\
			print vers;					\
		}							\
	' ${lua_h:Q}
.endif

###
### Determine whether we should use the built-in implementation if it
### exists, and set USE_BUILTIN.<pkg> appropriate ("yes" or "no").
###
CHECK_BUILTIN.lua?=	no
.if !empty(CHECK_BUILTIN.lua:M[nN][oO])
.  if !defined(USE_BUILTIN.lua)
.    if ${PREFER.lua} == "pkgsrc"
USE_BUILTIN.lua=	no
.    else
USE_BUILTIN.lua=	${IS_BUILTIN.lua}
.      if defined(BUILTIN_PKG.lua) && \
        !empty(IS_BUILTIN.lua:M[yY][eE][sS])
USE_BUILTIN.lua=	yes
.        for _dep_ in ${BUILDLINK_API_DEPENDS.lua}
.          if !empty(USE_BUILTIN.lua:M[yY][eE][sS])
USE_BUILTIN.lua!=	\
	if ${PKG_ADMIN} pmatch ${_dep_:Q} ${BUILTIN_PKG.lua:Q}; then	\
		${ECHO} yes;						\
	else								\
		${ECHO} no;						\
	fi
.          endif
.        endfor
.      endif
.    endif  # PREFER.lua
.  endif
.endif
MAKEVARS+=	USE_BUILTIN.lua

# If USE_LUA is defined, then force the use of a true lua
# package.
#
.if defined(USE_LUA)
.  if !empty(IS_BUILTIN.lua:M[nN][oO])
USE_BUILTIN.lua=	no
.  endif
.endif


Home | Main Index | Thread Index | Old Index