Browse Source

Support pcapplusplus with zstd (#5579)

* Support pcapplusplus with zstd

* zstd macro enable

---------

Co-authored-by: Aleksei Safronov <[email protected]>
Co-authored-by: ruki <[email protected]>
jj683 9 months ago
parent
commit
52d80bcb94
1 changed files with 8 additions and 0 deletions
  1. 8 0
      packages/p/pcapplusplus/xmake.lua

+ 8 - 0
packages/p/pcapplusplus/xmake.lua

@@ -13,6 +13,7 @@ package("pcapplusplus")
     add_patches("v24.09", "patches/v24.09/explicit-override.patch", "d4ff15e920ea4996f6d3105e898e42d75cfab47b7e930467442ae356a361cf25")
 
     add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
+    add_configs("zstd", {description = "Support compile with zstd", default = false, type = "boolean"})
 
     add_links("Pcap++", "Packet++", "Common++")
 
@@ -31,12 +32,19 @@ package("pcapplusplus")
         add_deps("libpcap")
     end
 
+    on_load(function (package)
+        if package:config("zstd") then
+            package:add("deps", "zstd")
+        end
+    end)
+
     on_install("windows", "mingw", "linux", "macosx", "android", "bsd", function (package)
         local configs = {
             "-DPCAPPP_BUILD_EXAMPLES=OFF",
             "-DPCAPPP_BUILD_TESTS=OFF"
         }
         table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
+        table.insert(configs, "-DLIGHT_PCAPNG_ZSTD=" .. (package:config("zstd") and "ON" or "OFF"))
         for _, cmakefile in ipairs(os.files("**/CMakeLists.txt")) do
             io.replace(cmakefile, "COMPILE_WARNING_AS_ERROR ON", "COMPILE_WARNING_AS_ERROR OFF")
         end