xmake.lua 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. package("xapian-core")
  2. set_homepage("https://savannah.gnu.org/projects/osip")
  3. set_description("Xapian is an Open Source Search Engine Library, with bindings to allow use from Perl, Python 2, Python 3, PHP 5, PHP 7, Java, Tcl, C#, Ruby, Lua, Erlang, Node.js, R.")
  4. set_license("GPL-2.0-or-later")
  5. add_urls("https://oligarchy.co.uk/xapian/$(version)/xapian-core-$(version).tar.xz")
  6. add_versions("1.4.27", "bcbc99cfbf16080119c2571fc296794f539bd542ca3926f17c2999600830ab61")
  7. if is_plat("wasm") then
  8. add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
  9. end
  10. if is_plat("windows", "mingw") then
  11. add_syslinks("ws2_32", "rpcrt4")
  12. elseif is_plat("linux", "bsd") then
  13. add_syslinks("m")
  14. end
  15. add_deps("autotools", "zlib")
  16. if is_plat("mingw") then
  17. add_deps("ssp")
  18. else
  19. add_deps("libuuid")
  20. end
  21. on_check("android", function (package)
  22. if package:is_arch("armeabi-v7a") then
  23. local ndk = package:toolchain("ndk")
  24. local ndk_sdkver = ndk:config("ndk_sdkver")
  25. assert(ndk_sdkver and tonumber(ndk_sdkver) >= 24, "package(xapian/armeabi-v7a): need ndk api level >= 24")
  26. end
  27. end)
  28. on_install("linux", "macosx", "bsd", "mingw", "msys", "android@linux,macosx", "cross", "wasm", function (package)
  29. io.replace("include/xapian/version_h.cc", "#elif defined _MSC_VER", "#elif 0", {plain = true})
  30. io.replace("configure.ac", "dnl Check for zlib.h.", [[
  31. enable_zlib_checks=no
  32. if test "x$enable_zlib_checks" = "xyes"; then
  33. dnl Check for zlib.h.
  34. ]], {plain = true})
  35. io.replace("configure.ac", "dnl Find a way to generate UUIDs.", [[
  36. fi
  37. PKG_CHECK_MODULES([ZLIB], [zlib], [],[AC_MSG_ERROR([zlib library not found])])
  38. CFLAGS="$LIBS $ZLIB_CFLAGS"
  39. LIBS="$ZLIB_LIBS $LIBS"
  40. dnl Find a way to generate UUIDs.
  41. ]], {plain = true})
  42. local configs = {}
  43. table.insert(configs, "--enable-shared=" .. (package:config("shared") and "yes" or "no"))
  44. table.insert(configs, "--enable-static=" .. (package:config("shared") and "no" or "yes"))
  45. local packagedeps = {"zlib"}
  46. if package:is_plat("mingw") then
  47. table.insert(packagedeps, "ssp")
  48. else
  49. table.insert(packagedeps, "libuuid")
  50. end
  51. import("package.tools.autoconf").install(package, configs, {packagedeps = packagedeps})
  52. end)
  53. on_test(function (package)
  54. assert(package:check_cxxsnippets({test = [[
  55. void test() {
  56. Xapian::version_string();
  57. }
  58. ]]}, {configs = {languages = "c++11"}, includes = "xapian.h"}))
  59. end)