star9029 преди 1 година
родител
ревизия
3ef1c04fd6
променени са 3 файла, в които са добавени 130 реда и са изтрити 0 реда
  1. 24 0
      packages/i/isa-l/port/isa-l.h.in
  2. 58 0
      packages/i/isa-l/port/xmake.lua
  3. 48 0
      packages/i/isa-l/xmake.lua

+ 24 - 0
packages/i/isa-l/port/isa-l.h.in

@@ -0,0 +1,24 @@
+/**
+* @file isa-l.h
+* @brief Include for ISA-L library
+*/
+
+#ifndef _ISAL_H_
+#define _ISAL_H_
+
+#define ISAL_MAJOR_VERSION ${VERSION_MAJOR}
+#define ISAL_MINOR_VERSION ${VERSION_MINOR}
+#define ISAL_PATCH_VERSION ${VERSION_ALTER}
+#define ISAL_MAKE_VERSION(maj, min, patch) ((maj) * 0x10000 + (min) * 0x100 + (patch))
+#define ISAL_VERSION ISAL_MAKE_VERSION(ISAL_MAJOR_VERSION, ISAL_MINOR_VERSION, ISAL_PATCH_VERSION)
+
+#ifndef RC_INVOKED
+#include <isa-l/crc.h>
+#include <isa-l/crc64.h>
+#include <isa-l/erasure_code.h>
+#include <isa-l/gf_vect_mul.h>
+#include <isa-l/igzip_lib.h>
+#include <isa-l/mem_routines.h>
+#include <isa-l/raid.h>
+#endif // RC_INVOKED
+#endif //_ISAL_H_

+ 58 - 0
packages/i/isa-l/port/xmake.lua

@@ -0,0 +1,58 @@
+option("version", {default = "2.31.0"})
+
+set_version(get_config("version"))
+
+add_rules("mode.debug", "mode.release")
+
+add_requires("nasm")
+set_toolchains("nasm")
+
+target("isa-l")
+    set_kind("$(kind)")
+
+    for _, dir in ipairs({"erasure_code", "raid", "crc", "igzip", "mem"}) do
+        add_files(path.join(dir, "*.c"))
+        add_includedirs(dir)
+        if is_plat("windows", "mingw") then
+            add_files(path.join(dir, "*.asm"))
+        else
+            add_files(path.join(dir, "*.S"))
+        end
+
+        if (not is_plat("windows", "mingw")) and is_arch("arm64.*") then
+            add_files(path.join(dir, "aarch64", "*.c"))
+            add_files(path.join(dir, "aarch64", "*.S"))
+        end
+
+        remove_files(
+            path.join(dir, "*_test.c"),
+            path.join(dir, "*_perf.c"),
+            path.join(dir, "*_example.c")
+        )
+        if is_plat("windows", "mingw") then
+            remove_files(path.join(dir, "data_struct2.asm"))
+            remove_files(path.join(dir, "stdmac.asm"))
+            remove_files(path.join(dir, "igzip_decode_block_stateless.asm"))
+            remove_files(path.join(dir, "igzip_update_histogram.asm"))
+            remove_files(path.join(dir, "inflate_data_structs.asm"))
+            if is_arch("x64", "x86_64") then
+                remove_files(path.join(dir, "*i32.asm"))
+            end
+        end
+    end
+
+    if is_plat("windows", "mingw") then
+        add_defines("_USE_MATH_DEFINES")
+        add_asflags("-DHAVE_AS_KNOWS_AVX512", "-DAS_FEATURE_LEVEL=10", {force = true})
+    end
+
+    add_includedirs("include")
+    add_headerfiles("include/*.h", {prefixdir = "isa-l"})
+
+    set_configdir(os.projectdir())
+    add_configfiles("isa-l.h.in")
+    add_headerfiles("isa-l.h", {prefixdir = "isa-l"})
+
+    if is_plat("windows", "mingw") and is_kind("shared") then
+        add_files("isa-l.def", "isa-l.rc")
+    end

+ 48 - 0
packages/i/isa-l/xmake.lua

@@ -0,0 +1,48 @@
+package("isa-l")
+    set_homepage("https://github.com/intel/isa-l")
+    set_description("Intelligent Storage Acceleration Library")
+    set_license("BSD-3-Clause")
+
+    add_urls("https://github.com/intel/isa-l/archive/refs/tags/$(version).tar.gz",
+             "https://github.com/intel/isa-l.git")
+
+    add_versions("v2.31.0", "e218b7b2e241cfb8e8b68f54a6e5eed80968cc387c4b1af03708b54e9fb236f1")
+
+    if is_subhost("msys", "cygwin") or (not is_plat("windows", "mingw")) then
+        add_deps("autoconf", "automake", "libtool")
+    end
+    add_deps("nasm")
+
+    on_install(function (package)
+        if is_plat("windows") then
+            local runenvs = import("package.tools.nmake").buildenvs(package)
+            local nmake = import("lib.detect.find_tool")("nmake", {envs = runenvs})
+            os.vrunv(nmake.program, {"/f", "Makefile.nmake"}, {envs = runenvs})
+            os.vcp("isa-l.h", package:installdir("include/isa-l"))
+            os.vcp("include/*.h", package:installdir("include/isa-l"))
+            if package:config("shared") then
+                os.vcp("isa-l.dll", package:installdir("bin"))
+                os.vcp("isa-l.lib", package:installdir("lib"))
+            else
+                os.vcp("isa-l_static.lib", package:installdir("lib"))
+            end
+            if package:is_debug() then
+                os.vcp("isa-l.pdb", package:installdir("bin"))
+            end
+        elseif is_plat("mingw") and (not is_subhost("msys", "cygwin")) then
+            os.cp(path.join(package:scriptdir(), "port", "isa-l.h.in"), "isa-l.h.in")
+            os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua")
+            import("package.tools.xmake").install(package, {version = package:version()})
+        else
+            local configs = {}
+            table.insert(configs, "--enable-shared=" .. (package:config("shared") and "yes" or "no"))
+            if package:is_debug() then
+                table.insert(configs, "--enable-debug")
+            end
+            import("package.tools.autoconf").install(package, configs)
+        end
+    end)
+
+    on_test(function (package)
+        assert(package:has_cfuncs("crc16_t10dif", {includes = "isa-l/crc.h"}))
+    end)