From 3f4b1bd0ccf7973dd7495c5947873b93ab34e820 Mon Sep 17 00:00:00 2001 From: Shay Agroskin Date: Tue, 13 Apr 2021 23:49:50 +0300 Subject: [PATCH 1/4] Fail awesome compilation for Lua5.4 or newer (#3324) Awesome doesn't support these versions. Preventing the project from compiling with it saves the users some very frustrating and hard to debug bugs. The cmake version check is redundant with the version check in luaa.h. Nevertheless, adding it allows to fail the project build sooner and provides better user experience. Fixes: #3324 Signed-off-by: Shay Agroskin --- awesomeConfig.cmake | 7 +++++++ luaa.h | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/awesomeConfig.cmake b/awesomeConfig.cmake index 34353729a..bec390612 100644 --- a/awesomeConfig.cmake +++ b/awesomeConfig.cmake @@ -71,6 +71,13 @@ if (NOT LUA_FOUND) "You might want to hint it using the LUA_DIR environment variable, " "or set the LUA_INCLUDE_DIR / LUA_LIBRARY CMake variables.") endif() + +set(LUA_FULL_VERSION "${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}.${LUA_VERSION_PATCH}") +if(LUA_FULL_VERSION VERSION_EQUAL 5.4.0 OR LUA_FULL_VERSION VERSION_GREATER 5.4.0 ) + message(FATAL_ERROR "Awesome doesn't support Lua versions newer than 5.3, please refer to" + "https://awesomewm.org/apidoc/documentation/10-building-and-testing.md.html#Building") +endif() + # }}} # {{{ Check if documentation can be build diff --git a/luaa.h b/luaa.h index d26c43769..c58ec9b80 100644 --- a/luaa.h +++ b/luaa.h @@ -31,6 +31,10 @@ #include "common/lualib.h" #include "common/luaclass.h" +#if LUA_VERSION_NUM > 503 +print("Awesome doesn't support Lua versions newer than 5.3, please refer to https://awesomewm.org/apidoc/documentation/10-building-and-testing.md.html#Building") +#endif + #define luaA_deprecate(L, repl) \ do { \ luaA_warn(L, "%s: This function is deprecated and will be removed, see %s", \ From 1916677df14e50430f91b4fae9b792fdbb198c53 Mon Sep 17 00:00:00 2001 From: Shay Agroskin Date: Wed, 21 Apr 2021 09:00:28 +0300 Subject: [PATCH 2/4] List what Lua versions supported instead of which aren't When skimming over the source code, it might be easier for coders to see what lua versions are supported, instead aren't. This doesn't have any functional impact Signed-off-by: Shay Agroskin --- awesomeConfig.cmake | 5 +++-- luaa.h | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/awesomeConfig.cmake b/awesomeConfig.cmake index bec390612..cc6c80ffb 100644 --- a/awesomeConfig.cmake +++ b/awesomeConfig.cmake @@ -73,8 +73,9 @@ if (NOT LUA_FOUND) endif() set(LUA_FULL_VERSION "${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}.${LUA_VERSION_PATCH}") -if(LUA_FULL_VERSION VERSION_EQUAL 5.4.0 OR LUA_FULL_VERSION VERSION_GREATER 5.4.0 ) - message(FATAL_ERROR "Awesome doesn't support Lua versions newer than 5.3, please refer to" +# 5.1 <= LUA_VERSION < 5.4 +if(NOT ((LUA_FULL_VERSION VERSION_EQUAL 5.1.0 OR LUA_FULL_VERSION VERSION_GREATER 5.1.0) AND LUA_FULL_VERSION VERSION_LESS 5.4.0)) + message(FATAL_ERROR "Awesome only supports Lua versions 5.1-5.3, please refer to" "https://awesomewm.org/apidoc/documentation/10-building-and-testing.md.html#Building") endif() diff --git a/luaa.h b/luaa.h index c58ec9b80..2b765c758 100644 --- a/luaa.h +++ b/luaa.h @@ -31,8 +31,8 @@ #include "common/lualib.h" #include "common/luaclass.h" -#if LUA_VERSION_NUM > 503 -print("Awesome doesn't support Lua versions newer than 5.3, please refer to https://awesomewm.org/apidoc/documentation/10-building-and-testing.md.html#Building") +#if !(501 <= LUA_VERSION_NUM && LUA_VERSION_NUM < 504) +print("Awesome only supports Lua versions 5.1-5.3, please refer to, please refer to https://awesomewm.org/apidoc/documentation/10-building-and-testing.md.html#Building") #endif #define luaA_deprecate(L, repl) \ From ba923cb80dfebc47382c4e11b9f20eb4d37e95df Mon Sep 17 00:00:00 2001 From: ShayAgros <37025016+ShayAgros@users.noreply.github.com> Date: Wed, 21 Apr 2021 10:49:44 +0300 Subject: [PATCH 3/4] Remove word duplication Co-authored-by: Lucas Schwiderski <4508454+sclu1034@users.noreply.github.com> --- luaa.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/luaa.h b/luaa.h index 2b765c758..07670acf2 100644 --- a/luaa.h +++ b/luaa.h @@ -32,7 +32,7 @@ #include "common/luaclass.h" #if !(501 <= LUA_VERSION_NUM && LUA_VERSION_NUM < 504) -print("Awesome only supports Lua versions 5.1-5.3, please refer to, please refer to https://awesomewm.org/apidoc/documentation/10-building-and-testing.md.html#Building") +print("Awesome only supports Lua versions 5.1-5.3, please refer to https://awesomewm.org/apidoc/documentation/10-building-and-testing.md.html#Building") #endif #define luaA_deprecate(L, repl) \ From 47fd7797b497ee7556328162e6a2f06967e0b506 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Lepage=20Vall=C3=A9e?= Date: Wed, 21 Apr 2021 22:52:35 -0700 Subject: [PATCH 4/4] Update luaa.h Co-authored-by: ShayAgros <37025016+ShayAgros@users.noreply.github.com> --- luaa.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/luaa.h b/luaa.h index 07670acf2..fae072702 100644 --- a/luaa.h +++ b/luaa.h @@ -32,7 +32,7 @@ #include "common/luaclass.h" #if !(501 <= LUA_VERSION_NUM && LUA_VERSION_NUM < 504) -print("Awesome only supports Lua versions 5.1-5.3, please refer to https://awesomewm.org/apidoc/documentation/10-building-and-testing.md.html#Building") +#error "Awesome only supports Lua versions 5.1-5.3 and LuaJIT2, please refer to https://awesomewm.org/apidoc/documentation/10-building-and-testing.md.html#Building" #endif #define luaA_deprecate(L, repl) \