Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
fasiondog committed Jan 22, 2024
1 parent 3ebcd42 commit cb8960a
Show file tree
Hide file tree
Showing 11 changed files with 1,101 additions and 0 deletions.
32 changes: 32 additions & 0 deletions packages/h/hdf5/xmake.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package("hdf5")

set_homepage("https://www.hdfgroup.org/solutions/hdf5/")
set_description("High-performance data management and storage suite")
set_license("BSD-3-Clause")

if is_plat("windows") then
add_urls("https://github.com/fasiondog/hikyuu_extern_libs/releases/download/1.0.0/hdf5-$(version)-win-x64.zip",
"https://gitee.com/fasiondog/hikyuu_extern_libs/releases/download/1.0.0/hdf5-$(version)-win-x64.zip")
add_versions("1.12.2", "388d455c917b153f3410e8ca0c857ee37a575d859a70ecb6e16d4fb43b1d201c")
elseif is_plat("linux") and is_arch("x86_64") then
add_urls("https://github.com/fasiondog/hikyuu_extern_libs/releases/download/1.0.0/hdf5-$(version)-linux-x64.zip",
"https://gitee.com/fasiondog/hikyuu_extern_libs/releases/download/1.0.0/hdf5-$(version)-linux-x64.zip")
add_versions("1.12.2", "e0f4357ea7bfa0132c3edba9b517635736191f920ce7a3aeef5e89dbe5b2dd27")
elseif is_plat("linux", "cross") and is_arch("aarch64", "arm64.*") then
add_urls("https://github.com/fasiondog/hikyuu_extern_libs/releases/download/1.0.0/hdf5-$(version)-linux-aarch64.zip",
"https://gitee.com/fasiondog/hikyuu_extern_libs/releases/download/1.0.0/hdf5-$(version)-linux-aarch64.zip")
add_versions("1.12.2", "d73a880d9dfede0d5db1e30555fa251ca82efa437a0d93b46f5e64e87e71fc63")
end

on_load("windows", "linux", "cross", function (package)
package:add("defines", "H5_BUILT_AS_DYNAMIC_LIB")
end)

on_install("windows", "linux", "cross", function (package)
os.cp("include", package:installdir())
os.cp("lib", package:installdir())
if package:is_plat("windows") then
os.cp("bin", package:installdir())
end
end)

22 changes: 22 additions & 0 deletions packages/h/hdf5_D/xmake.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package("hdf5_D")

set_homepage("https://www.hdfgroup.org/solutions/hdf5/")
set_description("High-performance data management and storage suite")
set_license("BSD-3-Clause")

if is_plat("windows") then
add_urls("https://github.com/fasiondog/hikyuu_extern_libs/releases/download/1.0.0/hdf5_D-$(version)-win-x64.zip",
"https://gitee.com/fasiondog/hikyuu_extern_libs/releases/download/1.0.0/hdf5_D-$(version)-win-x64.zip")
add_versions("1.12.2", "6ea3ab5a4b0bb0f48eaef28cfe747ac5c072c06519a4888c1a59cfaf75399049")
end

on_load("windows", function (package)
package:add("defines", "H5_BUILT_AS_DYNAMIC_LIB")
end)

on_install("windows", function (package)
os.cp("include", package:installdir())
os.cp("lib", package:installdir())
os.cp("bin", package:installdir())
end)

27 changes: 27 additions & 0 deletions packages/m/mysql/xmake.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package("mysql")

set_homepage("https://dev.mysql.com/doc/refman/5.7/en/")
set_description("Open source relational database management system.")

if is_plat("windows") then
add_urls("https://github.com/fasiondog/hikyuu_extern_libs/releases/download/1.0.0/mysql-$(version)-win-x64.zip",
"https://gitee.com/fasiondog/hikyuu_extern_libs/releases/download/1.0.0/mysql-$(version)-win-x64.zip")
add_versions("8.0.21", "de21694aa230a00b52b28babbce9bb150d990ba1f539edf8d193586dce3844ae")
elseif is_plat("linux") and is_arch("x86_64") then
add_urls("https://github.com/fasiondog/hikyuu_extern_libs/releases/download/1.0.0/mysql-$(version)-linux-x86_64.zip",
"https://gitee.com/fasiondog/hikyuu_extern_libs/releases/download/1.0.0/mysql-$(version)-linux-x86_64.zip")
add_versions("8.0.31", "07268a4b02174dfb8ee30642cd6fd81a0115ed87560a51a42e7123eed0be5ad1")
elseif is_plat("linux", "cross") and is_arch("aarch64", "arm64.*") then
add_urls("https://github.com/fasiondog/hikyuu_extern_libs/releases/download/1.0.0/mysql-$(version)-linux-aarch64.zip",
"https://gitee.com/fasiondog/hikyuu_extern_libs/releases/download/1.0.0/mysql-$(version)-linux-aarch64.zip")
add_versions("8.0.21", "385a7e280f86aa864f02ae7061c940a20f1ace358f906d330453992331b638c8")
end

on_install("windows", "linux", "cross", function (package)
os.cp("include", package:installdir())
os.cp("lib", package:installdir())
if package:is_plat("windows") then
os.cp("bin", package:installdir())
end
end)

26 changes: 26 additions & 0 deletions packages/p/pybind11/xmake.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package("pybind11")

