Compare commits

...

32 Commits

Author SHA1 Message Date
028517dd50 add analyzersdk package 2025-09-07 11:04:21 +02:00
548222e930 update splib to v2.3.2 2025-08-21 18:57:12 +00:00
722565d935 refactor splib 2025-08-12 11:26:30 +02:00
86d4a525d7 update splib to v2.2.2 2025-08-04 07:48:45 +00:00
426dcb4f3d update splib to v2.2.1 2025-08-03 18:37:23 +00:00
4d0a7b8f1d fix splib version 2025-08-01 11:22:01 +00:00
8fd025d6ee update splib to v2.2.0 2025-08-01 10:47:08 +00:00
4963ee701e fix typo 2025-07-31 15:58:51 +00:00
662db0c0ad add v2.1.0 splib 2025-07-31 15:57:45 +00:00
1ca8105ad1 splib: fix versionning 2025-07-31 13:06:01 +00:00
d317ef5b5f splib add v2.0.2 2025-07-31 13:04:41 +00:00
0a8a565077 splib add v2.0.1 2025-07-31 12:15:31 +00:00
827b6e960d Real v2.0.0 splib 2025-07-29 12:57:32 +00:00
c4d2dbb976 Update packages/s/splib/xmake.lua 2025-07-18 15:28:46 +00:00
f2003faa09 change splib version 2025-07-18 14:46:02 +00:00
59df1e4984 Updaet splib version 2025-07-18 14:23:37 +00:00
6f0b176838 fix splib deps 2025-07-10 13:39:02 +00:00
a985595e64 splib add boost dep 2025-07-10 13:36:24 +00:00
bf329eb34c remove splib tests 2025-07-10 13:22:55 +00:00
a1e81ace5e fix splib version 2025-07-10 13:21:14 +00:00
fe27bfe039 add v2.0 splib 2025-07-10 13:18:47 +00:00
13263bac0e update splib to v1.0.4 2025-03-04 22:48:35 +01:00
7323241cb7 update splib to v1.0.3 2025-03-03 11:10:04 +01:00
9d95ee8377 Update packages/s/splib/xmake.lua 2025-02-23 20:59:55 +00:00
c4677cf829 update splib to v1.0.2 2025-02-23 13:21:45 +01:00
3d89a5c7e3 update splib to v1.0.1 2025-02-23 11:29:36 +01:00
7053db117d update README 2025-02-23 10:45:51 +01:00
e8c582a69f update splib version 2025-02-23 10:45:44 +01:00
57972dbcc5 add gitignore 2025-02-22 22:57:54 +01:00
c93977c0fd remove useless line 2025-02-22 22:56:45 +01:00
71a1678e50 add scripts 2025-02-22 22:55:15 +01:00
2565edced7 add splib (unfinished) 2025-02-22 22:55:07 +01:00
7 changed files with 518 additions and 1 deletions

5
.gitignore vendored Normal file
View File

@@ -0,0 +1,5 @@
**/bin
**/include
**/lib
**/manifest.txt
**/references.txt

View File

@@ -1,3 +1,9 @@
# xmake-repo
Contains various unofficial packages
Contains various unofficial packages
# Test
```sh
xmake l scripts/test.lua --shallow -vD
```

View File

@@ -0,0 +1,22 @@
package("analyzersdk")
set_homepage("https://github.com/saleae/AnalyzerSDK")
set_description("Logic 1 & Logic 2 Analyzer SDK")
add_urls("https://github.com/saleae/AnalyzerSDK.git")
add_versions("2023.07.07", "114a3b8306e6a5008453546eda003db15b002027")
on_install("linux", "windows", "macosx", function (package)
local baseLibPath = "lib_x86_64"
if is_arch("arm64") then
baseLibPath = "lib_arm64"
end
if is_plat("linux") then
os.cp(path.join(baseLibPath, "libAnalyzer.so"), package:installdir("lib"))
elseif is_plat("macosx") then
os.cp(path.join(baseLibPath, "libAnalyzer.dylib"), package:installdir("lib"))
else
os.cp(path.join(baseLibPath, "Analyzer.dll"), package:installdir("bin"))
os.cp(path.join(baseLibPath, "Analyzer.lib"), package:installdir("lib"))
end
os.cp("include/*", package:installdir("include"))
end)

