|
|
|
@ -57,18 +57,29 @@ function is_supported(instance, plat, arch, opt) |
|
|
|
|
return result |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
-- load package |
|
|
|
|
function _load_package(packagename, packagedir, packagefile) |
|
|
|
|
local funcinfo = debug.getinfo(package.load_from_repository) |
|
|
|
|
if funcinfo and funcinfo.nparams == 3 then -- >= 2.7.8 |
|
|
|
|
return package.load_from_repository(packagename, packagedir, {packagefile = packagefile}) |
|
|
|
|
else |
|
|
|
|
-- deprecated |
|
|
|
|
return package.load_from_repository(packagename, nil, packagedir, packagefile) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
-- the main entry |
|
|
|
|
function main(opt) |
|
|
|
|
local packages = {} |
|
|
|
|
for _, packagedir in ipairs(os.dirs(path.join("packages", "*", "*"))) do |
|
|
|
|
local packagename = path.filename(packagedir) |
|
|
|
|
local packagefile = path.join(packagedir, "xmake.lua") |
|
|
|
|
local instance = package.load_from_repository(packagename, nil, packagedir, {packagefile = packagefile}) |
|
|
|
|
local instance = _load_package(packagename, packagedir, packagefile) |
|
|
|
|
local basename = instance:get("base") |
|
|
|
|
if instance and basename then |
|
|
|
|
local basedir = path.join("packages", basename:sub(1, 1):lower(), basename:lower()) |
|
|
|
|
local basefile = path.join(basedir, "xmake.lua") |
|
|
|
|
instance._BASE = package.load_from_repository(basename, nil, basedir, {packagefile = basefile}) |
|
|
|
|
instance._BASE = _load_package(basename, basedir, basefile) |
|
|
|
|
end |
|
|
|
|
if instance then |
|
|
|
|
for _, plat in ipairs({"windows", "linux", "macosx", "iphoneos", "android", "mingw", "msys", "bsd", "wasm", "cross"}) do |
|
|
|
|