fast-lzma2: add package (#5274)

* fast-lzma2: add package

* improve asm build

* workaround asm build

* disable asm on macosx

* improve xmake.lua

* improve macosx build
pull/5283/head
star9029 4 months ago committed by GitHub
parent cbf724089a
commit 13462643d2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 56
      packages/f/fast-lzma2/port/xmake.lua
  2. 30
      packages/f/fast-lzma2/xmake.lua

@ -0,0 +1,56 @@
set_version("v1.0.1", {soname = "1"})
add_rules("mode.debug", "mode.release")
add_requires("xxhash")
target("fast-lzma2")
set_kind("$(kind)")
add_files("*.c")
add_headerfiles("fast-lzma2.h", "fl2_errors.h")
add_packages("xxhash")
if is_kind("shared") and is_plat("windows") then
add_defines("FL2_DLL_EXPORT")
add_defines("FL2_DLL_IMPORT", {interface = true})
end
if is_plat("linux", "bsd") then
add_syslinks("pthread")
end
on_config(function (target)
if not target:is_arch("x64", "x86_64") or is_host("bsd", "macosx") then
return
end
target:add("defines", "LZMA2_DEC_OPT")
if target:has_tool("cxx", "clang") then
target:add("deps", "asm")
else
if target:is_plat("windows") then
target:add("files", "*.asm")
target:add("asflags", "-DMS_x64_CALL=1")
else
target:add("files", "*.S")
target:add("asflags", "-DMS_x64_CALL=0")
end
end
end)
target_end()
if is_arch("x64", "x86_64") and not is_host("bsd", "macosx") then
-- workaround for clang toolchain
target("asm")
set_kind("object")
if is_plat("windows") then
add_files("*.asm")
add_asflags("-DMS_x64_CALL=1")
set_toolchains("msvc")
else
add_asflags("-DMS_x64_CALL=0")
add_files("*.S")
set_toolchains("gcc")
end
end

@ -0,0 +1,30 @@
package("fast-lzma2")
set_homepage("https://github.com/conor42/fast-lzma2")
set_description("Fast LZMA2 Library")
set_license("BSD-3-Clause")
add_urls("https://github.com/conor42/fast-lzma2/archive/refs/tags/$(version).tar.gz",
"https://github.com/conor42/fast-lzma2.git")
add_versions("v1.0.1", "60fd0a031fb0a153ba4f00799aed443ce9f149b203c59e17e558afbfafe8bf64")
if is_plat("linux", "bsd") then
add_syslinks("pthread")
end
add_deps("xxhash")
on_install(function (package)
if package:is_plat("windows") and package:config("shared") then
package:add("defines", "FL2_DLL_IMPORT")
end
os.rm("xxhash.c")
os.rm("xxhash.h")
os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua")
import("package.tools.xmake").install(package)
end)
on_test(function (package)
assert(package:has_cfuncs("FL2_compress", {includes = "fast-lzma2.h"}))
end)
Loading…
Cancel
Save