Annotation of pkgsrc/lang/lua/luaversion.mk, revision 1.8

1.8     ! obache      1: # $NetBSD: luaversion.mk,v 1.7 2015/01/17 17:54:59 alnsn Exp $
1.1       dholland    2: 
                      3: # This file determins which Lua version is used as a dependency for
                      4: # a package.
                      5: #
                      6: # === User-settable variables ===
                      7: #
                      8: # LUA_VERSION_DEFAULT
                      9: #      The preferred lua version to use.
                     10: #
1.7       alnsn      11: #      Possible values: 51 52 53
1.1       dholland   12: #      Default: 52
                     13: #
                     14: # === Infrastructure variables ===
                     15: #
                     16: # LUA_VERSION_REQD
                     17: #      Lua version to use. This variable should not be set by
                     18: #      packages; it is ordinarily set by multiversion builds.
                     19: #
                     20: #      Possible values: ${LUA_VERSIONS_ACCEPTED}
                     21: #      Default: ${LUA_VERSION_DEFAULT}
                     22: #
                     23: # === Package-settable variables ===
                     24: #
                     25: # LUA_VERSIONS_ACCEPTED
                     26: #      The Lua versions that the package can build against. Order
                     27: #      is significant; those listed earlier are preferred over those
                     28: #      listed later.
                     29: #
1.7       alnsn      30: #      Possible values: 51 52 53
                     31: #      Default: 52 53 51
1.1       dholland   32: #
                     33: # LUA_VERSIONS_INCOMPATIBLE
                     34: #      The Lua versions that the package *cannot* build against.
                     35: #
1.7       alnsn      36: #      Possible values: 51 52 53
1.1       dholland   37: #      Default: <empty>
                     38: #
                     39: # LUA_SELF_CONFLICT
                     40: #      If set to "yes", CONFLICTS entries are added among the various
                     41: #      per-Lua-version variants of a multiversion package.
                     42: #
                     43: # === Defined variables ===
                     44: #
                     45: # LUA_PKGPREFIX
                     46: #      The prefix to use in PKGNAME for multiversion packages.
                     47: #
                     48: #      Example: lua51
                     49: #
1.5       alnsn      50: # LUA_INCDIR
                     51: #      Relative path to include files.
                     52: #
                     53: #      Example: include/lua-51
                     54: #
                     55: # LUA_INTERPRETER
                     56: #      Full path to Lua interpreter.
                     57: #
                     58: # LUA_COMPILER
                     59: #      Full path to Lua bytecode compiler (luac).
                     60: #
1.1       dholland   61: # Keywords: Lua
                     62: #
                     63: 
                     64: .if !defined (LUA_LUAVERSION_MK)
                     65: LUA_LUAVERSION_MK=     # defined
                     66: 
                     67: .include "../../mk/bsd.prefs.mk"
                     68: 
                     69: BUILD_DEFS+=           LUA_VERSION_DEFAULT
1.3       obache     70: BUILD_DEFS_EFFECTS+=   LUA_PACKAGE
1.1       dholland   71: 
                     72: LUA_VERSION_DEFAULT?=  52
1.7       alnsn      73: LUA_VERSIONS_ACCEPTED?=        52 53 51
1.1       dholland   74: LUA_VERSIONS_INCOMPATIBLE?=# empty
                     75: 
                     76: #
                     77: # Resolve LUA_VERSIONS_INCOMPATBLE and generate the _OK vars.
                     78: #
                     79: .for v in ${LUA_VERSIONS_ACCEPTED}
                     80: .if empty(LUA_VERSIONS_INCOMPATIBLE:M${v})
                     81: _LUA_VERSION_${v}_OK=          yes
                     82: _LUA_VERSIONS_ACCEPTED+=       ${v}
                     83: .endif
                     84: .endfor
                     85: 
                     86: # Pick a version
                     87: .if defined(LUA_VERSION_REQD)
                     88: .  if defined(_LUA_VERSION_${LUA_VERSION_REQD}_OK)
                     89: _LUA_VERSION=          ${LUA_VERSION_REQD}
                     90: .  endif
                     91: .else
                     92: .  if defined(_LUA_VERSION_${LUA_VERSION_DEFAULT}_OK)
                     93: _LUA_VERSION?=         ${LUA_VERSION_DEFAULT}
                     94: .  endif
                     95: .  for v in ${_LUA_VERSIONS_ACCEPTED}
                     96: .    if defined(_LUA_VERSION_${v}_OK)
                     97: _LUA_VERSION?=         ${v}
                     98: .    endif
                     99: .  endfor
                    100: .endif
                    101: 
                    102: #
                    103: # Enable multiversion builds.
                    104: #
                    105: MULTI+=        LUA_VERSION_REQD=${_LUA_VERSION}
                    106: 
                    107: # In case nothing matched
                    108: _LUA_VERSION?=         none
                    109: 
                    110: #
                    111: # Handle self-conflicts
                    112: #
1.2       obache    113: .if defined(LUA_SELF_CONFLICT) && !empty(LUA_SELF_CONFLICT:M[Yy][Ee][Ss])
1.1       dholland  114: .for v in ${_LUA_VERSIONS_ACCEPTED:N${_LUA_VERSION}}
                    115: CONFLICTS+=    ${PKGNAME:S/lua${_LUA_VERSION}/lua${v}/:C/-[0-9].*$/-[0-9]*/}
                    116: .endfor
                    117: .endif
                    118: 
                    119: .if ${_LUA_VERSION} == "52"
                    120: LUA_PACKAGE=           lua52
                    121: LUA_PKGSRCDIR=         ../../lang/lua52
                    122: LUA_PKGPREFIX=         lua52
1.4       obache    123: LUA_BASEDEPENDS=       lua52>=5.2<5.3:${LUA_PKGSRCDIR}
1.1       dholland  124: 
1.7       alnsn     125: .elif ${_LUA_VERSION} == "53"
                    126: LUA_PACKAGE=           lua53
                    127: LUA_PKGSRCDIR=         ../../lang/lua53
                    128: LUA_PKGPREFIX=         lua53
                    129: LUA_BASEDEPENDS=       lua53>=5.3<5.4:${LUA_PKGSRCDIR}
                    130: 
1.1       dholland  131: .elif ${_LUA_VERSION} == "51"
                    132: LUA_PACKAGE=           lua51
                    133: LUA_PKGSRCDIR=         ../../lang/lua51
                    134: LUA_PKGPREFIX=         lua51
                    135: LUA_BASEDEPENDS=       lua51>=5.1<5.2:${LUA_PKGSRCDIR}
                    136: 
                    137: .else
                    138: PKG_FAIL_REASION+=     "No valid Lua version found"
                    139: 
                    140: .endif
                    141: 
                    142: #LUA_DEPENDS=  ${BUILDLINK_API_DEPENDS.${LUA_PACKAGE}}:${LUA_PKGSRCDIR}
                    143: 
                    144: .include "${LUA_PKGSRCDIR}/version.mk"
                    145: _LUA_DOT_VERSION=      ${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}
                    146: 
1.5       alnsn     147: LUA_INCDIR=            include/lua-${_LUA_DOT_VERSION}
                    148: LUA_INTERPRETER=       ${LOCALBASE}/bin/lua${_LUA_DOT_VERSION}
                    149: LUA_COMPILER=          ${LOCALBASE}/bin/luac${_LUA_DOT_VERSION}
                    150: 
1.1       dholland  151: .endif  # LUA_LUAVERSION_MK

CVSweb <webmaster@jp.NetBSD.org>