xmake.lua 3.3 KB

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