diff options
| author | ruki <[email protected]> | 2018-09-19 22:41:01 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2018-09-19 10:06:08 +0800 |
| commit | b2609ac657e482c68cf27977174bc9080d34eee9 (patch) | |
| tree | caec92a62a0fc7d9800898e94568eb96b40ccac4 /xmake/core/package | |
| parent | 89e82f8a4c620dae78ebae08e00adbc6d17a3e18 (diff) | |
install package to prefix
Diffstat (limited to 'xmake/core/package')
| -rw-r--r-- | xmake/core/package/package.lua | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua index 9a69ddc58..f6afc7845 100644 --- a/xmake/core/package/package.lua +++ b/xmake/core/package/package.lua @@ -182,7 +182,7 @@ end function _instance:installdir(...) -- make the given install directory - local dir = path.join(self:directory(), "install", ...) + local dir = path.join(self:cachedir(), "install", ...) -- ensure the install directory if not os.isdir(dir) then @@ -191,6 +191,16 @@ function _instance:installdir(...) return dir end +-- get the prefix directory +function _instance:prefixdir(...) + return package.prefixdir(self:from("global"), ...) +end + +-- get the prefix info file +function _instance:prefixfile() + return path.join(self:prefixdir(".info"), self:name() .. "-" .. (self:version_str() or "") .. ".txt") +end + -- get the downloaded original file function _instance:originfile() return self._ORIGINFILE @@ -540,6 +550,19 @@ function package.cachedir() return path.join(global.directory(), "cache", "packages") end +-- get the prefix directory +function package.prefixdir(is_global, ...) + + -- make the given prefix directory + local dir = path.join(package.directory(is_global), "prefix", config.get("plat") or os.host(), config.get("arch") or os.arch(), ...) + + -- ensure the prefix directory + if not os.isdir(dir) then + os.mkdir(dir) + end + return dir +end + -- load the package from the system directories function package.load_from_system(packagename) |
