Blame SOURCES/luarocks-3.5.0-dynamic_libdir.patch

7aff38
From aed621d5db1d521404238a92f16b879180a469a2 Mon Sep 17 00:00:00 2001
7aff38
From: Michel Alexandre Salim <michel@michel-slm.name>
7aff38
Date: Wed, 27 Jan 2021 20:32:07 -0800
7aff38
Subject: [PATCH] Dynamically detect libdir on Linux
7aff38
7aff38
Some Linux distributions (e.g. Fedora, CentOS) put 64-bit libraries
7aff38
in `/usr/lib64` rather than `/usr/lib`. On such systems `luarocks`
7aff38
should use `lib64` rather than `lib`.
7aff38
7aff38
Signed-off-by: Michel Alexandre Salim <michel@michel-slm.name>
7aff38
---
7aff38
 src/luarocks/core/cfg.lua | 12 ++++++++++++
7aff38
 1 file changed, 12 insertions(+)
7aff38
7aff38
diff --git a/src/luarocks/core/cfg.lua b/src/luarocks/core/cfg.lua
7aff38
index 4ac5ee2..c7d2cb2 100644
7aff38
--- a/src/luarocks/core/cfg.lua
7aff38
+++ b/src/luarocks/core/cfg.lua
7aff38
@@ -397,6 +397,18 @@ local function make_defaults(lua_version, target_cpu, platforms, home)
7aff38
          defaults.variables.CFLAGS = defaults.variables.CFLAGS.." -fPIC"
7aff38
       end
7aff38
       defaults.web_browser = "xdg-open"
7aff38
+      if platforms.linux then
7aff38
+         -- inline code from fs/linux.lua since
7aff38
+         -- luarocks.fs can't be required here
7aff38
+         -- (circular dependencies)
7aff38
+         local fd, _, code = io.open("/usr/lib64", "r")
7aff38
+         if code ~= 2 then
7aff38
+            defaults.lib_modules_path = "/lib64/lua/"..lua_version
7aff38
+         end
7aff38
+         if fd then
7aff38
+            fd:close()
7aff38
+         end
7aff38
+      end
7aff38
    end
7aff38
 
7aff38
    if platforms.cygwin then
7aff38
-- 
7aff38
2.29.2
7aff38