set_kind("library", {headeronly = true})
set_homepage("https://github.com/pybind/pybind11")
set_description("Seamless operability between C++11 and Python.")
set_license("BSD-3-Clause")

add_urls("https://github.com/pybind/pybind11/archive/$(version).zip",
"https://github.com/pybind/pybind11.git")
add_versions("v2.11.1", "b011a730c8845bfc265f0f81ee4e5e9e1d354df390836d2a25880e123d021f89")

on_install(function (package)
os.cp("include", package:installdir())
end)

-- on_test(function (package)
-- assert(package:check_cxxsnippets({test = [[
-- #include <pybind11/pybind11.h>
-- int add(int i, int j) {
-- return i + j;
-- }
-- PYBIND11_MODULE(example, m) {
-- m.def("add", &add, "A function which adds two numbers");
-- }
-- ]]}, {configs = {languages = "c++11"}}))
-- end)
168 changes: 168 additions & 0 deletions scripts/build_artifacts.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
import("core.package.package")
import("core.base.semver")
import("core.base.hashset")
import("packages", {alias = "packages_util"})

-- 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

function _build_artifacts(name, versions)
local buildinfo = {name = name, versions = versions}
print(buildinfo)
os.tryrm("build-artifacts")
os.exec("git clone [email protected]:xmake-mirror/build-artifacts.git -b build")
local oldir = os.cd("build-artifacts")
local trycount = 0
while trycount < 2 do
local ok = try
{
function ()
io.save("build.txt", buildinfo)
os.exec("git add -A")
os.exec("git commit -a -m \"autobuild %s by xmake-repo/ci\"", name)
os.exec("git push origin build")
return true
end,
catch
{
function ()
os.exec("git reset --hard HEAD^")
os.exec("git pull origin build")
end
}
}
if ok then
break
end
trycount = trycount + 1
end
assert(trycount < 2)
os.cd(oldir)
end

function _get_latest_modified_packages()
print("find latest modified packages ..")
local instances = {}
local files = os.iorun("git diff --name-only HEAD^")
for _, file in ipairs(files:split('\n')) do
file = file:trim()
if file:find("packages", 1, true) and path.filename(file) == "xmake.lua" then
assert(file == file:lower(), "%s must be lower case!", file)
local packagedir = path.directory(file)
local packagename = path.filename(packagedir)
if #path.filename(path.directory(packagedir)) == 1 then
local instance = _load_package(packagename, packagedir, file)
if instance and packages_util.is_supported(instance, "windows")
and (instance.is_headeronly and not instance:is_headeronly()) then
table.insert(instances, instance)
print(" > %s", instance:name())
end
end
end
end
print("%d found", #instances)
return instances
end

function _get_all_packages()
local packages = _g.packages
if not packages then
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 and packages_util.is_supported(instance, "windows")
and (instance.is_headeronly and not instance:is_headeronly()) then
table.insert(packages, instance)
end
end
_g.packages = packages
end
return packages
end

function _get_packagerefs_of(instance)
local packagerefs = {}
if instance:is_library() then
local packages = _get_all_packages()
for _, packageref in ipairs(packages) do
local deps = packageref:get("deps")
if deps and table.contains(table.wrap(deps), instance:name()) then
table.insert(packagerefs, packageref)
end
end
end
return packagerefs
end

function _get_packagerefs_in_latest_24h()
print("find packagerefs in latest 24h ..")
local instances = {}
local list = os.iorun("git log --since=\"24 hours ago\" --oneline")
local lines = list:split('\n')
if #lines > 0 then
local line = lines[#lines]
local commit = line:split(" ")[1]
if commit and #commit == 8 then
local files = os.iorun("git diff --name-only " .. commit .. "^")
for _, file in ipairs(files:split('\n')) do
file = file:trim()
if file:find("packages", 1, true) and path.filename(file) == "xmake.lua" then
assert(file == file:lower(), "%s must be lower case!", file)
local packagedir = path.directory(file)
local packagename = path.filename(packagedir)
if #path.filename(path.directory(packagedir)) == 1 then
local instance = _load_package(packagename, packagedir, file)
if instance and packages_util.is_supported(instance, "windows")
and (instance.is_headeronly and not instance:is_headeronly()) then
table.insert(instances, instance)
end
end
end
end
end
end
local packagerefs = hashset.new()
for _, instance in ipairs(instances) do
print("%s: ", instance:name())
for _, packageref in ipairs(_get_packagerefs_of(instance)) do
packagerefs:insert(packageref)
print(" -> %s", packageref:name())
end
end
local result = {}
for _, packageref in packagerefs:keys() do
if #result < 24 then
table.insert(result, packageref)
end
end
print("%d found", #result)
return result
end

function main(updaterefs)
local instances = updaterefs and _get_packagerefs_in_latest_24h() or _get_latest_modified_packages()
for _, instance in ipairs(instances) do
local versions = instance:versions()
if versions and #versions > 0 then
table.sort(versions, function (a, b) return semver.compare(a, b) > 0 end)
local version_latest = versions[1]
_build_artifacts(instance:name(), table.wrap(version_latest))
end
end
end
14 changes: 14 additions & 0 deletions scripts/list.lua
Original file line number Diff line number Diff line change
@@ -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
Loading

0 comments on commit cb8960a

Please sign in to comment.