|
@@ -1,11 +1,11 @@
|
|
|
package("libpcap")
|
|
|
-
|
|
|
set_homepage("https://www.tcpdump.org/")
|
|
|
set_description("the LIBpcap interface to various kernel packet capture mechanism")
|
|
|
set_license("BSD-3-Clause")
|
|
|
|
|
|
add_urls("https://www.tcpdump.org/release/libpcap-$(version).tar.gz", {alias = "home"})
|
|
|
add_urls("https://github.com/the-tcpdump-group/libpcap.git", {alias = "github", version = function (version) return "libpcap-" .. version end})
|
|
|
+
|
|
|
add_versions("home:1.10.5", "37ced90a19a302a7f32e458224a00c365c117905c2cd35ac544b6880a81488f0")
|
|
|
add_versions("home:1.10.4", "ed19a0383fad72e3ad435fd239d7cd80d64916b87269550159d20e47160ebe5f")
|
|
|
add_versions("home:1.10.3", "2a8885c403516cf7b0933ed4b14d6caa30e02052489ebd414dc75ac52e7559e6")
|
|
@@ -19,16 +19,35 @@ package("libpcap")
|
|
|
add_versions("github:1.10.1", "7b650c9e0ce246aa41ba5463fe8e903efc444c914a3ccb986547350bed077ed6")
|
|
|
|
|
|
add_configs("remote", {description = "Enable remote capture support (requires openssl)", default = true, type = "boolean"})
|
|
|
-
|
|
|
+
|
|
|
+ if is_plat("mingw", "msys") then
|
|
|
+ add_patches("1.10.5", "patches/1.10.5/cmake-mingw.patch", "6b27886a5be489aa03150790330b5c78320cec3067ca62f3a2fde9565cbeb344")
|
|
|
+ end
|
|
|
+
|
|
|
add_deps("cmake", "flex", "bison")
|
|
|
+ if is_plat("windows", "mingw", "msys") then
|
|
|
+ add_deps("npcap_sdk")
|
|
|
+ end
|
|
|
|
|
|
on_load(function (package)
|
|
|
if package:config("remote") then
|
|
|
package:add("deps", "openssl")
|
|
|
+ if package:is_plat("windows", "mingw", "msys") then
|
|
|
+ package:add("patches", "1.10.5", "patches/1.10.5/cmake-msvc.patch", "eeb6d0bf9eca935eb97c789cbb6752cbdaff7bf88b533e90b66ef086afbd26b0")
|
|
|
+ end
|
|
|
end
|
|
|
end)
|
|
|
|
|
|
- on_install("linux", "macosx", "android", "bsd", function (package)
|
|
|
+ on_install("!iphoneos and !wasm", function (package)
|
|
|
+ io.replace("CMakeLists.txt", "add_subdirectory(testprogs)", "", {plain = true})
|
|
|
+ if package:is_plat("windows", "mingw", "msys") then
|
|
|
+ io.replace("CMakeLists.txt", "/x64", "", {plain = true}) -- fix install dir
|
|
|
+ io.replace("CMakeLists.txt", "${OPENSSL_LIBRARIES}", "${OPENSSL_LIBRARIES} ws2_32 user32 crypt32 advapi32", {plain = true})
|
|
|
+ if package:is_plat("mingw", "msys") then
|
|
|
+ io.replace("CMakeLists.txt", "check_function_exists(asprintf HAVE_ASPRINTF)", "", {plain = true})
|
|
|
+ end
|
|
|
+ end
|
|
|
+
|
|
|
local configs = {
|
|
|
"-DDISABLE_AIRPCAP=ON",
|
|
|
"-DDISABLE_DPDK=ON",
|
|
@@ -41,21 +60,31 @@ package("libpcap")
|
|
|
"-DDISABLE_SNF=ON",
|
|
|
"-DDISABLE_TC=ON",
|
|
|
"-DCMAKE_POLICY_DEFAULT_CMP0057=NEW",
|
|
|
+ "-DUSE_STATIC_RT=OFF", -- Use CMAKE_MSVC_RUNTIME_LIBRARY
|
|
|
}
|
|
|
if package:is_plat("macosx") and package:is_arch("arm64") then
|
|
|
table.insert(configs, "-DCMAKE_OSX_ARCHITECTURES=arm64")
|
|
|
end
|
|
|
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
|
|
|
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
|
|
|
- table.insert(configs, "-DUSE_STATIC_RT=" .. (package:config("shared") and "OFF" or "ON"))
|
|
|
table.insert(configs, "-DENABLE_REMOTE=" .. (package:config("remote") and "ON" or "OFF"))
|
|
|
+
|
|
|
+ local opt = {}
|
|
|
+ if package:is_plat("windows") then
|
|
|
+ os.mkdir(path.join(package:buildir(), "rpcapd/pdb"))
|
|
|
+ end
|
|
|
import("package.tools.cmake").install(package, configs)
|
|
|
|
|
|
if package:config("shared") then
|
|
|
- os.rm(path.join(package:installdir("lib"), "lib*.a"))
|
|
|
+ if package:is_plat("mingw", "msys") then
|
|
|
+ os.rm(package:installdir("lib/libpcap.a"))
|
|
|
+ else
|
|
|
+ os.rm(package:installdir("lib/lib*.a"))
|
|
|
+ end
|
|
|
+ os.rm(package:installdir("lib/*_static*"))
|
|
|
else
|
|
|
- os.rm(path.join(package:installdir("lib"), "lib*.so"))
|
|
|
- os.rm(path.join(package:installdir("lib"), "lib*.dylib"))
|
|
|
+ os.rm(package:installdir("lib/lib*.so"))
|
|
|
+ os.rm(package:installdir("lib/lib*.dylib"))
|
|
|
end
|
|
|
end)
|
|
|
|