Browse Source

hyperscan: fix boost dependency config (#8236)

* hyperscan: fix boost dependency config

* Simplify boost config

* fix arch

* remove tools

---------

Co-authored-by: star9029 <[email protected]>
Dominik Kaszewski 2 months ago
parent
commit
92f406b6c9
1 changed files with 18 additions and 4 deletions
  1. 18 4
      packages/h/hyperscan/xmake.lua

+ 18 - 4
packages/h/hyperscan/xmake.lua

@@ -5,13 +5,27 @@ package("hyperscan")
 
 
     add_urls("https://github.com/intel/hyperscan/archive/refs/tags/$(version).tar.gz",
     add_urls("https://github.com/intel/hyperscan/archive/refs/tags/$(version).tar.gz",
              "https://github.com/intel/hyperscan.git")
              "https://github.com/intel/hyperscan.git")
+
     add_versions("v5.4.2", "32b0f24b3113bbc46b6bfaa05cf7cf45840b6b59333d078cc1f624e4c40b2b99")
     add_versions("v5.4.2", "32b0f24b3113bbc46b6bfaa05cf7cf45840b6b59333d078cc1f624e4c40b2b99")
 
 
-    add_deps("cmake", "boost", "ragel", "python")
+    add_deps("cmake", "ragel", "python 3.x", {kind = "binary"})
+    add_deps("boost", {configs = {thread = true, graph = true}})
+
+    on_check(function (package)
+        if not package:is_arch("x64", "x86", "x86_64", "i386") then
+            raise("package(hyperscan) only support x86 arch")
+        end
+    end)
+
+    -- mingw require this patch: https://github.com/intel/hyperscan/pull/36
+    on_install("!mingw", function (package)
+        io.replace("CMakeLists.txt", "add_subdirectory(tools)", "", {plain = true})
+        if not package:config("pic") then
+            io.replace("CMakeLists.txt", "POSITION_INDEPENDENT_CODE TRUE", "POSITION_INDEPENDENT_CODE FALSE", {plain = true})
+        end
 
 
-    on_install("linux", "windows|!arm*", function (package)
-        local configs = {}
-        table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
+        local configs = {"-DBUILD_EXAMPLES=OFF"}
+        table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
         table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
         table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
         import("package.tools.cmake").install(package, configs)
         import("package.tools.cmake").install(package, configs)
     end)
     end)