add ptl and libcroco (#680)
* add ptl * add libcroco * improve lz4 and zstd * update tbbpull/681/head
parent
58f9aaa429
commit
f94431e768
6 changed files with 154 additions and 15 deletions
@ -0,0 +1,71 @@ |
||||
set_project("libcroco") |
||||
add_rules("mode.debug", "mode.release") |
||||
|
||||
add_requires("glib", "libxml2") |
||||
|
||||
option("installprefix") |
||||
set_default("") |
||||
set_showmenu(true) |
||||
option_end() |
||||
if has_config("installprefix") then |
||||
local prefix = get_config("installprefix") |
||||
set_configvar("prefix", prefix) |
||||
set_configvar("CROCO_CFLAGS", "-I" .. prefix .. "/include") |
||||
set_configvar("CROCO_LIBS", "-L" .. prefix .. "/lib -lglib-2.0 -pthread -lm -lpcre -lxml2") |
||||
end |
||||
set_configvar("exec_prefix", "${prefix}") |
||||
set_configvar("libdir", "${exec_prefix}/lib") |
||||
set_configvar("includedir", "${prefix}/include") |
||||
set_configvar("GLIB2_CFLAGS", "") |
||||
set_configvar("GLIB2_LIBS", "") |
||||
set_configvar("LIBXML2_CFLAGS", "") |
||||
set_configvar("LIBXML2_LIBS", "") |
||||
|
||||
local mver = "" |
||||
local major_ver = "" |
||||
local minor_ver = "" |
||||
option("vers") |
||||
set_default("") |
||||
set_showmenu(true) |
||||
option_end() |
||||
if has_config("vers") then |
||||
set_version(get_config("vers")) |
||||
set_configvar("VERSION", get_config("vers")) |
||||
set_configvar("LIBCROCO_VERSION", get_config("vers")) |
||||
set_configvar("LIBCROCO_VERSION_NUMBER", get_config("vers")) |
||||
local spvers = get_config("vers"):split("%.") |
||||
major_ver = spvers[1] or "" |
||||
minor_ver = spvers[2] or "" |
||||
mver = major_ver .. "." .. minor_ver |
||||
set_configvar("LIBCROCO_MAJOR_VERSION", major_ver) |
||||
set_configvar("LIBCROCO_MINOR_VERSION", minor_ver) |
||||
end |
||||
|
||||
set_configvar("G_DISABLE_CHECKS", 0) |
||||
|
||||
target("croco") |
||||
set_basename("croco-" .. mver) |
||||
set_kind("$(kind)") |
||||
add_files("src/*.c") |
||||
add_includedirs("src", {public = true}) |
||||
add_packages("glib", "libxml2", {public = true}) |
||||
set_configdir("src") |
||||
add_configfiles("src/libcroco-config.h.in", {pattern = "@(.-)@"}) |
||||
add_headerfiles("src/*.h", {prefixdir = "libcroco-" .. mver .. "/libcroco"}) |
||||
target_end() |
||||
|
||||
target("csslint") |
||||
set_basename("csslint-" .. mver) |
||||
set_kind("binary") |
||||
add_deps("croco") |
||||
add_files("csslint/csslint.c") |
||||
set_configdir(".") |
||||
if not is_plat("windows") then |
||||
add_configfiles("croco-config.in", {pattern = "@(.-)@"}) |
||||
add_configfiles("libcroco.pc.in", {pattern = "@(.-)@"}) |
||||
after_install(function (target) |
||||
os.cp("croco-config", path.join(target:installdir(), "bin", "croco-" .. mver .. "-config")) |
||||
os.cp("libcroco.pc", path.join(target:installdir(), "lib", "pkgconfig", "libcroco-" .. mver .. ".pc")) |
||||
end) |
||||
end |
||||
target_end() |
@ -0,0 +1,33 @@ |
||||
package("libcroco") |
||||
|
||||
set_homepage("https://gitlab.com/inkscape/libcroco") |
||||
set_description("Libcroco is a standalone css2 parsing and manipulation library.") |
||||
set_license("LGPL-2.0") |
||||
|
||||
add_urls("https://download.gnome.org/sources/libcroco/$(version).tar.xz", {version = function (version) |
||||
return format("%d.%d/libcroco-%s", version:major(), version:minor(), version) |
||||
end}) |
||||
add_versions("0.6.13", "767ec234ae7aa684695b3a735548224888132e063f92db585759b422570621d4") |
||||
|
||||
if is_plat("windows") then |
||||
add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true}) |
||||
end |
||||
|
||||
add_deps("glib", "libxml2") |
||||
on_load("windows", "macosx", "linux", function (package) |
||||
local ver = package:version() |
||||
package:add("includedirs", format("include/libcroco-%d.%d", ver:major(), ver:minor())) |
||||
end) |
||||
|
||||
on_install("windows", "macosx", "linux", function (package) |
||||
os.cp(path.join(os.scriptdir(), "port", "xmake.lua"), "xmake.lua") |
||||
io.replace("src/cr-rgb.c", "#include \"config.h\"", "", {plain = true}) |
||||
import("package.tools.xmake").install(package, { |
||||
installprefix = package:installdir():gsub("\\", "\\\\"), |
||||
vers = package:version_str() |
||||
}) |
||||
end) |
||||
|
||||
on_test(function (package) |
||||
assert(package:has_cfuncs("cr_utils_is_newline", {includes = "libcroco/libcroco.h"})) |
||||
end) |
@ -0,0 +1,43 @@ |
||||
package("ptl") |
||||
|
||||
set_homepage("https://github.com/jrmadsen/PTL") |
||||
set_description("Lightweight C++11 multithreading tasking system featuring thread-pool, task-groups, and lock-free task queue") |
||||
set_license("MIT") |
||||
|
||||
add_urls("https://github.com/jrmadsen/PTL/archive/refs/tags/$(version).tar.gz", |
||||
"https://github.com/jrmadsen/PTL.git") |
||||
add_versions("v2.0.0", "58e561a3a1de75679faf4d8760d2ff045ced232d4367157b5b4e4f26c8474721") |
||||
|
||||
add_configs("tbb", {description = "Enable TBB support.", default = false, type = "boolean"}) |
||||
|
||||
add_deps("cmake") |
||||
if is_plat("linux") then |
||||
add_syslinks("pthread") |
||||
end |
||||
on_load("windows", "macosx", "linux", function (package) |
||||
if package:config("tbb") then |
||||
package:add("deps", "tbb") |
||||
end |
||||
end) |
||||
|
||||
on_install("windows", "macosx", "linux", function (package) |
||||
io.replace("cmake/Templates/PTLConfig.cmake.in", "if(WIN32)", "if(FALSE)", {plain = true}) |
||||
local configs = {} |
||||
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release")) |
||||
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF")) |
||||
table.insert(configs, "-DBUILD_STATIC_LIBS=" .. (package:config("shared") and "OFF" or "ON")) |
||||
table.insert(configs, "-DPTL_USE_TBB=" .. (package:config("tbb") and "ON" or "OFF")) |
||||
import("package.tools.cmake").install(package, configs) |
||||
end) |
||||
|
||||
on_test(function (package) |
||||
assert(package:check_cxxsnippets({test = [[ |
||||
#include <PTL/ThreadPool.hh> |
||||
#include <PTL/TaskGroup.hh> |
||||
void test() { |
||||
PTL::ThreadPool tp(4); |
||||
auto join = [](long& lhs, long rhs) { return lhs += rhs; }; |
||||
PTL::TaskGroup<long> foo(join, &tp); |
||||
} |
||||
]]}, {configs = {languages = "c++11"}})) |
||||
end) |
Loading…
Reference in new issue