diff --git a/packages/l/libbpg/xmake.lua b/packages/l/libbpg/xmake.lua new file mode 100644 index 000000000..3e1d17e19 --- /dev/null +++ b/packages/l/libbpg/xmake.lua @@ -0,0 +1,40 @@ +package("libbpg") + + set_homepage("https://bellard.org/bpg/") + set_description("Image format meant to improve on JPEG quality and file size") + + add_urls("https://bellard.org/bpg/libbpg-$(version).tar.gz") + add_versions("0.9.8", "c0788e23bdf1a7d36cb4424ccb2fae4c7789ac94949563c4ad0e2569d3bf0095") + + add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true}) + + on_install("windows", "macosx", "linux", function (package) + if package:is_plat("windows") then + io.replace("libavutil/internal.h", "#pragma comment", "//", {plain = true}) + io.replace("config.h", "#define HAVE_ATOMICS_GCC 1", "#define HAVE_ATOMICS_GCC 0", {plain = true}) + io.replace("config.h", "#define HAVE_ATOMICS_WIN32 0", "#define HAVE_ATOMICS_WIN32 1", {plain = true}) + end + io.writefile("xmake.lua", [[ + add_rules("mode.debug", "mode.release") + add_requires("libpng") + target("bpg") + set_kind("static") + add_files("libbpg.c") + add_files("libavcodec/hevc_cabac.c", "libavcodec/hevc_filter.c", "libavcodec/hevc.c", "libavcodec/hevcpred.c", "libavcodec/hevc_refs.c") + add_files("libavcodec/hevcdsp.c", "libavcodec/hevc_mvs.c", "libavcodec/hevc_ps.c", "libavcodec/hevc_sei.c") + add_files("libavcodec/utils.c", "libavcodec/cabac.c", "libavcodec/golomb.c", "libavcodec/videodsp.c") + add_files("libavutil/mem.c", "libavutil/buffer.c", "libavutil/log2_tab.c", "libavutil/frame.c", "libavutil/pixdesc.c", "libavutil/md5.c") + add_includedirs(".") + add_headerfiles("libbpg.h") + add_defines("HAVE_AV_CONFIG_H", "USE_PRED", "USE_VAR_BIT_DEPTH") + on_load(function (target) + local version = io.readfile("VERSION") + target:add("defines", "CONFIG_BPG_VERSION=" .. version) + end) + ]]) + import("package.tools.xmake").install(package) + end) + + on_test(function (package) + assert(package:has_cfuncs("bpg_decoder_open", {includes = "libbpg.h"})) + end) diff --git a/packages/l/libpsl/xmake.lua b/packages/l/libpsl/xmake.lua new file mode 100644 index 000000000..ed8bba498 --- /dev/null +++ b/packages/l/libpsl/xmake.lua @@ -0,0 +1,33 @@ +package("libpsl") + + set_homepage("https://github.com/rockdaboot/libpsl") + set_description("C library to handle the Public Suffix List") + set_license("MIT") + + add_urls("https://github.com/rockdaboot/libpsl/releases/download/$(version)/libpsl-$(version).tar.gz") + add_versions("0.21.1", "ac6ce1e1fbd4d0254c4ddb9d37f1fa99dec83619c1253328155206b896210d4c") + + add_deps("meson", "ninja") + if is_plat("windows") then + add_syslinks("ws2_32") + end + on_load("windows", function (package) + if not package:config("shared") then + package:add("defines", "PSL_STATIC") + end + end) + + on_install("windows", "macosx", "linux", function (package) + io.replace("meson.build", "subdir('tests')", "", {plain = true}) + io.replace("meson.build", "subdir('fuzz')", "", {plain = true}) + if package:is_plat("windows") and not package:config("shared") then + io.replace("tools/meson.build", "'-DHAVE_CONFIG_H'", "'-DHAVE_CONFIG_H','-DPSL_STATIC'", {plain = true}) + end + local configs = {"-Druntime=no", "-Dbuiltin=no"} + table.insert(configs, "-Ddefault_library=" .. (package:config("shared") and "shared" or "static")) + import("package.tools.meson").install(package, configs) + end) + + on_test(function (package) + assert(package:has_cfuncs("psl_suffix_count", {includes = "libpsl.h"})) + end)