xmake.lua 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. package("openal-soft")
  2. set_homepage("https://openal-soft.org")
  3. set_description("OpenAL Soft is a software implementation of the OpenAL 3D audio API.")
  4. set_license("LGPL-2.0")
  5. add_urls("https://github.com/kcat/openal-soft/archive/refs/tags/$(version).tar.gz", {version = function (version)
  6. return version:ge("1.21.0") and version or "openal-soft-" .. version
  7. end})
  8. add_urls("https://github.com/kcat/openal-soft.git")
  9. add_versions("1.24.3", "7e1fecdeb45e7f78722b776c5cf30bd33934b961d7fd2a11e0494e064cc631ce")
  10. add_versions("1.23.1", "dfddf3a1f61059853c625b7bb03de8433b455f2f79f89548cbcbd5edca3d4a4a")
  11. add_versions("1.22.2", "3e58f3d4458f5ee850039b1a6b4dac2343b3a5985a6a2e7ae2d143369c5b8135")
  12. add_versions("1.22.0", "814831a8013d7365dfd1917b27f1fb6e723f3be3fe1c6a7ff4516425d8392f68")
  13. add_versions("1.21.1", "8ac17e4e3b32c1af3d5508acfffb838640669b4274606b7892aa796ca9d7467f")
  14. if is_plat("mingw") and is_subhost("msys") then
  15. add_extsources("pacman::openal")
  16. elseif is_plat("linux") then
  17. add_extsources("pacman::openal", "apt::libopenal-dev")
  18. elseif is_plat("macosx") then
  19. add_extsources("brew::openal-soft")
  20. end
  21. add_deps("cmake")
  22. if is_plat("linux") then
  23. add_deps("libsndio")
  24. end
  25. if is_plat("windows", "mingw") then
  26. add_syslinks("ole32", "shell32", "user32", "winmm", "kernel32", "Avrt")
  27. if is_plat("mingw") then
  28. add_syslinks("uuid")
  29. end
  30. elseif is_plat("linux", "cross") then
  31. add_syslinks("dl", "pthread")
  32. elseif is_plat("bsd") then
  33. add_syslinks("stdthreads", "pthread")
  34. elseif is_plat("android") then
  35. add_syslinks("dl", "OpenSLES")
  36. elseif is_plat("macosx", "iphoneos") then
  37. add_frameworks("CoreAudio", "CoreFoundation", "AudioToolbox")
  38. end
  39. on_load(function (package)
  40. if not package:config("shared") then
  41. package:add("defines", "AL_LIBTYPE_STATIC")
  42. end
  43. end)
  44. on_install("windows", "linux", "mingw", "macosx", "android", "iphoneos", "cross", "bsd" , function (package)
  45. if (package:is_plat("linux") and linuxos.name() == "fedora") or package:is_plat("bsd") then
  46. -- https://github.com/kcat/openal-soft/issues/864
  47. io.replace("CMakeLists.txt", "if(HAVE_GCC_PROTECTED_VISIBILITY)", "if(0)", {plain = true})
  48. end
  49. local configs = {"-DALSOFT_EXAMPLES=OFF", "-DALSOFT_UTILS=OFF"}
  50. if package:config("shared") then
  51. table.insert(configs, "-DBUILD_SHARED_LIBS=ON")
  52. table.insert(configs, "-DLIBTYPE=SHARED")
  53. else
  54. table.insert(configs, "-DBUILD_SHARED_LIBS=OFF")
  55. table.insert(configs, "-DLIBTYPE=STATIC")
  56. end
  57. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  58. import("package.tools.cmake").install(package, configs)
  59. end)
  60. on_test(function (package)
  61. assert(package:has_cfuncs("alGetProcAddress", {includes = "AL/al.h"}))
  62. end)