xmake.lua 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. package("libogg")
  2. set_homepage("https://www.xiph.org/ogg/")
  3. set_description("Ogg Bitstream Library")
  4. set_license("BSD")
  5. add_urls("https://github.com/xiph/ogg/archive/refs/tags/$(version).tar.gz", {alias = "github"})
  6. add_urls("https://gitlab.xiph.org/xiph/ogg/-/archive/$(version)/ogg-$(version).tar.gz", {alias = "gitlab"})
  7. add_urls("https://gitlab.xiph.org/xiph/ogg.git",
  8. "https://github.com/xiph/ogg.git")
  9. add_versions("github:v1.3.6", "95b643da661155d79db9de2fca55daed3a8d491039829def246aacb3d9201c81")
  10. add_versions("github:v1.3.5", "f6f1b04cfa4e98b70ffe775d5e302d9c6b98541f05159af6de2d6617817ed7d6")
  11. add_versions("github:v1.3.4", "3da31a4eb31534b6f878914b7379b873c280e610649fe5c07935b3d137a828bc")
  12. add_versions("gitlab:v1.3.5", "769ed632a71bfa8bdd3439ac7c712b74e12affdaeae2852c6a859bbbba424e68")
  13. add_versions("gitlab:v1.3.4", "62cc64b9fd3cf57bde3a9033e94534ba34313d2bb9698029f623121a4e47bb9b")
  14. add_patches("v1.3.4", "patches/1.3.4/macos_fix.patch", "e12c41ad71206777f399c1048914e5e5a2fe44e18d0d50ebe9bedbfbe0624c35")
  15. add_deps("cmake")
  16. if is_plat("mingw") and is_subhost("msys") then
  17. add_extsources("pacman::libogg")
  18. elseif is_plat("linux") then
  19. add_extsources("pacman::libogg", "apt::libogg-dev")
  20. elseif is_plat("macosx") then
  21. add_extsources("brew::libogg")
  22. end
  23. on_install(function (package)
  24. local configs = {"-DBUILD_TESTING=OFF", "-DCMAKE_POLICY_DEFAULT_CMP0057=NEW"}
  25. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  26. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  27. import("package.tools.cmake").install(package, configs)
  28. end)
  29. on_test(function (package)
  30. assert(package:has_cfuncs("ogg_sync_init", {includes = {"stdint.h", "ogg/ogg.h"}}))
  31. end)