xmake.lua 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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.6.1", "de733aad5d5b2d8199667ca28efe01fce17e00743ba021f88303c8a81a5eaa67")
  8. add_versions("v1.5.0", "895cfa22a895d0afc69a18402f19057ddaf8f035cc0a69f3f2a4cbe55ead9662")
  9. add_versions("v1.4.0", "c3657cca203801dc111fd41919979068a876473e1ba2c849c7d130c0d4a7ed89")
  10. add_versions("v1.3.2", "a814fd10e602ffcc9e243674c82268a097992b1c4ad1359d9ab236c56b648b71")
  11. add_versions("v1.3.1", "0f2933f2d5d0a8c0152510fe5b565715cee8146f3d0d10024e3c597268928574")
  12. add_versions("v1.3.0", "aae5b4850560869021f6af1700a0681f0d19299554f24abf890a1a78188ddf02")
  13. if is_plat("windows", "mingw") then
  14. add_syslinks("advapi32")
  15. elseif is_plat("linux", "bsd") then
  16. add_syslinks("m")
  17. end
  18. add_deps("zlib")
  19. if on_check then
  20. on_check("android", function (package)
  21. local ndk = package:toolchain("ndk")
  22. local ndk_sdkver = ndk:config("ndk_sdkver")
  23. assert(ndk_sdkver and tonumber(ndk_sdkver) > 21, "package(pdfio): need ndk api level > 21")
  24. end)
  25. end
  26. on_install(function (package)
  27. if package:is_plat("mingw") and package:is_arch("i386") then
  28. io.replace("ttf.c", "typedef __int64 ssize_t;", "", {plain = true})
  29. io.replace("pdfio.h", "typedef __int64 ssize_t;", "", {plain = true})
  30. end
  31. os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua")
  32. import("package.tools.xmake").install(package)
  33. end)
  34. on_test(function (package)
  35. assert(package:has_cfuncs("pdfioArrayCreate", {includes = "pdfio.h"}))
  36. end)