xmake.lua 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package("apr")
  2. set_homepage("https://github.com/apache/apr")
  3. set_description("Mirror of Apache Portable Runtime")
  4. set_license("Apache-2.0")
  5. add_urls("https://github.com/apache/apr/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/apache/apr.git")
  7. add_versions("1.7.0", "a7e2c5e6d60f6c7b1611b31a2f914a3e58f44eded5b064f0bae43ff30b16a4e6")
  8. if is_plat("linux") then
  9. add_deps("libtool", "python")
  10. add_patches("1.7.0", path.join(os.scriptdir(), "patches", "1.7.0", "common.patch"), "bbfef69c914ca1ab98a9d94fc4794958334ce5f47d8c08c05e0965a48a44c50d")
  11. elseif is_plat("windows") then
  12. add_deps("cmake")
  13. end
  14. on_install("linux", "macosx", function (package)
  15. local configs = {}
  16. if package:is_plat("linux") then
  17. os.vrunv("sh", {"./buildconf"})
  18. io.replace("configure", "RM='$RM'", "RM='$RM -f'")
  19. else
  20. io.replace("configure.in", "pid_t_fmt='#error Can not determine the proper size for pid_t'", "pid_t_fmt='#define APR_PID_T_FMT \"d\"'")
  21. os.vrunv("sh", {"./buildconf"})
  22. table.insert(configs, "CFLAGS=-DAPR_IOVEC_DEFINED")
  23. end
  24. import("package.tools.autoconf").install(package, configs)
  25. package:add("includedirs", "include/apr-1")
  26. end)
  27. on_install("windows", function (package)
  28. local configs = {"-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release")}
  29. import("package.tools.cmake").install(package, configs)
  30. if not package:config("shared") then
  31. os.rm(package:installdir("bin/*.dll"))
  32. end
  33. end)
  34. on_test(function (package)
  35. assert(package:has_cincludes("apr.h"))
  36. end)