patch.lua 1.9 KB

1234567891011121314151617181920212223242526272829
  1. function main(package)
  2. io.replace("src/meson.build", [[libcriterion = both_libraries]], [[libcriterion = library]], {plain = true})
  3. io.replace("meson.build", "git = find_program('git', required: false)", "", {plain = true})
  4. io.replace("meson.build", "if git.found() and is_git_repo", "if false", {plain = true})
  5. -- Swap from cmake to pkg-config
  6. io.replace("meson.build",
  7. [[nanopb = dependency('nanopb', required: get_option('wrap_mode') == 'nofallback', method: 'cmake',]],
  8. [[nanopb = dependency('nanopb', method: 'pkg-config')]], {plain = true})
  9. io.replace("meson.build", "modules: ['nanopb::protobuf-nanopb-static'])", "", {plain = true})
  10. io.replace("meson.build",
  11. [[libgit2 = dependency('libgit2', required: get_option('wrap_mode') == 'nofallback')]],
  12. [[libgit2 = dependency('libgit2', method: 'pkg-config')]], {plain = true})
  13. if package:is_plat("windows", "mingw") then
  14. io.replace("src/compat/path.c", "defined (HAVE_GETCWD)", "0", {plain = true})
  15. io.replace("src/compat/path.c", "defined (HAVE_GETCURRENTDIRECTORY)", "1", {plain = true})
  16. if not package:config("shared") then
  17. if package:is_plat("windows") then
  18. io.replace("include/criterion/internal/common.h", "__declspec(dllimport)", "", {plain = true})
  19. elseif package:is_plat("mingw") then
  20. io.replace("include/criterion/internal/common.h", "CR_ATTRIBUTE(dllimport)", [[__attribute__((visibility("default")))]], {plain = true})
  21. end
  22. end
  23. io.replace("src/entry/params.c", "#ifdef HAVE_ISATTY", "#if 0", {plain = true})
  24. io.replace("src/entry/params.c", "opts[]", "opts[28]", {plain = true})
  25. else
  26. io.replace("src/compat/path.c", "defined (HAVE_GETCWD)", "1", {plain = true})
  27. io.replace("src/compat/path.c", "defined (HAVE_GETCURRENTDIRECTORY)", "0", {plain = true})
  28. end
  29. end