xmake.lua 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. package("swisseph")
  2. set_homepage("https://www.astro.com/swisseph/swephinfo_e.htm")
  3. set_description("Swiss Ephemeris source code, official release by Astrodienst.")
  4. set_license("AGPL-3.0")
  5. add_urls("https://github.com/aloistr/swisseph/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/aloistr/swisseph.git")
  7. add_versions("v2.10.03", "8c166796767a560691581575b6eb4b4383d849e542b16647dca2e0b127fb70b0")
  8. if is_plat("linux", "bsd") then
  9. add_syslinks("m", "dl")
  10. end
  11. on_load("windows", function (package)
  12. if package:is_plat("windows") and package:config("shared") then
  13. package:add("defines", "USE_DLL")
  14. end
  15. end)
  16. on_install(function (package)
  17. if package:is_plat("android") and package:is_arch("armeabi-v7a") then
  18. local ndk_sdkver = package:toolchain("ndk"):config("ndk_sdkver")
  19. if ndk_sdkver and tonumber(ndk_sdkver) < 24 then
  20. io.replace("swejpl.c", "ftello", "ftell", {plain = true})
  21. io.replace("swejpl.c", "fseeko", "fseek", {plain = true})
  22. end
  23. end
  24. io.writefile("xmake.lua", [[
  25. add_rules("mode.debug", "mode.release")
  26. target("swisseph")
  27. set_kind("$(kind)")
  28. add_files(
  29. "swedate.c",
  30. "swehouse.c",
  31. "swejpl.c",
  32. "swemmoon.c",
  33. "swemplan.c",
  34. "sweph.c",
  35. "swephlib.c",
  36. "swecl.c",
  37. "swehel.c"
  38. )
  39. add_headerfiles("*.h", {prefixdir = "swisseph"})
  40. if is_plat("linux", "bsd") then
  41. add_syslinks("m", "dl")
  42. end
  43. if is_plat("windows") and is_kind("shared") then
  44. add_defines("MAKE_DLL")
  45. end
  46. ]])
  47. import("package.tools.xmake").install(package)
  48. end)
  49. on_test(function (package)
  50. assert(package:has_cfuncs("swe_version", {includes = {"swisseph/swephexp.h", "swisseph/sweph.h"}}))
  51. end)