diff --git a/packages/l/libogg/patches/1.3.4/macos_fix.patch b/packages/l/libogg/patches/1.3.4/macos_fix.patch new file mode 100644 index 000000000..d2ac27be4 --- /dev/null +++ b/packages/l/libogg/patches/1.3.4/macos_fix.patch @@ -0,0 +1,19 @@ +diff --git a/include/ogg/os_types.h b/include/ogg/os_types.h +index eb8a322..e655a1d 100644 +--- a/include/ogg/os_types.h ++++ b/include/ogg/os_types.h +@@ -72,11 +72,11 @@ + + # include + typedef int16_t ogg_int16_t; +- typedef uint16_t ogg_uint16_t; ++ typedef u_int16_t ogg_uint16_t; + typedef int32_t ogg_int32_t; +- typedef uint32_t ogg_uint32_t; ++ typedef u_int32_t ogg_uint32_t; + typedef int64_t ogg_int64_t; +- typedef uint64_t ogg_uint64_t; ++ typedef u_int64_t ogg_uint64_t; + + #elif defined(__HAIKU__) + diff --git a/packages/l/libogg/xmake.lua b/packages/l/libogg/xmake.lua index bbf0954b2..82911d2f1 100644 --- a/packages/l/libogg/xmake.lua +++ b/packages/l/libogg/xmake.lua @@ -6,6 +6,7 @@ package("libogg") set_urls("https://downloads.xiph.org/releases/ogg/libogg-$(version).tar.gz", "https://gitlab.xiph.org/xiph/ogg.git") add_versions("1.3.4", "fe5670640bd49e828d64d2879c31cb4dde9758681bb664f9bdbf159a01b0c76e") + add_patches("1.3.4", path.join(os.scriptdir(), "patches", "1.3.4", "macos_fix.patch"), "e12c41ad71206777f399c1048914e5e5a2fe44e18d0d50ebe9bedbfbe0624c35") add_deps("cmake") diff --git a/packages/l/libvorbis/xmake.lua b/packages/l/libvorbis/xmake.lua new file mode 100644 index 000000000..49db352e6 --- /dev/null +++ b/packages/l/libvorbis/xmake.lua @@ -0,0 +1,38 @@ +package("libvorbis") + + set_homepage("https://xiph.org/vorbis") + set_description("Reference implementation of the Ogg Vorbis audio format.") + set_license("BSD-3") + + set_urls("https://ftp.osuosl.org/pub/xiph/releases/vorbis/libvorbis-$(version).tar.gz", + "https://github.com/xiph/vorbis/releases/download/v$(version)/libvorbis-$(version).tar.gz", + "https://gitlab.xiph.org/xiph/vorbis.git") + + add_versions("1.3.7", "0e982409a9c3fc82ee06e08205b1355e5c6aa4c36bca58146ef399621b0ce5ab") + + add_deps("cmake", "libogg") + + on_install("windows", "linux", "macosx", "iphoneos", "mingw", "android", function (package) + local configs = {} + table.insert(configs, "-DBUILD_TESTING=OFF") + table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release")) + table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF")) + -- we pass libogg as packagedeps instead of findOgg.cmake (it does not work) + local libogg = package:dep("libogg"):fetch() + if libogg then + local links = table.concat(table.wrap(libogg.links), " ") + io.replace("CMakeLists.txt", "find_package(Ogg REQUIRED)", "", {plain = true}) + io.replace("lib/CMakeLists.txt", "Ogg::ogg", links, {plain = true}) + end + -- disable .def file for mingw + if package:config("shared") and package:is_plat("mingw") then + io.replace("lib/CMakeLists.txt", [[list(APPEND VORBIS_SOURCES ../win32/vorbis.def) + list(APPEND VORBISENC_SOURCES ../win32/vorbisenc.def) + list(APPEND VORBISFILE_SOURCES ../win32/vorbisfile.def)]], "", {plain = true}) + end + import("package.tools.cmake").install(package, configs, {packagedeps = "libogg"}) + end) + + on_test(function (package) + assert(package:has_cfuncs("vorbis_info_init", {includes = "vorbis/codec.h"})) + end)