xmake.lua 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package("pdfio")
  2. set_homepage("https://www.msweet.org/pdfio")
  3. set_description("PDFio is a simple C library for reading and writing PDF files.")
  4. set_license("Apache-2.0")
  5. add_urls("https://github.com/michaelrsweet/pdfio/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/michaelrsweet/pdfio.git")
  7. add_versions("v1.4.0", "c3657cca203801dc111fd41919979068a876473e1ba2c849c7d130c0d4a7ed89")
  8. add_versions("v1.3.2", "a814fd10e602ffcc9e243674c82268a097992b1c4ad1359d9ab236c56b648b71")
  9. add_versions("v1.3.1", "0f2933f2d5d0a8c0152510fe5b565715cee8146f3d0d10024e3c597268928574")
  10. add_versions("v1.3.0", "aae5b4850560869021f6af1700a0681f0d19299554f24abf890a1a78188ddf02")
  11. if is_plat("windows", "mingw") then
  12. add_syslinks("advapi32")
  13. elseif is_plat("linux", "bsd") then
  14. add_syslinks("m")
  15. end
  16. add_deps("zlib")
  17. if on_check then
  18. on_check("android", function (package)
  19. local ndk = package:toolchain("ndk")
  20. local ndk_sdkver = ndk:config("ndk_sdkver")
  21. assert(ndk_sdkver and tonumber(ndk_sdkver) > 21, "package(pdfio): need ndk api level > 21")
  22. end)
  23. end
  24. on_install(function (package)
  25. if package:is_plat("mingw") and package:is_arch("i386") then
  26. io.replace("ttf.c", "typedef __int64 ssize_t;", "", {plain = true})
  27. io.replace("pdfio.h", "typedef __int64 ssize_t;", "", {plain = true})
  28. end
  29. os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua")
  30. import("package.tools.xmake").install(package)
  31. end)
  32. on_test(function (package)
  33. assert(package:has_cfuncs("pdfioArrayCreate", {includes = "pdfio.h"}))
  34. end)