xmake.lua 1.6 KB

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