summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2021-08-21 00:07:26 +0800
committerruki <[email protected]>2021-08-21 00:07:26 +0800
commitbc582fd4bdaee3add88a4e15f1764c7e11eec41c (patch)
tree9fa03b88c7a3ba03f3df82150237954ab5f01f08
parenta226ce07d85f3aab66b6dacf6f91e85f7296a490 (diff)
improve installation
-rw-r--r--xmake/modules/package/manager/xmake/find_package.lua6
-rw-r--r--xmake/modules/target/action/install/unix.lua10
2 files changed, 5 insertions, 11 deletions
diff --git a/xmake/modules/package/manager/xmake/find_package.lua b/xmake/modules/package/manager/xmake/find_package.lua
index a44744ad2..0b043cc2f 100644
--- a/xmake/modules/package/manager/xmake/find_package.lua
+++ b/xmake/modules/package/manager/xmake/find_package.lua
@@ -83,12 +83,14 @@ function _find_package_from_repo(name, opt)
if file:endswith(".lib") or file:endswith(".a") then
found = true
table.insert(links, target.linkname(path.filename(file)))
+ table.insert(libfiles, file)
end
end
if not found then
for _, file in ipairs(os.files(path.join(installdir, "lib", "*"))) do
- if file:endswith(".so") or file:endswith(".dylib") then
+ if file:endswith(".so") or file:match(".+%.so%..+$") or file:endswith(".dylib") then -- maybe symlink to libxxx.so.1
table.insert(links, target.linkname(path.filename(file)))
+ table.insert(libfiles, file)
end
end
end
@@ -139,7 +141,7 @@ function _find_package_from_repo(name, opt)
result.links = table.unique(result.links)
end
if result.libfiles then
- result.libfiles = table.join(result.libfiles, libfiles)
+ result.libfiles = table.unique(table.join(result.libfiles, libfiles))
end
-- inherit the other prefix variables
diff --git a/xmake/modules/target/action/install/unix.lua b/xmake/modules/target/action/install/unix.lua
index 2f55dbd3b..ae06ed3bc 100644
--- a/xmake/modules/target/action/install/unix.lua
+++ b/xmake/modules/target/action/install/unix.lua
@@ -38,7 +38,7 @@ end
-- install shared libraries for package
function _install_shared_for_package(target, pkg, outputdir)
for _, sopath in ipairs(table.wrap(pkg:get("libfiles"))) do
- if sopath:endswith(".so") or sopath:endswith(".dylib") then
+ if sopath:endswith(".so") or sopath:match(".+%.so%..+$") or sopath:endswith(".dylib") then
local soname = path.filename(sopath)
if os.isfile(path.join(outputdir, soname)) then
wprint("'%s' already exists in install dir, overwriting it from package(%s).", soname, pkg:name())
@@ -46,14 +46,6 @@ function _install_shared_for_package(target, pkg, outputdir)
-- we need reserve symlink
-- @see https://github.com/xmake-io/xmake/issues/1582
os.vcp(sopath, outputdir, {symlink = true})
- -- copy real file of symlink
- if os.islink(sopath) then
- local realpath = os.readlink(sopath)
- if not path.is_absolute(realpath) then
- realpath = path.absolute(realpath, path.directory(sopath))
- end
- os.vcp(realpath, outputdir)
- end
end
end
end