xmake.lua 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. package("libxcrypt")
  2. set_homepage("https://github.com/besser82/libxcrypt")
  3. set_description("Extended crypt library for descrypt, md5crypt, bcrypt, and others.")
  4. set_license("GPL-2.0-or-later")
  5. set_urls("https://github.com/besser82/libxcrypt/releases/download/v$(version)/libxcrypt-$(version).tar.xz")
  6. add_versions("4.4.38", "80304b9c306ea799327f01d9a7549bdb28317789182631f1b54f4511b4206dd6")
  7. add_configs("largefile", {description = "Enable support for large files.", default = true, type = "boolean"})
  8. add_configs("failure_tokens", {description = "Make crypt and crypt_r return NULL on failure.", default = true, type = "boolean"})
  9. add_configs("xcrypt_compat_files", {description = "Enable installation of compatibility headers/libraries/symlinks.", default = true, type = "boolean"})
  10. add_configs("obsolete_api", {description = "Enable all compatibility APIs, or only some.", default = "all", type = "string", values = {"all", "none", "alt", "glibc", "owl", "suse"}})
  11. add_configs("obsolete_api_enosys", {description = "Enable stub-only compatibility API with no real functionality.", default = false, type = "boolean"})
  12. add_configs("hashes", {description = "Select the hashing method to enable.", default = "all", type = "string"})
  13. add_configs("year2038", {description = "Enable support for timestamps after 2038.", default = true, type = "boolean"})
  14. if is_plat("mingw", "msys", "cygwin") then
  15. add_configs("symvers", {description = "Enable library symbol versioning. (true => auto)", default = false, type = "boolean", readonly = true})
  16. else
  17. add_configs("symvers", {description = "Enable library symbol versioning. (true => auto)", default = true, type = "boolean"})
  18. end
  19. on_install("linux", "bsd", "macosx", "mingw", "msys", "cygwin", function (package)
  20. local configs = {
  21. "--disable-dependency-tracking"
  22. }
  23. local features_boolean = {
  24. "largefile", "symvers", "failure-tokens", "xcrypt-compat-files",
  25. "obsolete-api-enosys", "year2038"
  26. }
  27. for _, feature in ipairs(features_boolean) do
  28. local yes = package:config(feature:gsub("-", "_"))
  29. table.insert(configs, ("--enable-%s=%s"):format(feature, yes and "yes" or "no"))
  30. end
  31. local obsolete_api = package:config("obsolete_api")
  32. if obsolete_api == "all" then
  33. obsolete_api = "yes"
  34. elseif obsolete_api == "none" then
  35. obsolete_api = "no"
  36. end
  37. table.insert(configs, "--enable-obsolete-api=" .. obsolete_api)
  38. table.insert(configs, "--enable-hashes=" .. package:config("hashes"))
  39. if package:is_plat("mingw", "msys", "cygwin") then
  40. io.replace("Makefile.in", "libcrypt_la_LDFLAGS = -version-info", "libcrypt_la_LDFLAGS = -no-undefined -version-info", {plain = true})
  41. end
  42. io.replace("configure", "-Wpedantic", "", {plain = true})
  43. table.insert(configs, "--enable-werror=no")
  44. import("package.tools.autoconf").install(package, configs)
  45. end)
  46. on_test(function (package)
  47. assert(package:has_cfuncs("crypt", {includes = {"crypt.h"}}))
  48. end)