xmake.lua 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package("m4")
  2. set_kind("binary")
  3. set_homepage("https://www.gnu.org/software/m4")
  4. set_description("Macro processing language")
  5. add_urls("https://ftpmirror.gnu.org/m4/m4-$(version).tar.xz",
  6. "https://ftp.gnu.org/gnu/m4/m4-$(version).tar.xz",
  7. "https://mirrors.ustc.edu.cn/gnu/m4/m4-$(version).tar.xz")
  8. add_versions("1.4.18", "f2c1e86ca0a404ff281631bdc8377638992744b175afb806e25871a24a934e07")
  9. add_versions("1.4.19", "63aede5c6d33b6d9b13511cd0be2cac046f2e70fd0a07aa9573a04a82783af96")
  10. if is_host("macosx") then
  11. -- fix crash from usage of %n in dynamic format strings on High Sierra
  12. -- patch credit to Jeremy Huddleston Sequoia <[email protected]>
  13. add_patches("1.4.18", path.join(os.scriptdir(), "patches", "1.4.18", "secure_snprintf.patch"), "c0a408fbffb7255fcc75e26bd8edab116fc81d216bfd18b473668b7739a4158e")
  14. elseif is_host("linux") then
  15. add_extsources("apt::m4", "pacman::m4")
  16. end
  17. on_install("@macosx", "@linux", "@msys", "@cygwin", "@bsd", function (package)
  18. if package:is_plat("linux") then
  19. -- fix freadahead.c:92:3: error: #error "Please port gnulib freadahead.c to your platform! Look at the definition of fflush, fread, ungetc on your system, then report this to bug-gnulib."
  20. -- https://git.savannah.gnu.org/cgit/gnulib.git
  21. for _, gnulib_file in ipairs(os.files("lib/*.c")) do
  22. io.replace(gnulib_file, "defined _IO_ftrylockfile", "defined _IO_EOF_SEEN || defined _IO_ftrylockfile")
  23. end
  24. local file = io.open("lib/stdio-impl.h", "a+")
  25. file:write([[
  26. #if defined _IO_EOF_SEEN
  27. # if !defined _IO_UNBUFFERED
  28. # define _IO_UNBUFFERED 0x2
  29. # endif
  30. # if !defined _IO_IN_BACKUP
  31. # define _IO_IN_BACKUP 0x100
  32. # endif
  33. #endif]])
  34. file:close()
  35. end
  36. import("package.tools.autoconf").install(package, {"--disable-dependency-tracking"})
  37. end)
  38. on_test(function (package)
  39. os.vrun("m4 --version")
  40. end)