xmake.lua 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. package("libvpx")
  2. set_homepage("https://chromium.googlesource.com/webm/libvpx/")
  3. set_description("libvpx is a free software video codec library from Google and the Alliance for Open Media (AOMedia)")
  4. set_license("BSD-3-Clause")
  5. add_urls("https://github.com/webmproject/libvpx/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/webmproject/libvpx.git",
  7. "https://chromium.googlesource.com/webm/libvpx.git")
  8. add_versions("v1.15.2", "26fcd3db88045dee380e581862a6ef106f49b74b6396ee95c2993a260b4636aa")
  9. add_versions("v1.15.1", "6cba661b22a552bad729bd2b52df5f0d57d14b9789219d46d38f73c821d3a990")
  10. add_versions("v1.15.0", "e935eded7d81631a538bfae703fd1e293aad1c7fd3407ba00440c95105d2011e")
  11. add_versions("v1.14.1", "901747254d80a7937c933d03bd7c5d41e8e6c883e0665fadcb172542167c7977")
  12. if not is_plat("windows") then
  13. add_deps("autoconf", "automake", "libtool", "m4", "yasm")
  14. end
  15. add_configs("vp8", {description = "enable the vp8 codec", default = false, type = "boolean"})
  16. add_configs("vp9", {description = "enable the vp9 codec", default = false, type = "boolean"})
  17. add_configs("vp9_post", {description = "vp9 specific postprocessing", default = false, type = "boolean"})
  18. add_configs("vp9_highbitdepth", {description = "use VP9 high bit depth (10/12) profiles", default = false, type = "boolean"})
  19. add_configs("postproc", {description = "postprocessing", default = false, type = "boolean"})
  20. add_configs("codec_srcs", {description = "in/exclude codec library source code", default = false, type = "boolean"})
  21. add_configs("webm_io", {description = "enable input from and output to WebM container", default = false, type = "boolean"})
  22. add_configs("libyuv", {description = "enable libyuv", default = false, type = "boolean"})
  23. on_load(function (package)
  24. if package:config("libyuv") then
  25. package:add("deps", "libyuv")
  26. end
  27. end)
  28. if on_check then
  29. on_check(function (package)
  30. if package:has_tool("cxx", "clang") and package:is_arch("x64", "x86_64") then
  31. raise("package(libvpx) unsupported clang toolchain")
  32. end
  33. end)
  34. end
  35. on_install("linux", "macosx", function (package)
  36. local configs = {"--disable-dependency-tracking", "--disable-examples", "--disable-docs", "--as=yasm", "--disable-unit-tests"}
  37. table.insert(configs, (package:config("shared") and "--enable-shared --disable-static" or "--disable-shared --enable-static"))
  38. table.insert(configs, (package:is_debug() and "--enable-debug" or ""))
  39. table.insert(configs, (package:config("vp8") and "--enable-vp8" or "--disable-vp8"))
  40. table.insert(configs, (package:config("vp9") and "--enable-vp9" or "--disable-vp9"))
  41. table.insert(configs, (package:config("vp9_post") and "--enable-vp9-postproc" or "--disable-vp9-postproc"))
  42. table.insert(configs, (package:config("vp9_highbitdepth") and "--enable-vp9-highbitdepth" or "--disable-vp9-highbitdepth"))
  43. table.insert(configs, (package:config("postproc") and "--enable-postproc" or "--disable-postproc"))
  44. table.insert(configs, (package:config("codec_srcs") and "--enable-codec-srcs" or ""))
  45. table.insert(configs, (package:config("webm_io") and "--enable-webm-io" or "--disable-webm-io"))
  46. table.insert(configs, (package:config("libyuv") and "--enable-libyuv" or "--disable-libyuv"))
  47. import("package.tools.autoconf").install(package, configs)
  48. end)
  49. on_test(function (package)
  50. assert(package:has_cfuncs("vpx_codec_build_config", {includes = "vpx/vpx_codec.h"}))
  51. if package:config("vp8") then
  52. assert(package:has_cfuncs("vpx_codec_encode", {includes = "vpx/vpx_encoder.h"}))
  53. end
  54. end)