xmake.lua 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. package("openldap")
  2. set_homepage("https://www.openldap.org/")
  3. set_description("OpenLDAP Software is an open source implementation of the Lightweight Directory Access Protocol.")
  4. add_urls("https://www.openldap.org/software/download/OpenLDAP/openldap-release/openldap-$(version).tgz")
  5. add_versions("2.6.9", "2cb7dc73e9c8340dff0d99357fbaa578abf30cc6619f0521972c555681e6b2ff")
  6. add_configs("tls", {description = "Set TLS/SSL support library.", default = "openssl", type = "string", values = {"openssl", "gnutls"}})
  7. add_configs("sasl", {description = "Enable Cyrus SASL support.", default = false, type = "boolean"})
  8. if is_plat("linux") then
  9. add_syslinks("pthread")
  10. end
  11. on_load("linux", "macosx", function (package)
  12. package:add("links", "ldap", "lber")
  13. package:add("deps", package:config("tls"))
  14. if package:config("sasl") then
  15. package:add("deps", "cyrus-sasl")
  16. end
  17. end)
  18. on_install("linux", "macosx", function (package)
  19. local configs = {
  20. "--without-systemd"
  21. }
  22. table.insert(configs, "--with-tls=" .. package:config("tls"))
  23. table.insert(configs, "--with-cyrus-sasl=" .. (package:config("sasl") and "yes" or "no"))
  24. local cppflags = {}
  25. local ldflags = {}
  26. for _, dep in ipairs(package:orderdeps()) do
  27. local fetchinfo = dep:fetch()
  28. if fetchinfo then
  29. for _, includedir in ipairs(fetchinfo.includedirs or fetchinfo.sysincludedirs) do
  30. table.insert(cppflags, "-I" .. includedir)
  31. end
  32. for _, linkdir in ipairs(fetchinfo.linkdirs) do
  33. table.insert(ldflags, "-L" .. linkdir)
  34. end
  35. for _, link in ipairs(fetchinfo.links) do
  36. table.insert(ldflags, "-l" .. link)
  37. end
  38. end
  39. end
  40. io.replace("Makefile.in", "tests doc", "", {plain = true})
  41. import("package.tools.autoconf").install(package, configs, {cppflags = cppflags, ldflags = ldflags})
  42. end)
  43. on_test(function (package)
  44. assert(package:has_cfuncs("ldap_get_option", {includes = "ldap.h"}))
  45. end)