summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2019-03-11 22:40:38 +0800
committerruki <[email protected]>2019-03-11 10:03:54 +0800
commit8faab0d7801e89d8de4cb8cce990c943be41815f (patch)
tree11684ad9e4c461592ae1c499a9ffeb37bb299d9c
parent04b11774c17f90381d14ff5814c6b17baee35a52 (diff)
remove prefix directory for package repo
-rw-r--r--xmake/actions/require/impl/action/install.lua7
-rw-r--r--xmake/actions/require/impl/action/prefix/install.lua352
-rw-r--r--xmake/actions/require/impl/action/prefix/uninstall.lua53
-rw-r--r--xmake/actions/require/impl/environment.lua26
-rw-r--r--xmake/actions/require/info.lua6
-rw-r--r--xmake/core/package/package.lua144
-rw-r--r--xmake/core/platform/environment.lua30
-rw-r--r--xmake/core/sandbox/modules/import/core/package/package.lua14
8 files changed, 11 insertions, 621 deletions
diff --git a/xmake/actions/require/impl/action/install.lua b/xmake/actions/require/impl/action/install.lua
index 181bded44..a1026de12 100644
--- a/xmake/actions/require/impl/action/install.lua
+++ b/xmake/actions/require/impl/action/install.lua
@@ -27,7 +27,6 @@ import("core.base.option")
import("core.project.target")
import("test")
import(".utils.filter")
-import("prefix")
-- install the given package
function main(package)
@@ -87,9 +86,6 @@ function main(package)
end
else
- -- uninstall it from the prefix directory first
- prefix.uninstall(package)
-
-- build and install package to the install directory
local installedfile = path.join(package:installdir(), "installed.txt")
if not os.isfile(installedfile) then
@@ -109,9 +105,6 @@ function main(package)
io.writefile(installedfile, "")
end
- -- install to the prefix directory
- prefix.install(package)
-
-- test it
test(package)
end
diff --git a/xmake/actions/require/impl/action/prefix/install.lua b/xmake/actions/require/impl/action/prefix/install.lua
deleted file mode 100644
index 041c3c983..000000000
--- a/xmake/actions/require/impl/action/prefix/install.lua
+++ /dev/null
@@ -1,352 +0,0 @@
---!The Make-like install Utility based on Lua
---
--- Licensed to the Apache Software Foundation (ASF) under one
--- or more contributor license agreements. See the NOTICE file
--- distributed with this work for additional information
--- regarding copyright ownership. The ASF licenses this file
--- to you under the Apache License, Version 2.0 (the
--- "License"); you may not use this file except in compliance
--- with the License. You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
---
--- Copyright (C) 2015 - 2019, TBOOX Open Source Group.
---
--- @author ruki
--- @file install.lua
---
-
--- imports
-import("core.base.global")
-import("core.project.config")
-import("core.project.target")
-import("uninstall")
-
--- copy files to the prefix directory
-function _copy(mode, pattern)
-
- -- do install
- local prefixdir = _g.prefixdir
- local installdir = _g.installdir
- local relative_pathes = _g.relative_pathes
- for _, sourcepath in ipairs(os.match(path.join(installdir, pattern), mode)) do
-
- -- get relative path
- local relative_path = path.relative(sourcepath, installdir)
-
- -- trace
- vprint("copying %s ..", relative_path)
-
- -- copy file to the prefix directory
- os.vcp(sourcepath, path.absolute(relative_path, prefixdir))
-
- -- save this relative path
- table.insert(relative_pathes, relative_path)
- end
-end
-
--- copy directories to the prefix directory
-function _copy_dirs(pattern)
- _copy('d', pattern)
-end
-
--- copy files to the prefix directory
-function _copy_files(pattern)
- _copy('f', pattern)
-end
-
--- copy files and directories to the prefix directory
-function _copy_filedirs(pattern)
- _copy('a', pattern)
-end
-
--- find the prefix info file of the previous package
-function _find_prefixfile(originpath)
- local parentdir = path.directory(originpath)
- while parentdir and os.isdir(parentdir) and parentdir ~= "/" do
- local relative_path = path.relative(parentdir, path.join(global.directory(), "installed"))
- local prefixfile_local = path.join(config.directory(), "prefix", "info", relative_path, "info.txt")
- if os.isfile(prefixfile_local) then
- return prefixfile_local
- end
- local prefixfile_global = path.join(global.directory(), "prefix", "info", relative_path, "info.txt")
- if os.isfile(prefixfile_global) then
- return prefixfile_global
- end
- parentdir = path.directory(parentdir)
- end
-end
-
--- do link
-function _do_link(sourcepath, relativepath)
-
- -- link conflicts?
- local destpath = path.absolute(relativepath, _g.prefixdir)
- if os.islink(destpath) then
-
- -- get the original path of destpath
- local originpath = os.readlink(destpath)
-
- -- fix conflicts
- if os.isdir(sourcepath) and os.isdir(originpath) then
-
- -- trace
- vprint("unlinking %s ..", relativepath)
-
-
- -- find the prefix info file of the previous package
- local prefixfile = _find_prefixfile(originpath)
-
- -- get the prefix info
- local prefixinfo = nil
- if prefixfile and os.isfile(prefixfile) then
- prefixinfo = io.load(prefixfile)
- end
-
- -- remove the previous link
- os.rm(destpath)
- if prefixinfo then
- for idx, installfile in ipairs(prefixinfo.installed) do
- if installfile == relativepath then
- table.remove(prefixinfo.installed, idx)
- break
- end
- end
- end
-
- -- expand and relink the previous directories
- for _, filedir in ipairs(os.filedirs(path.join(originpath, "*"))) do
-
- -- get file or directory name
- local filename = path.filename(filedir)
-
- -- trace
- vprint("relinking %s ..", path.join(relativepath, filename))
-
- -- do link
- os.vln(filedir, path.join(destpath, filename))
-
- -- save this relative path
- table.insert(prefixinfo.installed, path.join(relativepath, filename))
- end
-
- -- update the previous prefix info file
- if prefixinfo then
- io.save(prefixfile, prefixinfo)
- end
-
- -- link the child pathes
- for _, filedir in ipairs(os.filedirs(path.join(sourcepath, "*"))) do
- _do_link(filedir, path.join(relativepath, path.filename(filedir)))
- end
-
- -- fix broken link path
- elseif os.isdir(sourcepath) and not os.exists(originpath) then
-
- -- remove the broken link path
- os.rm(destpath)
-
- -- trace
- vprint("linking %s ..", relativepath)
-
- -- do link
- os.vln(sourcepath, destpath)
-
- -- save this relative path
- table.insert(_g.relative_pathes, relativepath)
- else
- -- link conflicts
- os.raise("cannot link %s => %s", sourcepath, destpath)
- end
- elseif os.isdir(destpath) then
-
- -- link the child pathes
- for _, filedir in ipairs(os.filedirs(path.join(sourcepath, "*"))) do
- _do_link(filedir, path.join(relativepath, path.filename(filedir)))
- end
- else
-
- -- trace
- vprint("linking %s ..", relativepath)
-
- -- do link
- os.vln(sourcepath, destpath)
-
- -- save this relative path
- table.insert(_g.relative_pathes, relativepath)
- end
-end
-
--- link files to the prefix directory
-function _link(mode, pattern)
- local installdir = _g.installdir
- for _, sourcepath in ipairs(os.match(path.join(installdir, pattern), mode)) do
- _do_link(sourcepath, path.relative(sourcepath, installdir))
- end
-end
-
--- link directories to the prefix directory
-function _link_dirs(pattern)
- _link('d', pattern)
-end
-
--- link files to the prefix directory
-function _link_files(pattern)
- _link('f', pattern)
-end
-
--- link files and directories to the prefix directory
-function _link_filedirs(pattern)
- _link('a', pattern)
-end
-
--- patch pkgconfig if not exists
-function _patch_pkgconfig(package)
-
- -- get lib/pkgconfig/*.pc file
- local pcfile = path.join(package:installdir("lib", "pkgconfig"), package:name() .. ".pc")
- if os.isfile(pcfile) then
- return
- end
-
- -- trace
- vprint("patching %s ..", pcfile)
-
- -- get libs
- local libs = ""
- for _, linkdir in ipairs(package:getvar("linkdirs")) do
- libs = libs .. "-L" .. linkdir
- end
- libs = libs .. " -L${libdir}"
- local links = package:getvar("links")
- if links then
- for _, link in ipairs(links) do
- libs = libs .. " -l" .. link
- end
- else
- local found = false
- for _, libfile in ipairs(os.files(path.join(package:installdir("lib"), "*.a"))) do
- local link = target.linkname(path.filename(libfile))
- if link then
- libs = libs .. " -l" .. link
- found = true
- end
- end
- if not found then
- for _, libfile in ipairs(os.files(path.join(package:installdir("lib"), "*.so"))) do
- local link = target.linkname(path.filename(libfile))
- if link then
- libs = libs .. " -l" .. link
- end
- end
- end
- end
- for _, link in ipairs(package:getvar("syslinks")) do
- libs = libs .. " -l" .. link
- end
-
- -- cflags
- local cflags = ""
- for _, includedir in ipairs(package:getvar("includedirs")) do
- cflags = cflags .. "-I" .. includedir
- end
- cflags = cflags .. " -I${includedir}"
-
- -- patch a *.pc file
- local file = io.open(pcfile, 'w')
- if file then
- file:print("prefix=%s", package:prefixdir())
- file:print("exec_prefix=${prefix}")
- file:print("libdir=${exec_prefix}/lib")
- file:print("includedir=${prefix}/include")
- file:print("")
- file:print("Name: %s", package:name())
- file:print("Description: %s", package:description())
- file:print("Version: %s", package:version_str())
- file:print("Libs: %s", libs)
- file:print("Libs.private: ")
- file:print("Cflags: %s", cflags)
- file:close()
- end
-end
-
--- install package with link
-function _install_with_link(package)
- _link_files("bin/*")
- _link_files("sbin/*")
- _link_filedirs("include/*")
- _link_filedirs("lib/*")
- _link_filedirs("share/*|info")
- _link_filedirs("share/info/*|dir")
-end
-
--- install package without link (windows)
-function _install_without_link(package)
- if package:kind() == "binary" then
- _copy_filedirs("**")
- else
- _copy_filedirs("lib/**")
- _copy_filedirs("include/**")
- end
-end
-
--- install package
-function _install(package)
-
- -- patch pkgconfig if not exists
- if not is_plat("windows") then
- _patch_pkgconfig(package)
- end
-
- -- install package to the prefix directory
- if is_host("windows") then
- _install_without_link(package)
- else
- _install_with_link(package)
- end
-end
-
--- install package to the prefix directory
-function main(package)
-
- -- init some pathes
- _g.prefixdir = package:prefixdir()
- _g.installdir = package:installdir()
- _g.relative_pathes = {}
-
- -- trace
- vprint("installing %s to %s ..", _g.installdir, _g.prefixdir)
-
- -- install to the prefix directory
- local relative_pathes = {}
- try
- {
- function ()
- _install(package)
- end,
- finally
- {
- function (ok, errors)
- -- save the prefix info to file
- local prefixinfo = package:prefixinfo()
- prefixinfo.installed = _g.relative_pathes
- io.save(package:prefixfile(), prefixinfo)
-
- -- register this package
- package:register()
-
- -- continue to raise errors
- if not ok then
- raise(errors)
- end
- end
- }
- }
-end
-
diff --git a/xmake/actions/require/impl/action/prefix/uninstall.lua b/xmake/actions/require/impl/action/prefix/uninstall.lua
deleted file mode 100644
index 3e48695ed..000000000
--- a/xmake/actions/require/impl/action/prefix/uninstall.lua
+++ /dev/null
@@ -1,53 +0,0 @@
---!The Make-like install Utility based on Lua
---
--- Licensed to the Apache Software Foundation (ASF) under one
--- or more contributor license agreements. See the NOTICE file
--- distributed with this work for additional information
--- regarding copyright ownership. The ASF licenses this file
--- to you under the Apache License, Version 2.0 (the
--- "License"); you may not use this file except in compliance
--- with the License. You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
---
--- Copyright (C) 2015 - 2019, TBOOX Open Source Group.
---
--- @author ruki
--- @file uninstall.lua
---
-
--- uninstall package from the prefix directory
-function main(package)
-
- -- remove the previous installed files
- local prefixdir = package:prefixdir()
- for _, relativefile in ipairs(package:prefixinfo().installed) do
-
- -- trace
- vprint("removing %s ..", relativefile)
-
- -- remove file
- local prefixfile = path.absolute(relativefile, prefixdir)
- os.tryrm(prefixfile)
-
- -- remove it if the parent directory is empty
- local parentdir = path.directory(prefixfile)
- while parentdir and os.isdir(parentdir) and os.emptydir(parentdir) do
- os.tryrm(parentdir)
- parentdir = path.directory(parentdir)
- end
- end
-
- -- unregister this package
- package:unregister()
-
- -- remove the prefix file
- os.tryrm(package:prefixfile())
-end
-
diff --git a/xmake/actions/require/impl/environment.lua b/xmake/actions/require/impl/environment.lua
index e4cf1ff10..febae166e 100644
--- a/xmake/actions/require/impl/environment.lua
+++ b/xmake/actions/require/impl/environment.lua
@@ -54,37 +54,11 @@ function enter()
if not ((find_tool("gzip") and find_tool("tar")) or find_tool("7z")) then
package.install_packages("7z")
end
-
- -- get prefix directories
- local plat = get_config("plat")
- local arch = get_config("arch")
- _g.prefixdirs = _g.prefixdirs or
- {
- core_package.prefixdir(false, "release", plat, arch),
- core_package.prefixdir(true, "release", plat, arch),
- }
-
- -- add search directories of pkgconfig, aclocal, cmake
- _g._ACLOCAL_PATH = os.getenv("ACLOCAL_PATH")
- _g._PKG_CONFIG_PATH = os.getenv("PKG_CONFIG_PATH")
- _g._CMAKE_PREFIX_PATH = os.getenv("CMAKE_PREFIX_PATH")
- for _, prefixdir in ipairs(_g.prefixdirs) do
- if not is_plat("windows") then
- os.addenv("ACLOCAL_PATH", path.join(prefixdir, "share", "aclocal"))
- os.addenv("PKG_CONFIG_PATH", path.join(prefixdir, "lib", "pkgconfig"))
- end
- os.addenv("CMAKE_PREFIX_PATH", prefixdir)
- end
end
-- leave environment
function leave()
- -- restore search directories of pkgconfig, aclocal, cmake
- os.setenv("ACLOCAL_PATH", _g._ACLOCAL_PATH)
- os.setenv("PKG_CONFIG_PATH", _g._PKG_CONFIG_PATH)
- os.setenv("CMAKE_PREFIX_PATH", _g._CMAKE_PREFIX_PATH)
-
-- restore search pathes of toolchains
environment.leave("toolchains")
end
diff --git a/xmake/actions/require/info.lua b/xmake/actions/require/info.lua
index d0060e0f7..e75036df5 100644
--- a/xmake/actions/require/info.lua
+++ b/xmake/actions/require/info.lua
@@ -136,12 +136,6 @@ function main(package_names)
-- show cache directory
cprint(" -> ${magenta}cachedir${clear}: %s", instance:cachedir())
- -- show prefix directory
- cprint(" -> ${magenta}prefixdir${clear}: %s", instance:prefixdir())
-
- -- show prefix file
- cprint(" -> ${magenta}prefixfile${clear}: %s", instance:prefixfile())
-
-- show install directory
cprint(" -> ${magenta}installdir${clear}: %s", instance:installdir())
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua
index 87c075439..f230398c2 100644
--- a/xmake/core/package/package.lua
+++ b/xmake/core/package/package.lua
@@ -226,7 +226,7 @@ function _instance:installdir(...)
-- make the given install directory
local name = self:name():lower():gsub("::", "_")
- local dir = path.join(package.installdir(table.concat({self:mode(), self:configs_hash()}, '_'), self:plat(), self:arch()), name:sub(1, 1):lower(), name, self:version_str(), ...)
+ local dir = path.join(package.installdir(), name:sub(1, 1):lower(), name, self:version_str(), self:configs_hash(), ...)
-- ensure the install directory
if not os.isdir(dir) then
@@ -235,82 +235,29 @@ function _instance:installdir(...)
return dir
end
--- get the prefix directory
-function _instance:prefixdir(...)
-
- -- make the given prefix directory
- local dir = path.join(package.prefixdir(self:from("global"), table.concat({self:mode(), self:configs_hash()}, '_'), self:plat(), self:arch()), ...)
-
- -- ensure the prefix directory
- if not os.isdir(dir) then
- os.mkdir(dir)
- end
- return dir
-end
-
--- get the prefix info
-function _instance:prefixinfo()
- if self._PREFIXINFO == nil then
- local prefixfile = self:prefixfile()
- self._PREFIXINFO = os.isfile(prefixfile) and io.load(prefixfile) or {}
- end
- return self._PREFIXINFO
-end
-
--- get the prefix info file
-function _instance:prefixfile()
- local name = self:name():lower():gsub("::", "_")
- return path.join(package.prefixinfodir(self:from("global"), table.concat({self:mode(), self:configs_hash()}, '_'), self:plat(), self:arch()), name:sub(1, 1):lower(), name, self:version_str(), "info.txt")
-end
-
-- get prefix variables
function _instance:getvar(name)
- return self:prefixinfo()[name]
+ -- TODO
end
-- set prefix variables
function _instance:setvar(name, ...)
- self:prefixinfo()[name] = {...}
end
-- add prefix variables
function _instance:addvar(name, ...)
- self:prefixinfo()[name] = table.join(self:prefixinfo()[name] or {}, ...)
end
-- get environment variables
function _instance:getenv(name)
- return self:prefixinfo().envars and self:prefixinfo().envars[name] or nil
end
-- set environment variables
function _instance:setenv(name, ...)
- self:prefixinfo().envars = self:prefixinfo().envars or {}
- self:prefixinfo().envars[name] = {...}
end
-- add values to environment variable
function _instance:addenv(name, ...)
- self:prefixinfo().envars = self:prefixinfo().envars or {}
- self:prefixinfo().envars[name] = table.join(self:prefixinfo().envars[name] or {}, ...)
-end
-
--- register package info in the root prefix info
-function _instance:register()
-
- -- register the environment variables
- for name, values in pairs(table.wrap(self:prefixinfo().envars)) do
- package.addenv(self:from("global"), table.concat({self:mode(), self:configs_hash()}, '_'), self:plat(), self:arch(), name, values)
- end
-end
-
--- unregister package info from the root prefix info
-function _instance:unregister()
-
- -- unregister the environment variables
- for name, values in pairs(table.wrap(self:prefixinfo().envars)) do
- package.delenv(self:from("global"), table.concat({self:mode(), self:configs_hash()}, '_'), self:plat(), self:arch(), name, values)
- end
end
-- get user private data
@@ -406,25 +353,7 @@ end
-- set the require info
function _instance:requireinfo_set(requireinfo)
-
- -- save require info
self._REQUIREINFO = requireinfo
-
- -- get version
- local version = requireinfo and requireinfo.version or nil
- local limitversion = version and version ~= "master" and version ~= "lastest"
- if requireinfo and not self:is3rd() then
-
- -- switch to local package if exists package configuration or debug package or limit version
- if requireinfo.config or requireinfo.debug or limitversion then
- self._FROMKIND = "local"
- end
-
- -- disable the system package if limit version
- if limitversion then
- requireinfo.system = false
- end
- end
end
-- get the all configuration values of package
@@ -438,10 +367,12 @@ end
-- get the hash of configs
function _instance:configs_hash()
if self._CONFIGS_HASH == nil then
+ local str = self:plat() .. self:arch() .. self:mode()
local configs = self:configs()
if configs then
- self._CONFIGS_HASH = hash.uuid(string.serialize(configs, true)):split('-')[1]:lower()
+ str = str .. string.serialize(configs, true)
end
+ self._CONFIGS_HASH = hash.uuid(str):gsub('-', ''):lower()
end
return self._CONFIGS_HASH
end
@@ -594,8 +525,7 @@ function _instance:fetch(opt)
-- only fetch it from the xmake repository first
if not fetchinfo and system ~= true and not self:is3rd() then
- fetchinfo = self._find_package("xmake::" .. self:name(), {prefixdirs = self:prefixdir(),
- mode = self:mode(),
+ fetchinfo = self._find_package("xmake::" .. self:name(), {mode = self:mode(),
islocal = self:from("local"),
version = require_ver,
cachekey = "fetch_package_xmake",
@@ -724,77 +654,21 @@ function package.cachedir()
end
-- the install directory
-function package.installdir(mode, plat, arch)
- return path.join(global.directory(), "installed", plat or os.host(), arch or os.arch(), mode or "release")
-end
-
--- get the prefix directory
-function package.prefixdir(is_global, mode, plat, arch)
- return path.join(is_global and global.directory() or config.directory(), "prefix", plat or os.host(), arch or os.arch(), mode or "release")
-end
-
--- get the prefix info directory
-function package.prefixinfodir(is_global, mode, plat, arch)
- return path.join(is_global and global.directory() or config.directory(), "prefix", "info", plat or os.host(), arch or os.arch(), mode or "release")
-end
-
--- get the prefix info
-function package.prefixinfo(is_global, mode, plat, arch)
- local prefixfile = package.prefixfile(is_global, mode, plat, arch)
- return os.isfile(prefixfile) and io.load(prefixfile) or {}
-end
-
--- get the prefix info file
-function package.prefixfile(is_global, mode, plat, arch)
- return path.join(package.prefixinfodir(is_global, mode, plat, arch), "info.txt")
+function package.installdir()
+ return path.join(global.directory(), "installed")
end
-- get environment variables
function package.getenv(is_global, mode, plat, arch, name)
- local prefixinfo = package.prefixinfo(is_global, mode, plat, arch)
- return prefixinfo.envars and prefixinfo.envars[name] or nil
+ -- TODO
end
-- add values to environment variable
function package.addenv(is_global, mode, plat, arch, name, values)
-
- -- add to the root prefix info
- local prefixinfo = package.prefixinfo(is_global, mode, plat, arch)
- prefixinfo.envars = prefixinfo.envars or {}
- prefixinfo.envars[name] = table.join(prefixinfo.envars[name] or {}, values)
- io.save(package.prefixfile(is_global, mode, plat, arch), prefixinfo)
-
- -- add to the current environment
- if values then
- -- PATH? add the prefix root directory
- if name:lower() == "path" then
- local prefixdir = package.prefixdir(is_global, mode, plat, arch)
- for _, value in ipairs(values) do
- os.addenv(name, path.join(prefixdir, value))
- end
- else
- os.addenv(name, unpack(values))
- end
- end
end
-- remove values to environment variable
function package.delenv(is_global, mode, plat, arch, name, values)
- local prefixinfo = package.prefixinfo(is_global, mode, plat, arch)
- local prefixvalues = prefixinfo.envars and prefixinfo.envars[name] or nil
- if prefixvalues then
- local exists = {}
- for _, value in ipairs(values) do
- exists[value:trim()] = true
- end
- for i = #prefixvalues, 1, -1 do
- value = prefixvalues[i]:trim()
- if exists[value] then
- table.remove(prefixvalues, i)
- end
- end
- io.save(package.prefixfile(is_global, mode, plat, arch), prefixinfo)
- end
end
-- load the package from the system directories
diff --git a/xmake/core/platform/environment.lua b/xmake/core/platform/environment.lua
index b20d55fd7..5da87d2d1 100644
--- a/xmake/core/platform/environment.lua
+++ b/xmake/core/platform/environment.lua
@@ -39,20 +39,6 @@ function environment._enter_toolchains()
-- save the toolchains environment
environment._PATH = os.getenv("PATH")
- -- add global search binary pathes
- local globaldir = package.prefixdir(true, "release", os.host(), os.arch())
- for _, dir in ipairs(table.wrap(package.getenv(true, "release", os.host(), os.arch(), "PATH"))) do
- os.addenv("PATH", path.join(globaldir, dir))
- end
- os.addenv("PATH", path.join(globaldir, "bin"))
-
- -- add local search binary pathes
- local localdir = package.prefixdir(false, "release", os.host(), os.arch())
- for _, dir in ipairs(table.wrap(package.getenv(false, "release", os.host(), os.arch(), "PATH"))) do
- os.addenv("PATH", path.join(localdir, dir))
- end
- os.addenv("PATH", path.join(localdir, "bin"))
-
-- add $programdir/winenv/bin to $path
if os.host() == "windows" then
os.addenv("PATH", path.join(os.programdir(), "winenv", "bin"))
@@ -72,22 +58,6 @@ function environment._enter_run()
-- save the running environment
environment._PATH = os.getenv("PATH")
environment._LD_LIBRARY_PATH = os.getenv("LD_LIBRARY_PATH")
-
- -- add global search library pathes of pathes
- local globaldir = package.prefixdir(true, "release", os.host(), os.arch())
- if os.host() == "windows" then
- os.addenv("PATH", path.join(globaldir, "lib"))
- else
- os.addenv("LD_LIBRARY_PATH", path.join(globaldir, "lib"))
- end
-
- -- add local search library pathes of pathes
- local localdir = package.prefixdir(false, "release", os.host(), os.arch())
- if os.host() == "windows" then
- os.addenv("PATH", path.join(localdir, "lib"))
- else
- os.addenv("LD_LIBRARY_PATH", path.join(localdir, "lib"))
- end
end
-- leave the running environment
diff --git a/xmake/core/sandbox/modules/import/core/package/package.lua b/xmake/core/sandbox/modules/import/core/package/package.lua
index 54a1ce1de..563032482 100644
--- a/xmake/core/sandbox/modules/import/core/package/package.lua
+++ b/xmake/core/sandbox/modules/import/core/package/package.lua
@@ -36,18 +36,8 @@ function sandbox_core_package_package.cachedir()
end
-- the install directory
-function sandbox_core_package_package.installdir(mode, plat, arch)
- return package.installdir(mode, plat, arch)
-end
-
--- get the prefix directory
-function sandbox_core_package_package.prefixdir(is_global, mode, plat, arch)
- return package.prefixdir(is_global, mode, plat, arch)
-end
-
--- get the prefix info directory
-function sandbox_core_package_package.prefixinfodir(is_global, mode, plat, arch)
- return package.prefixinfodir(is_global, mode, plat, arch)
+function sandbox_core_package_package.installdir()
+ return package.installdir()
end
-- load the package from the project file