add libvorbis (#211)

* Add libvorbis

* Try to fix libogg finding

* libvorbis: Fix table.insert

* libvorbis: Try to pass PC_OGG_INCLUDEDIR and PC_OGG_LIBDIR

* libogg: Patch for macOS

Backported from c8fca6b4a0

* fix libvorbis for libogg

Co-authored-by: Jérôme Leclercq <lynix680@gmail.com>
pull/215/head
ruki 4 years ago committed by GitHub
parent 21e20f146c
commit 6cb399f20f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 19
      packages/l/libogg/patches/1.3.4/macos_fix.patch
  2. 1
      packages/l/libogg/xmake.lua
  3. 38
      packages/l/libvorbis/xmake.lua

@ -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 <sys/types.h>
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__)

@ -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")

@ -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)
Loading…
Cancel
Save