diff options
| author | ruki <[email protected]> | 2018-09-30 09:23:01 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2018-09-30 09:23:01 +0800 |
| commit | a8be35d88a0c23cf95aaaa365472825c1e60cd18 (patch) | |
| tree | 5c3c301096578fe67e1da3f99d6c119eb17cbff7 | |
| parent | 55aa91d16840691b5c8d1e6f5b8997db9575a3f8 (diff) | |
improve pkg-config package
| -rw-r--r-- | xmake/actions/require/action/install.lua | 6 | ||||
| -rw-r--r-- | xmake/core/package/package.lua | 19 | ||||
| -rw-r--r-- | xmake/repository/packages/p/pkg-config/xmake.lua | 12 |
3 files changed, 31 insertions, 6 deletions
diff --git a/xmake/actions/require/action/install.lua b/xmake/actions/require/action/install.lua index da7dde7c3..0af940549 100644 --- a/xmake/actions/require/action/install.lua +++ b/xmake/actions/require/action/install.lua @@ -78,9 +78,11 @@ function install_prefix(package) end else if package:kind() == "binary" then - table.join2(installfiles, (os.filedirs(path.join(package:installdir("bin"), "*")))) + table.join2(installfiles, (os.files(path.join(package:installdir("bin"), "*")))) else - table.join2(installfiles, (os.filedirs(path.join(package:installdir("lib"), "*")))) + table.join2(installfiles, (os.files(path.join(package:installdir("lib"), "**.a")))) + table.join2(installfiles, (os.files(path.join(package:installdir("lib"), is_plat("macosx") and "**.dylib" or "**.so")))) + table.join2(installfiles, (os.files(path.join(package:installdir("lib", "pkgconfig"), "**.pc")))) table.join2(installfiles, (os.filedirs(path.join(package:installdir("include"), "*")))) end end diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua index efd2e893b..5215154ef 100644 --- a/xmake/core/package/package.lua +++ b/xmake/core/package/package.lua @@ -74,11 +74,19 @@ 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 + return os.host() + end return config.get("plat") or os.host() 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 + return os.arch() + end return config.get("arch") or os.arch() end @@ -391,6 +399,10 @@ end -- is debug package? function _instance:debug() + -- @note always release for the binary package + if self:kind() == "binary" then + return false + end local requireinfo = self:requireinfo() return requireinfo and requireinfo.debug or false end @@ -411,9 +423,12 @@ function _instance:script(name, generic) result = script elseif type(script) == "table" then + -- get plat and arch + local plat = self:plat() or "" + local arch = self:arch() or "" + -- match script for special plat and arch - local plat = (config.get("plat") or "") - local pattern = plat .. '|' .. (config.get("arch") or "") + local pattern = plat .. '|' .. arch for _pattern, _script in pairs(script) do if not _pattern:startswith("__") and pattern:find('^' .. _pattern .. '$') then result = _script diff --git a/xmake/repository/packages/p/pkg-config/xmake.lua b/xmake/repository/packages/p/pkg-config/xmake.lua index 39650e9bd..754ecd1f7 100644 --- a/xmake/repository/packages/p/pkg-config/xmake.lua +++ b/xmake/repository/packages/p/pkg-config/xmake.lua @@ -2,7 +2,7 @@ package("pkg-config") set_kind("binary") set_homepage("https://freedesktop.org/wiki/Software/pkg-config/") - set_description("Manage compile and link flags for libraries.") + set_description("A helper tool used when compiling applications and libraries.") if is_host("macosx", "linux") then add_urls("https://pkgconfig.freedesktop.org/releases/pkg-config-$(version).tar.gz", @@ -12,7 +12,15 @@ package("pkg-config") end on_install("macosx", "linux", function (package) - import("package.tools.autoconf").install(package, {"--disable-debug", "--disable-host-tool", "--with-internal-glib"}) + local pcpath = {"/usr/local/lib/pkgconfig", "/usr/lib/pkgconfig"} + if is_host("macosx") then + local macver = os.iorun("sw_vers -productVersion"):trim() + if #macver > 0 then + local vers = macver:split('%.') + table.insert(pcpath, "/usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig/" .. vers[1] .. '.' .. vers[2]) + end + end + import("package.tools.autoconf").install(package, {"--disable-debug", "--disable-host-tool", "--with-internal-glib", ["with-pc-path"] = table.concat(pcpath, ':')}) end) on_test(function (package) |
