xmake.lua 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. package("gmp")
  2. set_homepage("https://gmplib.org/")
  3. set_description("GMP is a free library for arbitrary precision arithmetic, operating on signed integers, rational numbers, and floating-point numbers.")
  4. set_license("LGPL-3.0")
  5. add_urls("https://gmplib.org/download/gmp/gmp-$(version).tar.xz")
  6. add_versions("6.2.1", "fd4829912cddd12f84181c3451cc752be224643e87fac497b69edddadc49b4f2")
  7. if is_plat("mingw") and is_subhost("msys") then
  8. add_extsources("pacman::gmp")
  9. elseif is_plat("linux") then
  10. add_extsources("pacman::gmp", "apt::libgmp-dev")
  11. elseif is_plat("macosx") then
  12. add_extsources("brew::gmp")
  13. end
  14. add_deps("m4")
  15. on_install("macosx", "linux", function (package)
  16. local configs = {}
  17. table.insert(configs, "--enable-shared=" .. (package:config("shared") and "yes" or "no"))
  18. table.insert(configs, "--enable-static=" .. (package:config("shared") and "no" or "yes"))
  19. if package:debug() then
  20. table.insert(configs, "--enable-debug")
  21. end
  22. if package:config("pic") ~= false then
  23. table.insert(configs, "--with-pic")
  24. end
  25. import("package.tools.autoconf").install(package, configs)
  26. end)
  27. on_test(function (package)
  28. assert(package:has_cfuncs("gmp_randinit", {includes = "gmp.h"}))
  29. end)