Annotation of pkgsrc/lang/lua/luaversion.mk, revision 1.6
1.6 ! obache 1: # $NetBSD: luaversion.mk,v 1.5 2014/05/03 13:00:44 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: #
11: # Possible values: 51 52
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: #
30: # Possible values: 51 52
31: # Default: 52 51
32: #
33: # LUA_VERSIONS_INCOMPATIBLE
34: # The Lua versions that the package *cannot* build against.
35: #
36: # Possible values: 51 52
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:
1.6 ! obache 67: # derive a Lua version from the package name if possible
! 68: # optionally handled quoted package names
! 69: .if defined(PKGNAME_REQD) && !empty(PKGNAME_REQD:Mlua[0-9][0-9]-*) || \
! 70: defined(PKGNAME_REQD) && !empty(PKGNAME_REQD:M*-lua[0-9][0-9]-*)
! 71: LUA_VERSION_REQD?= ${PKGNAME_REQD:C/(^.*-|^)lua([0-9][0-9])-.*/\2/}
! 72: .elif defined(PKGNAME_OLD) && !empty(PKGNAME_OLD:Mlua[0-9][0-9]-*) || \
! 73: defined(PKGNAME_OLD) && !empty(PKGNAME_OLD:M*-lua[0-9][0-9]-*)
! 74: LUA_VERSION_REQD?= ${PKGNAME_OLD:C/(^.*-|^)lua([0-9][0-9])-.*/\2/}
! 75: .endif
! 76:
1.1 dholland 77: .include "../../mk/bsd.prefs.mk"
78:
79: BUILD_DEFS+= LUA_VERSION_DEFAULT
1.3 obache 80: BUILD_DEFS_EFFECTS+= LUA_PACKAGE
1.1 dholland 81:
82: LUA_VERSION_DEFAULT?= 52
83: LUA_VERSIONS_ACCEPTED?= 52 51
84: LUA_VERSIONS_INCOMPATIBLE?=# empty
85:
86: #
87: # Resolve LUA_VERSIONS_INCOMPATBLE and generate the _OK vars.
88: #
89: .for v in ${LUA_VERSIONS_ACCEPTED}
90: .if empty(LUA_VERSIONS_INCOMPATIBLE:M${v})
91: _LUA_VERSION_${v}_OK= yes
92: _LUA_VERSIONS_ACCEPTED+= ${v}
93: .endif
94: .endfor
95:
96: # Pick a version
97: .if defined(LUA_VERSION_REQD)
98: . if defined(_LUA_VERSION_${LUA_VERSION_REQD}_OK)
99: _LUA_VERSION= ${LUA_VERSION_REQD}
100: . endif
101: .else
102: . if defined(_LUA_VERSION_${LUA_VERSION_DEFAULT}_OK)
103: _LUA_VERSION?= ${LUA_VERSION_DEFAULT}
104: . endif
105: . for v in ${_LUA_VERSIONS_ACCEPTED}
106: . if defined(_LUA_VERSION_${v}_OK)
107: _LUA_VERSION?= ${v}
108: . endif
109: . endfor
110: .endif
111:
112: #
113: # Enable multiversion builds.
114: #
115: MULTI+= LUA_VERSION_REQD=${_LUA_VERSION}
116:
117: # In case nothing matched
118: _LUA_VERSION?= none
119:
120: #
121: # Handle self-conflicts
122: #
1.2 obache 123: .if defined(LUA_SELF_CONFLICT) && !empty(LUA_SELF_CONFLICT:M[Yy][Ee][Ss])
1.1 dholland 124: .for v in ${_LUA_VERSIONS_ACCEPTED:N${_LUA_VERSION}}
125: CONFLICTS+= ${PKGNAME:S/lua${_LUA_VERSION}/lua${v}/:C/-[0-9].*$/-[0-9]*/}
126: .endfor
127: .endif
128:
129: .if ${_LUA_VERSION} == "52"
130: LUA_PACKAGE= lua52
131: LUA_PKGSRCDIR= ../../lang/lua52
132: LUA_PKGPREFIX= lua52
1.4 obache 133: LUA_BASEDEPENDS= lua52>=5.2<5.3:${LUA_PKGSRCDIR}
1.1 dholland 134:
135: .elif ${_LUA_VERSION} == "51"
136: LUA_PACKAGE= lua51
137: LUA_PKGSRCDIR= ../../lang/lua51
138: LUA_PKGPREFIX= lua51
139: LUA_BASEDEPENDS= lua51>=5.1<5.2:${LUA_PKGSRCDIR}
140:
141: .else
142: PKG_FAIL_REASION+= "No valid Lua version found"
143:
144: .endif
145:
146: #LUA_DEPENDS= ${BUILDLINK_API_DEPENDS.${LUA_PACKAGE}}:${LUA_PKGSRCDIR}
147:
148: .include "${LUA_PKGSRCDIR}/version.mk"
149: _LUA_DOT_VERSION= ${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}
150:
1.5 alnsn 151: LUA_INCDIR= include/lua-${_LUA_DOT_VERSION}
152: LUA_INTERPRETER= ${LOCALBASE}/bin/lua${_LUA_DOT_VERSION}
153: LUA_COMPILER= ${LOCALBASE}/bin/luac${_LUA_DOT_VERSION}
154:
1.1 dholland 155: .endif # LUA_LUAVERSION_MK
CVSweb <webmaster@jp.NetBSD.org>