xmake.lua 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package("libspectre")
  2. set_homepage("https://www.freedesktop.org/wiki/Software/libspectre/")
  3. set_description("libspectre is a small library for rendering Postscript documents.")
  4. set_license("GPL-2.0")
  5. add_urls("http://libspectre.freedesktop.org/releases/libspectre-$(version).tar.gz")
  6. add_versions("0.2.9", "49ae9c52b5af81b405455c19fe24089d701761da2c45d22164a99576ceedfbed")
  7. add_deps("ghostscript")
  8. on_install("macosx", "linux", function (package)
  9. local configs = {"--disable-dependency-tracking", "--disable-silent-rules"}
  10. table.insert(configs, "--enable-shared=" .. (package:config("shared") and "yes" or "no"))
  11. table.insert(configs, "--enable-static=" .. (package:config("shared") and "no" or "yes"))
  12. if package:config("pic") ~= false then
  13. table.insert(configs, "--with-pic")
  14. end
  15. if package:is_plat("macosx") then
  16. -- patch configure to make ci happy
  17. io.replace("configure", "have_libgs=no", "have_libgs=yes", {plain = true})
  18. end
  19. local cppflags = {}
  20. local ldflags = {}
  21. for _, dep in ipairs(package:orderdeps()) do
  22. local fetchinfo = dep:fetch()
  23. if fetchinfo then
  24. for _, includedir in ipairs(fetchinfo.includedirs or fetchinfo.sysincludedirs) do
  25. table.insert(cppflags, "-I" .. includedir)
  26. end
  27. for _, linkdir in ipairs(fetchinfo.linkdirs) do
  28. table.insert(ldflags, "-L" .. linkdir)
  29. end
  30. end
  31. end
  32. import("package.tools.autoconf").install(package, configs, {cppflags = cppflags, ldflags = ldflags})
  33. end)
  34. on_test(function (package)
  35. assert(package:has_cfuncs("spectre_document_get_format", {includes = "libspectre/spectre.h"}))
  36. end)