aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorantoine <antoine@FreeBSD.org>2018-07-17 20:00:46 +0800
committerantoine <antoine@FreeBSD.org>2018-07-17 20:00:46 +0800
commitbea0704de2522c13ec19ab2840e0491dbb1e99ac (patch)
tree338dd2678840bc75caf874edacca01c10ca336fb
parentc456258ee4e22ed702f7995b8221fe4b8dd6c2b9 (diff)
downloadfreebsd-ports-gnome-bea0704de2522c13ec19ab2840e0491dbb1e99ac.tar.gz
freebsd-ports-gnome-bea0704de2522c13ec19ab2840e0491dbb1e99ac.tar.zst
freebsd-ports-gnome-bea0704de2522c13ec19ab2840e0491dbb1e99ac.zip
Fix logic in lua version selection
Reviewed by: bapt, mat Differential Revision: https://reviews.freebsd.org/D16275
-rw-r--r--Mk/Uses/lua.mk36
1 files changed, 19 insertions, 17 deletions
diff --git a/Mk/Uses/lua.mk b/Mk/Uses/lua.mk
index 98f3647dd1f9..63dd88966ea3 100644
--- a/Mk/Uses/lua.mk
+++ b/Mk/Uses/lua.mk
@@ -24,7 +24,15 @@ IGNORE= Invalid lua version ${LUA_DEFAULT}
#
.if ${lua_ARGS:M*+}
_LUA_MIN_VERSION:= ${lua_ARGS:M*+:S/+//}
-_LUA_WANTED_VERSION:= ${_LUA_DEFAULT_VERSION}
+#
+# Resolve minimum versions (ver+). Append anything greater or equal than the
+# specified minimum version to the list of wanted versions.
+#
+. for _v in ${_LUA_VALID_VERSIONS}
+. if ${_LUA_MIN_VERSION} <= ${_v}
+_LUA_WANTED_VERSIONS+=${_v}
+. endif
+. endfor
.endif
#
@@ -43,18 +51,6 @@ _LUA_WANTED_VERSIONS= ${_LUA_DEFAULT_VERSION}
.endif
#
-# Resolve minimum versions (ver+). Append anything greater or equal than the
-# specified minimum version to the list of wanted versions.
-#
-.if defined(_LUA_MIN_VERSION)
-. for _v in ${_LUA_VALID_VERSIONS}
-. if ${_LUA_MIN_VERSION} <= ${_v}
-_LUA_WANTED_VERSIONS+=${_v}
-. endif
-. endfor
-.endif
-
-#
# Right now we have built a list of potential versions that we may depend on.
# Let's sort them and remove any duplicates. We then locate the highest one
# already installed, if any.
@@ -62,14 +58,20 @@ _LUA_WANTED_VERSIONS+=${_v}
.for _v in ${_LUA_WANTED_VERSIONS:O:u}
_LUA_HIGHEST_VERSION:=${_v}
. if exists(${LOCALBASE}/bin/lua${_v})
-_LUA_WANTED_VERSION:= ${_v}
+_LUA_HIGHEST_INSTALLED_VERSION:= ${_v}
. endif
.endfor
#
-# If we couldn't find any wanted version installed, depend on the highest one.
-.if !defined(_LUA_WANTED_VERSION)
-_LUA_WANTED_VERSION:= ${_LUA_HIGHEST_VERSION}
+# Depend on the default version if it fits, or the highest installed version,
+# or the highest version.
+#
+.if ${_LUA_WANTED_VERSIONS:M${_LUA_DEFAULT_VERSION}}
+_LUA_WANTED_VERSION:= ${_LUA_DEFAULT_VERSION}
+.elif defined(_LUA_HIGHEST_INSTALLED_VERSION)
+_LUA_WANTED_VERSION:= ${_LUA_HIGHEST_INSTALLED_VERSION}
+.else
+_LUA_WANTED_VERSION:= ${_LUA_HIGHEST_VERSION}
.endif
#