View File

@@ -0,0 +1,43 @@
package("splib")
set_description("The splib package")
add_urls("https://git.ale-pri.com/Persson-dev/Simple-Protocol-Lib.git")
add_versions("v2.3.2", "14d7f045cea80f1b987bd6952438ea4c8412d924")
add_versions("v2.3.1", "a60f56e248e05dde07132889d08634702ff3835d")
add_versions("v2.3.0", "75bae99daa8c31ffb6ffaf62b5d7327125a71085")
add_versions("v2.2.2", "90ae25bc8ed6001d77c66957fc90a9ff175ac125")
add_versions("v2.2.1", "0c82680af02aab6fad1f339fdf1d62083bc3a2bf")
add_versions("v2.2.0", "7eb96163ab104e353a928c48f9052a6d3fa5da18")
add_versions("v2.1.0", "9374332cd2846d4e6bdab45760ac25ebd2cc4229")
add_versions("v2.0.2", "bce37f59df17c2381057086e581b214b2d165c41")
add_versions("v2.0.1", "a1a41768016dc9dfac0ddc1122eaf06d2f9ebce5")
add_versions("v2.0.0", "5e9a0a9bae5bde24b6781d7096cdda6721b15a93")
add_versions("v1.0.4", "77356ce7497dffc382d113a73b5c2e047e76a189")
add_versions("v1.0.3", "4a7eb7a1df3076529332c1f0d0cfb4b862f47b3d")
add_versions("v1.0.2", "2acbd76c5a08b2400e64f1e507e62c9bd150392d")
add_versions("v1.0.1", "f145716cf6ed6c863dd5267e525842e8970833de")
add_versions("v1.0.0", "db0c5f324570bfa071e182537b9a96664770446a")
add_configs("shared", {description = "Build shared library.", default = false, type = "boolean"})
on_load(function (package)
if package:version():ge("2.0.0") then
package:add("deps", "boost_pfr")
end
package:set("installdir", path.join(os.scriptdir(), package:plat(), package:arch(), package:mode()))
end)
on_install(function (package)
import("package.tools.xmake").install(package)
end)
on_fetch(function (package)
local result = {}
local libfiledir = (package:config("shared") and package:is_plat("windows", "mingw")) and "bin" or "lib"
result.links = "SimpleProtocolLib"
result.linkdirs = package:installdir("lib")
result.includedirs = package:installdir("include")
return result
end)

14
scripts/list.lua Normal file
View File

@@ -0,0 +1,14 @@
import("packages")
function main(...)
for plat, pkgs in pairs(packages()) do
cprint("${magenta}%s${clear}:", plat)
for _, pkg in ipairs(pkgs) do
if pkg.generic then
cprint(" ${yellow}->${clear} %s", pkg.name)
else
cprint(" ${yellow}->${clear} %s (%s)", pkg.name, table.concat(pkg.archs, ", "))
end
end
end
end

71
scripts/packages.lua Normal file
View File

