xmake.lua 1.3 KB

12345678910111213141516171819202122232425262728293031
  1. package("libsndio")
  2. set_homepage("https://sndio.org")
  3. set_description("Sndio is a small audio and MIDI framework part of the OpenBSD project and ported to FreeBSD, Linux and NetBSD")
  4. set_urls("https://sndio.org/sndio-$(version).tar.gz")
  5. add_versions("1.9.0", "f30826fc9c07e369d3924d5fcedf6a0a53c0df4ae1f5ab50fe9cf280540f699a")
  6. if is_plat("linux") then
  7. add_deps("alsa-lib")
  8. end
  9. on_install("linux", "bsd", "macosx", function (package)
  10. import("package.tools.autoconf")
  11. local configs = {}
  12. local buildenvs = autoconf.buildenvs(package, {packagedeps = "alsa-lib"})
  13. if not package:config("shared") then
  14. io.replace("libsndio/Makefile.in",
  15. "${CC} ${LDFLAGS} ${SO_CFLAGS} ${SO_LDFLAGS} -o ${SO} ${OBJS} ${LDADD}",
  16. "${AR} ${ARFLAGS} libsndio.a ${OBJS}", {plain = true})
  17. io.replace("libsndio/Makefile.in", "cp -R ${SO} ${SO_LINK} ${DESTDIR}${LIB_DIR}",
  18. "cp libsndio.a ${DESTDIR}${LIB_DIR}", {plain = true})
  19. end
  20. autoconf.configure(package, configs, {envs = buildenvs})
  21. os.vrunv("make", {}, {envs = buildenvs})
  22. os.vrunv("make", {"install"}, {envs = buildenvs})
  23. end)
  24. on_test(function (package)
  25. assert(package:has_cfuncs("sio_open", {includes = "sndio.h"}))
  26. end)