diff options
| author | ruki <[email protected]> | 2018-09-19 22:44:59 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2018-09-19 10:29:58 +0800 |
| commit | 4ee805906a0dcf442a80e0bb072c538622bd2a32 (patch) | |
| tree | 0dfaa70bf639b066758f681b3c16b96ee73bbcca /xmake/core/package | |
| parent | b2609ac657e482c68cf27977174bc9080d34eee9 (diff) | |
remove package directory
Diffstat (limited to 'xmake/core/package')
| -rw-r--r-- | xmake/core/package/package.lua | 56 |
1 files changed, 22 insertions, 34 deletions
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua index f6afc7845..a506a8751 100644 --- a/xmake/core/package/package.lua +++ b/xmake/core/package/package.lua @@ -193,12 +193,28 @@ end -- get the prefix directory function _instance:prefixdir(...) - return package.prefixdir(self:from("global"), ...) + + -- make the given prefix directory + local dir = path.join(self:from("global") and global.directory() or config.directory(), "prefix", self:debug() and "debug" or "release", 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 --- get the prefix info file +-- get the prefix list +function _instance:prefixlist() + local prefixfile = self:prefixfile() + if os.isfile(prefixfile) then + return io.load(prefixfile) + end +end + +-- get the prefix list file function _instance:prefixfile() - return path.join(self:prefixdir(".info"), self:name() .. "-" .. (self:version_str() or "") .. ".txt") + return path.join(self:prefixdir(".list"), self:name() .. "-" .. (self:version_str() or "") .. ".txt") end -- get the downloaded original file @@ -211,11 +227,6 @@ function _instance:originfile_set(filepath) self._ORIGINFILE = filepath end --- get the directory of this package -function _instance:directory() - return path.join(package.directory(self:from("global")), self:name():sub(1, 1):lower(), self:name(), self:version_str(), self:debug() and "debug" or "release") -end - -- get versions function _instance:versions() @@ -408,13 +419,14 @@ function _instance:fetch(opt) -- import find_package self._find_package = self._find_package or sandbox_module.import("lib.detect.find_package", {anonymous = true}) - -- fetch it from the package directories first + -- TODO fetch it from the package directories first + --[[ local packagedir = self:directory() if not fetchinfo and packagedir then -- add cache key to make a distinction with finding system package fetchinfo = self._find_package(self:name(), {packagedirs = packagedir, system = false, cachekey = "package:fetch", force = opt.force}) if fetchinfo then fetchfrom = self._FROMKIND end - end + end]] -- fetch it from the system directories if not fetchinfo then @@ -534,35 +546,11 @@ function package.apis() } end --- get package directory -function package.directory(is_global) - - -- get directory - if is_global then - return path.join(global.directory(), "packages") - else - return path.join(config.directory(), "packages") - end -end - -- the cache directory 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) |
