diff --git a/vim-lua-ftbfs.patch b/vim-lua-ftbfs.patch
index b4bbb67..22769ff 100644
--- a/vim-lua-ftbfs.patch
+++ b/vim-lua-ftbfs.patch
@@ -1,8 +1,48 @@
+From ea3ebd50e2a4ec26ee503f352a1280e11e4af93b Mon Sep 17 00:00:00 2001
+From: Zdenek Dohnal <zdohnal@redhat.com>
+Date: Tue, 14 Jul 2020 12:14:03 +0200
+Subject: [PATCH] if_lua.c: new Lua 5.4.0 defines luaL_typeerror, so don't
+ define it twice
+
+---
+ src/if_lua.c | 11 ++++++++++-
+ 1 file changed, 10 insertions(+), 1 deletion(-)
+
 diff --git a/src/if_lua.c b/src/if_lua.c
-index 9852c61..21141d8 100644
+index 9852c618e..f25c47b53 100644
 --- a/src/if_lua.c
 +++ b/src/if_lua.c
-@@ -457,7 +457,7 @@ lua_enabled(int verbose)
+@@ -120,6 +120,9 @@ static void luaV_call_lua_func_free(void *state);
+ #define luaL_loadbufferx dll_luaL_loadbufferx
+ #define luaL_argerror dll_luaL_argerror
+ #endif
++#if LUA_VERSION_NUM >= 504
++#define luaL_typeerror dll_luaL_typeerror
++#endif
+ #define luaL_checkany dll_luaL_checkany
+ #define luaL_checklstring dll_luaL_checklstring
+ #define luaL_checkinteger dll_luaL_checkinteger
+@@ -217,6 +220,9 @@ int (*dll_luaL_loadfilex) (lua_State *L, const char *filename, const char *mode)
+ int (*dll_luaL_loadbufferx) (lua_State *L, const char *buff, size_t sz, const char *name, const char *mode);
+ int (*dll_luaL_argerror) (lua_State *L, int numarg, const char *extramsg);
+ #endif
++#if LUA_VERSION_NUM >= 504
++int (*dll_luaL_typeerror) (lua_State *L, int narg, const char *tname);
++#endif
+ void (*dll_luaL_checkany) (lua_State *L, int narg);
+ const char *(*dll_luaL_checklstring) (lua_State *L, int numArg, size_t *l);
+ lua_Integer (*dll_luaL_checkinteger) (lua_State *L, int numArg);
+@@ -335,6 +341,9 @@ static const luaV_Reg luaV_dll[] = {
+     {"luaL_loadfilex", (luaV_function) &dll_luaL_loadfilex},
+     {"luaL_loadbufferx", (luaV_function) &dll_luaL_loadbufferx},
+     {"luaL_argerror", (luaV_function) &dll_luaL_argerror},
++#endif
++#if LUA_VERSION_NUM >= 504
++    {"luaL_typeerror", (luaV_function) &dll_luaL_typeerror},
+ #endif
+     {"luaL_checkany", (luaV_function) &dll_luaL_checkany},
+     {"luaL_checklstring", (luaV_function) &dll_luaL_checklstring},
+@@ -457,7 +466,7 @@ lua_enabled(int verbose)
  }
  #endif
  
@@ -11,3 +51,6 @@ index 9852c61..21141d8 100644
      static int
  luaL_typeerror(lua_State *L, int narg, const char *tname)
  {
+-- 
+2.25.4
+
diff --git a/vim.spec b/vim.spec
index 63e34fc..149f298 100644
--- a/vim.spec
+++ b/vim.spec
@@ -299,8 +299,6 @@ make clean
 mv -f os_unix.h.save os_unix.h
 mv -f ex_cmds.c.save ex_cmds.c
 
-# since Lua 5.4.0, we need to add lua linker flag
-export LDFLAGS="%{build_ldflags} -llua"
 # python introduced incompatible change in getting linker flags for compiling programs
 # which use C python API. Remove %%if after F31 going EOL and leave the single export here.
 # This LDFLAGS settings needs to be before vim+gvim configuration and after vi configuration
@@ -309,9 +307,9 @@ export LDFLAGS="%{build_ldflags} -llua"
 # because we already defined LDFLAGS above when Lua linker flag was added. If the manual
 # Lua linker flag adding goes away, use %%{build_ldflags} in the concatenation instead of LDFLAGS
 %if 0%{?fedora} > 31 || 0%{?rhel} > 8
-export LDFLAGS="$LDFLAGS $(python3-config --libs --embed)"
+export LDFLAGS="%{build_ldflags} $(python3-config --libs --embed)"
 %else
-export LDFLAGS="$LDFLAGS $(python3-config --libs)"
+export LDFLAGS="%{build_ldflags} $(python3-config --libs)"
 %endif
 
 # More configure options:
@@ -792,6 +790,9 @@ touch %{buildroot}/%{_datadir}/%{name}/vimfiles/doc/tags
 
 %changelog
 * Mon Jul 13 2020 Zdenek Dohnal <zdohnal@redhat.com> - 2:8.2.1199-1
+- FTBFS with Lua - backported patch from upstream pull request to prevent linking with lua
+
+* Mon Jul 13 2020 Zdenek Dohnal <zdohnal@redhat.com> - 2:8.2.1199-1
 - patchlevel 1199
 
 * Mon Jun 29 2020 Zdenek Dohnal <zdohnal@redhat.com> - 2:8.2.1081-1