xmake.lua 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package("gnu-gsl")
  2. set_homepage("https://www.gnu.org/software/gsl/")
  3. set_description("The GNU Scientific Library (GSL) is a numerical library for C and C++ programmers.")
  4. set_license("GPL-3.0")
  5. add_urls("https://ftpmirror.gnu.org/gsl/gsl-$(version).tar.gz",
  6. "https://ftp.gnu.org/gnu/gsl/gsl-$(version).tar.gz")
  7. add_versions("2.7.1", "dcb0fbd43048832b757ff9942691a8dd70026d5da0ff85601e52687f6deeb34b")
  8. add_versions("2.7", "efbbf3785da0e53038be7907500628b466152dbc3c173a87de1b5eba2e23602b")
  9. if is_plat("windows") then
  10. add_patches("2.7.x", path.join(os.scriptdir(), "patches", "configure.patch"), "50fe9e6a4e68750fa2e21febf05471423cc7a0a38e59cf41d5009cd79352b2e6")
  11. add_patches("2.7.x", path.join(os.scriptdir(), "patches", "add_fp_control.patch"), "6c6782327126ea979c5aceab3ee022b5ddc7d9d01c244774294572e73427ec4b")
  12. end
  13. add_links("gsl", "gslcblas")
  14. on_install("macosx", "linux", function (package)
  15. local configs = {"--disable-dependency-tracking"}
  16. table.insert(configs, "--enable-shared=" .. (package:config("shared") and "yes" or "no"))
  17. table.insert(configs, "--enable-static=" .. (package:config("shared") and "no" or "yes"))
  18. if package:config("pic") ~= false then
  19. table.insert(configs, "--with-pic")
  20. end
  21. import("package.tools.autoconf").install(package, configs, {cppflags = cppflags, ldflags = ldflags})
  22. end)
  23. on_install("windows", function (package)
  24. os.cp(path.join(os.scriptdir(), "cmake", "cmakelists.txt"), path.join(package:cachedir(), "source"))
  25. local configs = {}
  26. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  27. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  28. table.insert(configs, "-DCMAKE_POSITION_INDEPENDENT_CODE="..(package:config("pic") and "ON" or "OFF"))
  29. import("package.tools.cmake").install(package, configs)
  30. end)
  31. on_test(function (package)
  32. assert(package:has_cfuncs("gsl_isnan", {includes = "gsl/gsl_math.h"}))
  33. end)