openbsd-ports/devel/premake4/patches/patch-src_base_os_lua
jca 6472386414 Import premake, a build configuration tool
ok awolk@

pkg/DESCR:
Premake is a command line utility which reads a scripted definition of
a software project and, most commonly, uses it to generate project
files for toolsets like Visual Studio, Xcode, or GNU Make.

Official documentation
https://github.com/premake/premake-4.x/wiki
2016-12-04 11:31:35 +00:00

57 lines
1.5 KiB
Plaintext

$OpenBSD: patch-src_base_os_lua,v 1.1.1.1 2016/12/04 11:31:35 jca Exp $
Use ldconfig(8) to find installed libraries.
--- src/base/os.lua.orig Thu Dec 1 19:57:50 2016
+++ src/base/os.lua Thu Dec 1 20:00:17 2016
@@ -55,42 +55,15 @@
end
function os.findlib(libname)
- local path, formats
-
- -- assemble a search path, depending on the platform
- if os.is("windows") then
- formats = { "%s.dll", "%s" }
- path = os.getenv("PATH")
- elseif os.is("haiku") then
- formats = { "lib%s.so", "%s.so" }
- path = os.getenv("LIBRARY_PATH")
- else
- if os.is("macosx") then
- formats = { "lib%s.dylib", "%s.dylib" }
- path = os.getenv("DYLD_LIBRARY_PATH")
- else
- formats = { "lib%s.so", "%s.so" }
- path = os.getenv("LD_LIBRARY_PATH") or ""
-
- for _, v in ipairs(parse_ld_so_conf("/etc/ld.so.conf")) do
- path = path .. ":" .. v
- end
+ libname = libname:gsub("^lib", "")
+ local file = io.popen("ldconfig -r", "r")
+ for line in file:lines() do
+ _, last = line:find(":-l" .. libname .. ".%d+.%d+ => ")
+ if last then
+ return line:sub(last + 1)
end
-
- table.insert(formats, "%s")
- path = path or ""
- if os.is64bit() then
- path = path .. ":/lib64:/usr/lib64/:usr/local/lib64"
- end
- path = path .. ":/lib:/usr/lib:/usr/local/lib"
end
-
- for _, fmt in ipairs(formats) do
- local name = string.format(fmt, libname)
- local result = os.pathsearch(name, path)
- if result then return result end
- end
- end
+ end