2
0

patch.lua 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. function _patch_editline(package)
  2. if not package:is_plat("linux") then
  3. return
  4. end
  5. -- cmake/readline.cmake always consider editline is shared library
  6. -- If we use static library, CHECK_CXX_SOURCE_COMPILES will fail because missing ncurses
  7. local editline = package:dep("libedit")
  8. if not editline:config("shared") then
  9. local strings = "\nFIND_PACKAGE(Curses)\nlist(APPEND EDITLINE_LIBRARY ${CURSES_LIBRARIES})\n"
  10. io.replace("cmake/readline.cmake",
  11. "MARK_AS_ADVANCED(EDITLINE_INCLUDE_DIR EDITLINE_LIBRARY)",
  12. "MARK_AS_ADVANCED(EDITLINE_INCLUDE_DIR EDITLINE_LIBRARY)" .. strings,
  13. {plain = true})
  14. end
  15. end
  16. function cmake(package)
  17. local version = package:version()
  18. if version:eq("8.0.39") then
  19. io.replace("cmake/ssl.cmake", "IF(NOT OPENSSL_APPLINK_C)", "IF(FALSE)", {plain = true})
  20. io.replace("cmake/boost.cmake", "IF(NOT BOOST_MINOR_VERSION EQUAL 77)", "IF(FALSE)", {plain = true})
  21. if package:is_cross() then
  22. local libevent_version = package:dep("libevent"):version()
  23. if not libevent_version then
  24. version = "2.1.12"
  25. end
  26. -- skip try_run
  27. io.replace("cmake/libevent.cmake",
  28. [[SET(LIBEVENT_VERSION_STRING "${RUN_OUTPUT}")]],
  29. format([[SET(LIBEVENT_VERSION_STRING "%s")]], libevent_version), {plain = true})
  30. end
  31. elseif version:eq("9.0.1") then
  32. io.replace("cmake/ssl.cmake", "FIND_CUSTOM_OPENSSL()", "FIND_SYSTEM_OPENSSL()", {plain = true})
  33. end
  34. if package:is_plat("windows") then
  35. -- fix pdb install
  36. io.replace("cmake/install_macros.cmake",
  37. [[NOT type MATCHES "STATIC_LIBRARY"]],
  38. [[NOT type MATCHES "STATIC_LIBRARY" AND CMAKE_BUILD_TYPE STREQUAL "DEBUG"]], {plain = true})
  39. if package:is_cross() then
  40. -- skip try_run
  41. io.replace("cmake/rapidjson.cmake", "IF (NOT HAVE_RAPIDJSON_WITH_STD_REGEX)", "if(FALSE)", {plain = true})
  42. end
  43. end
  44. if not package:config("cluster") then
  45. io.replace("CMakeLists.txt", "ADD_SUBDIRECTORY(storage/ndb)", "", {plain = true})
  46. end
  47. _patch_editline(package)
  48. end