Browse Source

add winpcap support for pcapplusplus (#6197)

* add winpcap support for pcapplusplus

* Update xmake.lua

* Fix libpcap

---------

Co-authored-by: star9029 <[email protected]>
xpxz 7 months ago
parent
commit
d6ad68dc09
2 changed files with 13 additions and 6 deletions
  1. 1 1
      packages/l/libpcap/xmake.lua
  2. 12 5
      packages/p/pcapplusplus/xmake.lua

+ 1 - 1
packages/l/libpcap/xmake.lua

@@ -24,7 +24,7 @@ package("libpcap")
         add_patches("1.10.5", "patches/1.10.5/cmake-mingw.patch", "6b27886a5be489aa03150790330b5c78320cec3067ca62f3a2fde9565cbeb344")
     end
 
-    add_deps("cmake", "flex", "bison")
+    add_deps("cmake", "flex", "bison", {kind = "binary"})
     if is_plat("windows", "mingw", "msys") then
         add_deps("npcap_sdk")
     end

+ 12 - 5
packages/p/pcapplusplus/xmake.lua

@@ -14,6 +14,7 @@ package("pcapplusplus")
 
     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_configs("winpcap", {description = "Support compile with winpcap", default = false, type = "boolean"})
 
     add_links("Pcap++", "Packet++", "Common++")
 
@@ -26,16 +27,22 @@ package("pcapplusplus")
     end
 
     add_deps("cmake")
-    if is_plat("windows", "mingw") then
-        add_deps("npcap_sdk")
-    elseif is_plat("linux", "macosx", "android", "bsd") then
-        add_deps("libpcap")
-    end
 
     on_load(function (package)
         if package:config("zstd") then
             package:add("deps", "zstd")
         end
+        if package:is_plat("windows") and not package:is_arch("arm.*") then
+            if package:config("winpcap") then
+                package:add("deps", "winpcap")
+            else
+                package:add("deps", "npcap_sdk")
+            end  
+        elseif package:is_plat("linux", "macosx", "android", "bsd") then
+            package:add("deps", "libpcap")
+        else
+            package:add("deps", "npcap_sdk")
+        end
     end)
 
     on_install("windows", "mingw", "linux", "macosx", "android", "bsd", function (package)