@@ -0,0 +1,71 @@
-- imports
import("core.package.package")
import("core.platform.platform")
import("private.core.base.select_script")
-- is supported platform and architecture?
function is_supported(instance, plat, arch, opt)
opt = opt or {}
if instance:is_template() then
return false
end
local script = instance:get(instance:is_fetchonly() and "fetch" or "install")
if not select_script(script, {plat = plat, arch = arch}) then
if opt.native and select_script(script, {
plat = plat, arch = arch, subhost = plat, subarch = arch}) then
return true
end
return false
end
return true
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)
opt = opt or {}
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 = _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 = _load_package(basename, basedir, basefile)
end
if instance then
for _, plat in ipairs({"windows", "linux", "macosx", "iphoneos", "android", "mingw", "msys", "bsd", "wasm", "cross"}) do
local archs = platform.archs(plat)
if archs then
local package_archs = {}
for _, arch in ipairs(archs) do
if is_supported(instance, plat, arch, opt) then
table.insert(package_archs, arch)
end
end
if #package_archs > 0 then
packages[plat] = packages[plat] or {}
table.insert(packages[plat], {name = instance:name(), instance = instance, archs = package_archs, generic = #package_archs == #archs})
end
end
end
end
end
for _, packages_plat in pairs(packages) do
table.sort(packages_plat, function(a, b) return a.name < b.name end)
end
return packages
end

356
scripts/test.lua Normal file
View File

@@ -0,0 +1,356 @@
-- imports
import("core.base.option")
import("core.platform.platform")
import("core.package.package", {alias = "core_package"})
import("packages", {alias = "get_packages"})
-- the options
local options =
{
{'v', "verbose", "k", nil, "Enable verbose information." }
, {'D', "diagnosis", "k", nil, "Enable diagnosis information." }
, {nil, "shallow", "k", nil, "Only install the root packages." }
, {'k', "kind", "kv", nil, "Enable static/shared library." }
, {'p', "plat", "kv", nil, "Set the given platform." }
, {'a', "arch", "kv", nil, "Set the given architecture." }
, {'m', "mode", "kv", nil, "Set the given mode." }
, {'j', "jobs", "kv", nil, "Set the build jobs." }
, {'f', "configs", "kv", nil, "Set the configs." }
, {'d', "debugdir", "kv", nil, "Set the debug source directory." }
, {nil, "policies", "kv", nil, "Set the policies." }
, {nil, "fetch", "k", nil, "Fetch package only." }
, {nil, "precompiled", "k", nil, "Attemp to install the precompiled package." }
, {nil, "remote", "k", nil, "Test package on the remote server." }
, {nil, "linkjobs", "kv", nil, "Set the link jobs." }
, {nil, "cflags", "kv", nil, "Set the cflags." }
, {nil, "cxxflags", "kv", nil, "Set the cxxflags." }
, {nil, "ldflags", "kv", nil, "Set the ldflags." }
, {nil, "ndk", "kv", nil, "Set the Android NDK directory." }
, {nil, "ndk_sdkver", "kv", nil, "Set the Android NDK platform sdk version." }
, {nil, "sdk", "kv", nil, "Set the SDK directory of cross toolchain." }
, {nil, "vs", "kv", nil, "Set the VS Compiler version." }
, {nil, "vs_sdkver", "kv", nil, "Set the Windows SDK version." }
, {nil, "vs_toolset", "kv", nil, "Set the Windows Toolset version." }
, {nil, "vs_runtime", "kv", nil, "Set the VS Runtime library (deprecated)." }
, {nil, "runtimes", "kv", nil, "Set the Runtime libraries." }
, {nil, "xcode_sdkver", "kv", nil, "The SDK Version for Xcode" }
, {nil, "target_minver", "kv", nil, "The Target Minimal Version" }
, {nil, "appledev", "kv", nil, "The Apple Device Type" }
, {nil, "mingw", "kv", nil, "Set the MingW directory." }
, {nil, "toolchain", "kv", nil, "Set the toolchain name." }
, {nil, "toolchain_host", "kv", nil, "Set the host toolchain name." }
, {nil, "packages", "vs", nil, "The package list." }
}
-- check package is supported?
function _check_package_is_supported()
for _, names in pairs(core_package.apis()) do
for _, name in ipairs(names) do
if type(name) == "string" and name == "package.on_check" then
return true
end
end
end
end
-- config packages
function _config_packages(argv, packages)
local config_argv = {"f", "-c"}
if argv.verbose then
table.insert(config_argv, "-v")
end
if argv.diagnosis then
table.insert(config_argv, "-D")
end
if argv.plat then
table.insert(config_argv, "--plat=" .. argv.plat)
end
if argv.arch then
table.insert(config_argv, "--arch=" .. argv.arch)
end
if argv.mode then
table.insert(config_argv, "--mode=" .. argv.mode)
end
if argv.policies then
table.insert(config_argv, "--policies=" .. argv.policies)
end
if argv.ndk then
table.insert(config_argv, "--ndk=" .. argv.ndk)
end
if argv.sdk then
table.insert(config_argv, "--sdk=" .. argv.sdk)
end
if argv.ndk_sdkver then
table.insert(config_argv, "--ndk_sdkver=" .. argv.ndk_sdkver)
end
if argv.vs then
table.insert(config_argv, "--vs=" .. argv.vs)
end
if argv.vs_sdkver then
table.insert(config_argv, "--vs_sdkver=" .. argv.vs_sdkver)
end
if argv.vs_toolset then
table.insert(config_argv, "--vs_toolset=" .. argv.vs_toolset)
end
local runtimes = argv.runtimes or argv.vs_runtime
if runtimes then
if is_host("windows") then
table.insert(config_argv, "--vs_runtime=" .. runtimes)
else
table.insert(config_argv, "--runtimes=" .. runtimes)
end
end
if argv.xcode_sdkver then
table.insert(config_argv, "--xcode_sdkver=" .. argv.xcode_sdkver)
end
if argv.target_minver then
table.insert(config_argv, "--target_minver=" .. argv.target_minver)
end
if argv.appledev then
table.insert(config_argv, "--appledev=" .. argv.appledev)
end
if argv.mingw then
table.insert(config_argv, "--mingw=" .. argv.mingw)
end
if argv.toolchain then
table.insert(config_argv, "--toolchain=" .. argv.toolchain)
end
if argv.toolchain_host then
table.insert(config_argv, "--toolchain_host=" .. argv.toolchain_host)
end
if argv.cflags then
table.insert(config_argv, "--cflags=" .. argv.cflags)
end
if argv.cxxflags then
table.insert(config_argv, "--cxxflags=" .. argv.cxxflags)
end
if argv.ldflags then
table.insert(config_argv, "--ldflags=" .. argv.ldflags)
end
os.vexecv(os.programfile(), config_argv)
end
-- get extra string
function _get_extra_str(argv)
local extra = {}
if argv.mode == "debug" then
extra.debug = true
end
-- Some packages set shared=true as default, so we need to force set
-- shared=false to test static build.
extra.configs = extra.configs or {}
extra.configs.shared = argv.kind == "shared"
local configs = argv.configs
if configs then
extra.system = false
extra.configs = extra.configs or {}
local extra_configs, errors = ("{" .. configs .. "}"):deserialize()
if extra_configs then
table.join2(extra.configs, extra_configs)
else
raise(errors)
end
end
return string.serialize(extra, {indent = false, strip = true})
end
-- load packages
function _load_packages(argv, packages)
_config_packages(argv, packages)
local info_argv = {"require", "-f", "-y", "--info"}
if argv.verbose then
table.insert(info_argv, "-v")
end
if argv.diagnosis then
table.insert(info_argv, "-D")
end
local extra_str = _get_extra_str(argv)
table.insert(info_argv, "--extra=" .. extra_str)
-- call `xrepo info` to test on_load
if #packages > 0 then
print("testing to load packages ...")
print(" > if it causes errors, please remove assert/raise() to on_check.")
os.vexecv(os.programfile(), table.join(info_argv, packages))
end
end
-- require packages
function _require_packages(argv, packages)
_config_packages(argv, packages)
local require_argv = {"require", "-f", "-y"}
local check_argv = {"require", "-f", "-y", "--check"}
if not argv.precompiled then
table.insert(require_argv, "--build")
end
if argv.verbose then
table.insert(require_argv, "-v")
table.insert(check_argv, "-v")
end
if argv.diagnosis then
table.insert(require_argv, "-D")
table.insert(check_argv, "-D")
end
local is_debug = false
if argv.debugdir then
is_debug = true
table.insert(require_argv, "--debugdir=" .. argv.debugdir)
end
if argv.shallow or is_debug then
table.insert(require_argv, "--shallow")
end
if argv.jobs then
table.insert(require_argv, "--jobs=" .. argv.jobs)
end
if argv.linkjobs then
table.insert(require_argv, "--linkjobs=" .. argv.linkjobs)
end
if argv.fetch then
table.insert(require_argv, "--fetch")
end
local extra_str = _get_extra_str(argv)
table.insert(require_argv, "--extra=" .. extra_str)
table.insert(check_argv, "--extra=" .. extra_str)
-- test on_check
local install_packages = {}
if _check_package_is_supported() then
print("testing to check packages ...")
for _, package in ipairs(packages) do
local ok = os.vexecv(os.programfile(), table.join(check_argv, package), {try = true})
if ok == 0 then
table.insert(install_packages, package)
end
end
else
install_packages = packages
end
-- test installation
if #install_packages > 0 then
print("testing to install packages ...")
os.vexecv(os.programfile(), table.join(require_argv, install_packages))
else
print("no testable packages on %s or you're using lower version xmake!", argv.plat or os.subhost())
end
end
-- the given package is supported?
function _package_is_supported(argv, packagename)
local packages = get_packages()
if packages then
local plat = argv.plat or os.subhost()
local packages_plat = packages[plat]
for _, package in ipairs(packages_plat) do
if package and packagename:split("%s+")[1] == package.name then
local arch = argv.arch
if not arch and plat ~= os.subhost() then
arch = table.wrap(platform.archs(plat))[1]
end
if not arch then
arch = os.subarch()
end
for _, package_arch in ipairs(package.archs) do
print(package_arch, package.archs)
if arch == package_arch then
return true
end
end
end
end
end
end
function get_modified_packages()
local packages = {}
local diff = os.iorun("git --no-pager diff HEAD^")
for _, line in ipairs(diff:split("\n")) do
if line:startswith("+++ b/") then
local file = line:sub(7)
if file:startswith("packages") then
assert(file == file:lower(), "%s must be lower case!", file)
local package = file:match("packages/%w/(%S-)/")
table.insert(packages, package)
end
elseif line:startswith("+") and line:find("add_versions") then
local version = line:match("add_versions%(\"(.-)\"")
if version:find(":", 1, true) then
version = version:split(":")[2]
end
if #packages > 0 and version then
local lastpackage = packages[#packages]
local splitinfo = lastpackage:split("%s+")
table.insert(packages, splitinfo[1] .. " " .. version)
end
end
end
return table.unique(packages)
end
-- the main entry
function main(...)
-- parse arguments
local argv = option.parse({...}, options, "Test all the given or changed packages.")
-- get packages
local packages = argv.packages or {}
if #packages == 0 then
packages = get_modified_packages()
end
if #packages == 0 then
table.insert(packages, "tbox dev")
end
-- prepare test project
local repodir = os.curdir()
local workdir = path.join(os.tmpdir(), "xmake-repo")
print(packages)
os.setenv("XMAKE_STATS", "false")
if not os.isfile(path.join(workdir, "test", "xmake.lua")) then
os.tryrm(workdir)
os.mkdir(workdir)
os.cd(workdir)
os.execv(os.programfile(), {"create", "test"})
else
os.cd(workdir)
end
os.cd("test")
print(os.curdir())
-- do action for remote?
if os.isdir("xmake-repo") then
os.execv(os.programfile(), {"service", "--disconnect"})
end
if argv.remote then
os.tryrm("xmake-repo")
os.cp(path.join(repodir, "packages"), "xmake-repo/packages")
os.execv(os.programfile(), {"service", "--connect"})
repodir = "xmake-repo"
end
os.execv(os.programfile(), {"repo", "--add", "local-repo", repodir})
os.execv(os.programfile(), {"repo", "-l"})
local packages_original = table.clone(packages)
-- load packages
_load_packages(argv, packages_original)
local old_dir = os.cd(repodir)
-- remove unsupported packages
for idx, package in irpairs(packages) do
assert(package == package:lower(), "package(%s) must be lower case!", package)
if not _package_is_supported(argv, package) then
table.remove(packages, idx)
end
end
os.cd(old_dir)
-- no unsupported packages
if #packages == 0 then
print("no testable packages on %s!", argv.plat or os.subhost())
return
end
-- require packages
_require_packages(argv, packages)
end