xmake.lua 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. package("mpfr")
  2. set_homepage("https://www.mpfr.org/")
  3. set_description("The MPFR library is a C library for multiple-precision floating-point computations with correct rounding.")
  4. set_license("LGPL-3.0")
  5. add_urls("https://www.mpfr.org/mpfr-$(version)/mpfr-$(version).tar.gz")
  6. add_versions("4.1.0", "3127fe813218f3a1f0adf4e8899de23df33b4cf4b4b3831a5314f78e65ffa2d6")
  7. add_versions("4.2.0", "f1cc1c6bb14d18f0c61cc416e083f5e697b6e0e3cf9630b9b33e8e483fc960f0")
  8. if is_plat("mingw") and is_subhost("msys") then
  9. add_extsources("pacman::mpfr")
  10. elseif is_plat("linux") then
  11. add_extsources("pacman::mpfr", "apt::libmpfr-dev")
  12. elseif is_plat("macosx") then
  13. add_extsources("brew::mpfr")
  14. end
  15. add_deps("gmp")
  16. on_install("macosx", "linux", function (package)
  17. local configs = {"--disable-dependency-tracking"}
  18. table.insert(configs, "--with-gmp=" .. package:dep("gmp"):installdir())
  19. if package:config("shared") then
  20. table.insert(configs, "--enable-shared=yes")
  21. table.insert(configs, "--enable-static=no")
  22. else
  23. table.insert(configs, "--enable-static=yes")
  24. table.insert(configs, "--enable-shared=no")
  25. end
  26. if package:config("pic") ~= false then
  27. table.insert(configs, "--with-pic")
  28. end
  29. import("package.tools.autoconf").install(package, configs)
  30. end)
  31. on_test(function (package)
  32. assert(package:has_cfuncs("mpfr_get_version", {includes = "mpfr.h"}))
  33. end)