Skip to content

Commit e972ee4

Browse files
committed
improve libfiles for pacman
1 parent 5cdbfe6 commit e972ee4

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

xmake/modules/package/manager/pacman/find_package.lua

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -204,15 +204,13 @@ function main(name, opt)
204204
linkdirs = table.unique(linkdirs)
205205

206206
-- we iterate over each pkgconfig file to extract the required data
207-
local foundpc = false
208-
local result = {}
207+
local result
209208
for _, pkgconfig_file in ipairs(pkgconfig_files) do
210209
local pkgconfig_dir = path.directory(pkgconfig_file)
211210
local pkgconfig_name = path.basename(pkgconfig_file)
212211
local pcresult = find_package_from_pkgconfig(pkgconfig_name, {configdirs = pkgconfig_dir, linkdirs = linkdirs})
213-
214-
-- the pkgconfig file has been parse successfully
215212
if pcresult then
213+
result = result or {}
216214
for _, includedir in ipairs(pcresult.includedirs) do
217215
result.includedirs = result.includedirs or {}
218216
table.insert(result.includedirs, includedir)
@@ -233,11 +231,10 @@ function main(name, opt)
233231
result.version = pcresult.version
234232
result.shared = pcresult.shared
235233
result.static = pcresult.static
236-
foundpc = true
237234
end
238235
end
239236

240-
if foundpc == true then
237+
if result then
241238
if result.includedirs then
242239
result.includedirs = table.unique(result.includedirs)
243240
end
@@ -255,9 +252,13 @@ function main(name, opt)
255252
result = _find_package_from_list(list, name, pacman, opt)
256253
end
257254
if result then
258-
if not result.libfiles then
259-
result.libfiles = _find_libfiles_from_list(list, name, pacman, opt)
260-
for _, libfile in ipairs(result.libfiles) do
255+
-- we give priority to libfiles in the list
256+
local libfiles = _find_libfiles_from_list(list, name, pacman, opt)
257+
if libfiles then
258+
result.shared = nil
259+
result.static = nil
260+
result.libfiles = libfiles
261+
for _, libfile in ipairs(libfiles) do
261262
if libfile:endswith(".so") then
262263
result.shared = true
263264
elseif libfile:endswith(".a") then

0 commit comments

Comments
 (0)