diff options
| author | ruki <[email protected]> | 2021-02-03 22:18:43 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-02-03 22:18:43 +0800 |
| commit | 6933bd53b195c8e95fb18b1af40f623ab76dee54 (patch) | |
| tree | a5bd88466b26b6b682a4080a84f90d51de3acc22 | |
| parent | c01736b0d6c8677226d4a05dd6df018855514970 (diff) | |
improve package:kind
| -rw-r--r-- | xmake/actions/require/impl/actions/install.lua | 2 | ||||
| -rw-r--r-- | xmake/actions/require/impl/package.lua | 2 | ||||
| -rw-r--r-- | xmake/actions/require/install.lua | 2 | ||||
| -rw-r--r-- | xmake/core/package/package.lua | 13 | ||||
| -rw-r--r-- | xmake/modules/private/xrepo/action/env.lua | 2 |
5 files changed, 13 insertions, 8 deletions
diff --git a/xmake/actions/require/impl/actions/install.lua b/xmake/actions/require/impl/actions/install.lua index 69d01c6be..4b077b373 100644 --- a/xmake/actions/require/impl/actions/install.lua +++ b/xmake/actions/require/impl/actions/install.lua @@ -32,7 +32,7 @@ import(".utils.filter") function _patch_pkgconfig(package) -- only binary? need not pkgconfig - if package:kind() == "binary" then + if not package:is_library() then return end diff --git a/xmake/actions/require/impl/package.lua b/xmake/actions/require/impl/package.lua index 281bbaef3..669e0aecc 100644 --- a/xmake/actions/require/impl/package.lua +++ b/xmake/actions/require/impl/package.lua @@ -502,7 +502,7 @@ function _load_package(packagename, requireinfo, opt) _merge_requireinfo(requireinfo, opt.requirepath) -- inherit some builtin configs of parent package, e.g. vs_runtime, pic - if opt.parentinfo and package:kind() ~= "binary" then + if opt.parentinfo and package:is_library() then _inherit_parent_configs(requireinfo, opt.parentinfo) end diff --git a/xmake/actions/require/install.lua b/xmake/actions/require/install.lua index c39569713..c2deeac90 100644 --- a/xmake/actions/require/install.lua +++ b/xmake/actions/require/install.lua @@ -51,7 +51,7 @@ end -- register required package libraries -- libs: includedirs, links, linkdirs ... function _register_required_package_libs(instance, requireinfo, is_deps) - if instance:kind() ~= "binary" then + if instance:is_library() then local fetchinfo = instance:fetch() if fetchinfo then fetchinfo.name = nil diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua index 2cef80910..15eb0b144 100644 --- a/xmake/core/package/package.lua +++ b/xmake/core/package/package.lua @@ -101,7 +101,7 @@ end -- get the platform of package function _instance:plat() -- @note we uses os.host() instead of them for the binary package - if self:kind() == "binary" then + if self:is_binary() then return os.host() end local requireinfo = self:requireinfo() @@ -114,7 +114,7 @@ end -- get the architecture of package function _instance:arch() -- @note we uses os.arch() instead of them for the binary package - if self:kind() == "binary" then + if self:is_binary() then return os.arch() end local requireinfo = self:requireinfo() @@ -286,6 +286,11 @@ function _instance:is_binary() return self:kind() == "binary" end +-- is library package? +function _instance:is_library() + return self:kind() == nil or self:kind() == "library" +end + -- get the filelock of the whole package directory function _instance:filelock() local filelock = self._FILELOCK @@ -430,7 +435,7 @@ function _instance:envs() local envs = self._ENVS if not envs then envs = {} - if self:kind() == "binary" or self:is_plat("windows", "mingw") then -- bin/*.dll for windows + if self:is_binary() or self:is_plat("windows", "mingw") then -- bin/*.dll for windows envs.PATH = {"bin"} end -- add LD_LIBRARY_PATH to load *.so directory @@ -939,7 +944,7 @@ function _instance:fetch(opt) -- fetch binary tool? fetchinfo = nil local isSys = nil - if self:kind() == "binary" then + if self:is_binary() then -- import find_tool self._find_tool = self._find_tool or sandbox_module.import("lib.detect.find_tool", {anonymous = true}) diff --git a/xmake/modules/private/xrepo/action/env.lua b/xmake/modules/private/xrepo/action/env.lua index 0759988de..90f8cd520 100644 --- a/xmake/modules/private/xrepo/action/env.lua +++ b/xmake/modules/private/xrepo/action/env.lua @@ -187,7 +187,7 @@ function _package_addenvs(envs, instance) end -- add library envs, e.g. ACLOCAL_PATH, PKG_CONFIG_PATH .. - if instance:kind() ~= "binary" then + if instance:is_library() then local pkgconfig = path.join(installdir, "lib", "pkgconfig") if os.isdir(pkgconfig) then _package_addenv(envs, "PKG_CONFIG_PATH", pkgconfig) |
