tech-pkg archive

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

builtin.mk for lua



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
# $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