xmake.lua 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package("mpg123")
  2. set_homepage("https://www.mpg123.de/")
  3. set_description("Fast console MPEG Audio Player and decoder library")
  4. set_license("LGPL-2.1-or-later")
  5. add_urls("https://github.com/libsdl-org/mpg123.git", {alias = "git"})
  6. add_urls("https://sourceforge.net/projects/mpg123/files/mpg123/$(version)/mpg123-$(version).tar.bz2",
  7. "https://www.mpg123.de/download/mpg123-$(version).tar.bz2")
  8. add_versions("1.33.4", "3ae8c9ff80a97bfc0e22e89fbcd74687eca4fc1db315b12607f27f01cb5a47d9")
  9. add_versions("1.30.2", "c7ea863756bb79daed7cba2942ad3b267a410f26d2dfbd9aaf84451ff28a05d7")
  10. add_versions("git:1.33.4", "2eb4320e161247a15f991a30e7919902a3629f19")
  11. if is_plat("linux") then
  12. add_syslinks("m")
  13. elseif is_plat("windows", "mingw") then
  14. add_syslinks("shlwapi")
  15. end
  16. add_deps("cmake")
  17. if is_plat("windows") then
  18. add_deps("yasm")
  19. end
  20. on_install(function (package)
  21. if package:is_plat("windows") and package:config("shared") then
  22. package:add("defines", "LINK_MPG123_DLL")
  23. end
  24. -- fix detect error
  25. if package:is_arch("arm.*") then
  26. io.replace("ports/cmake/src/CMakeLists.txt",
  27. "cmake_host_system_information(RESULT HAVE_FPU QUERY HAS_FPU)",
  28. "set(HAVE_FPU 1)", {plain = true})
  29. end
  30. local configs = {"-DBUILD_PROGRAMS=OFF"}
  31. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  32. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  33. os.cd("ports/cmake")
  34. import("package.tools.cmake").install(package, configs)
  35. end)
  36. on_test(function (package)
  37. assert(package:has_cfuncs("mpg123_init", {includes = "mpg123.h"}))
  38. end)