From 47141712605b544105ccdb13bf04b2f010714747 Mon Sep 17 00:00:00 2001 From: elkPi Date: Sat, 28 Oct 2023 23:12:09 +0800 Subject: [PATCH] add bcg729 package (#2763) * package/b/bcg729 * bcg729: update description * bcg729: add tar.gz url * bcg729: fix shared/static not work * bcg729: fix static error * Update xmake.lua --------- Co-authored-by: ruki --- packages/b/bcg729/xmake.lua | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 packages/b/bcg729/xmake.lua diff --git a/packages/b/bcg729/xmake.lua b/packages/b/bcg729/xmake.lua new file mode 100644 index 000000000..f6a560856 --- /dev/null +++ b/packages/b/bcg729/xmake.lua @@ -0,0 +1,35 @@ +package("bcg729") + set_homepage("http://linphone.org") + set_description("Bcg729 is an opensource implementation of both encoder and decoder of the ITU G729 Annex A/B speech codec.") + + add_urls("https://github.com/BelledonneCommunications/bcg729/archive/refs/tags/$(version).tar.gz", + "https://github.com/BelledonneCommunications/bcg729.git") + add_versions("1.0.4", "94b3542a06cbd96306efc19f959f9febae62806a22599063f82a8c33e989d48b") + add_versions("1.1.1", "68599a850535d1b182932b3f86558ac8a76d4b899a548183b062956c5fdc916d") + + add_deps("cmake") + + on_load(function (package) + if not package:config("shared") then + package:add("defines", "BCG729_STATIC") + end + end) + + on_install(function (package) + local configs = {"-DENABLE_TESTS=OFF"} + table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release")) + if package:config("shared") then + table.insert(configs, "-DENABLE_SHARED=ON") + table.insert(configs, "-DENABLE_STATIC=OFF") + else + table.insert(configs, "-DENABLE_SHARED=OFF") + table.insert(configs, "-DENABLE_STATIC=ON") + end + + import("package.tools.cmake").install(package, configs) + end) + + on_test(function (package) + assert(package:has_cfuncs("bcg729Decoder", {includes = "bcg729/decoder.h"})) + assert(package:has_cfuncs("bcg729Encoder", {includes = "bcg729/encoder.h"})) + end)