xmake.lua 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package("libpcap")
  2. set_homepage("https://www.tcpdump.org/")
  3. set_description("the LIBpcap interface to various kernel packet capture mechanism")
  4. set_license("BSD-3-Clause")
  5. add_urls("https://www.tcpdump.org/release/libpcap-$(version).tar.gz")
  6. add_urls("https://github.com/the-tcpdump-group/libpcap.git")
  7. add_versions("1.10.1", "ed285f4accaf05344f90975757b3dbfe772ba41d1c401c2648b7fa45b711bdd4")
  8. add_deps("cmake", "flex", "bison")
  9. on_install("linux", "macosx", "android", function (package)
  10. local configs = {
  11. "-DDISABLE_AIRPCAP=ON",
  12. "-DDISABLE_DPDK=ON",
  13. "-DDISABLE_NETMAP=ON",
  14. "-DDISABLE_BLUETOOTH=ON",
  15. "-DDISABLE_DBUS=ON",
  16. "-DDISABLE_RDMA=ON",
  17. "-DDISABLE_DAG=ON",
  18. "-DDISABLE_SEPTEL=ON",
  19. "-DDISABLE_SNF=ON",
  20. "-DDISABLE_TC=ON",
  21. "-DENABLE_REMOTE=OFF",
  22. }
  23. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  24. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  25. table.insert(configs, "-DUSE_STATIC_RT=" .. (package:config("shared") and "OFF" or "ON"))
  26. import("package.tools.cmake").install(package, configs)
  27. if package:config("shared") then
  28. os.rm(path.join(package:installdir("lib"), "lib*.a"))
  29. else
  30. os.rm(path.join(package:installdir("lib"), "lib*.so"))
  31. os.rm(path.join(package:installdir("lib"), "lib*.dylib"))
  32. end
  33. end)
  34. on_test(function (package)
  35. assert(package:has_cfuncs("pcap_create", {includes = "pcap.h"}))
  36. end)