浏览代码

pulseaudio: add new package (#7695)

* pulseaudio: add new package

* change link for libatomic_ops package

* try to find fftw3f

* try to find sndfile and its dependencies properly

* try to fix 4 FindCMakes

* fix vorbis NDK

* fix libsndfile NDK

* try to repair libsndfile

* redo

* try repair FLAC

* fixup

* re

* do not os.rm

* do no os.rm

* fixup

* fixup

* fixup

* fixup

* re

* we pass libogg as packagedeps instead of findOgg.cmake (it does not work)

* tackle ci

* check what happens if we pass deps into packagedeps for libsndfile

* Update xmake.lua

* Update xmake.lua

* pass libiconv into packagedeps of pulseaudio along with libsndfile deps

* try fix linux-arm64

* try fix MSYS2 tar and gz check by Reverting snapshot provision

* try fix static lib visibility

* resolve conf

* fixup

* fixup

* fixup

* Delete packages/s/soxr/patches/0.1.3/fix-arm64.diff

* Update xmake.lua

* Try resolve soxr

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* Try without http headers assuming that website was under maintance

* Try to use debian git as mirror

* Update xmake.lua

* Update xmake.lua

---------

Co-authored-by: ruki <[email protected]>
Saikari 1 月之前
父节点
当前提交
994208d963

+ 13 - 0
packages/l/libsndfile/patches/1.2.2/do-not-install-find.diff

@@ -0,0 +1,13 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index b501f088..f1c9c914 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -856,7 +856,7 @@ if (ENABLE_PACKAGE_CONFIG)
+ 		DESTINATION	${CMAKE_INSTALL_PACKAGEDIR}
+ 		)
+ 
+-		if (NOT BUILD_SHARED_LIBS AND FIND_MODULES_INSTALL_LIST)
++		if (0)
+ 			file(COPY ${FIND_MODULES_INSTALL_LIST} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
+ 			install(FILES ${FIND_MODULES_INSTALL_LIST} DESTINATION ${CMAKE_INSTALL_PACKAGEDIR})
+ 		endif ()

+ 32 - 0
packages/l/libsndfile/patches/1.2.2/do-not-set-cmake-module-path.diff

@@ -0,0 +1,32 @@
+diff --git a/cmake/SndFileConfig.cmake.in b/cmake/SndFileConfig.cmake.in
+index f3923357..f9b118b7 100644
+--- a/cmake/SndFileConfig.cmake.in
++++ b/cmake/SndFileConfig.cmake.in
+@@ -10,25 +10,19 @@ set (SndFile_WITH_MPEG @SndFile_WITH_MPEG@)
+ 
+ include (CMakeFindDependencyMacro)
+ 
+-if (NOT @BUILD_SHARED_LIBS@)
+-	list (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
+-endif ()
+ 
+-if (SndFile_WITH_EXTERNAL_LIBS AND NOT @BUILD_SHARED_LIBS@)
++if (SndFile_WITH_EXTERNAL_LIBS)
+ 	find_dependency (Ogg 1.3)
+ 	find_dependency (Vorbis)
+ 	find_dependency (FLAC)
+ 	find_dependency (Opus)
+ endif ()
+ 
+-if (SndFile_WITH_MPEG AND NOT @BUILD_SHARED_LIBS@)
++if (SndFile_WITH_MPEG)
+ 	find_dependency (mp3lame)
+ 	find_dependency (mpg123)
+ endif ()
+ 
+-if (NOT @BUILD_SHARED_LIBS@)
+-	list (REMOVE_ITEM CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
+-endif ()
+ 
+ include (${CMAKE_CURRENT_LIST_DIR}/SndFileTargets.cmake)
+ 

+ 18 - 5
packages/l/libsndfile/xmake.lua

@@ -1,15 +1,23 @@
 package("libsndfile")
-
     set_homepage("https://libsndfile.github.io/libsndfile/")
     set_description("A C library for reading and writing sound files containing sampled audio data.")
     set_license("LGPL-2.1")
 
     add_urls("https://github.com/libsndfile/libsndfile/archive/refs/tags/$(version).tar.gz",
              "https://github.com/libsndfile/libsndfile.git")
+
     add_versions("1.2.2", "ffe12ef8add3eaca876f04087734e6e8e029350082f3251f565fa9da55b52121")
     add_versions("1.0.31", "8cdee0acb06bb0a3c1a6ca524575643df8b1f3a55a0893b4dd9f829d08263785")
 
-    add_deps("cmake", "libflac", "libopus", "libvorbis", "libogg")
+    add_patches("1.2.2", "patches/1.2.2/do-not-install-find.diff", "008f66254b7d0f7602b3c6153a0e9b2c74395c9e9cc0e2e75784a6ed8eb23209")
+    add_patches("1.2.2", "patches/1.2.2/do-not-set-cmake-module-path.diff", "d59b50d14dca44485aae56ae27456779b0a38c0cfec9785bab500d31cf35188e")
+
+    add_deps("cmake")
+    add_deps("libflac", "libopus", "libvorbis", "libogg")
+
+    if is_plat("linux", "bsd") then
+        add_syslinks("m")
+    end
 
     on_load("windows", "linux", "macosx", "iphoneos", "mingw", "android", function (package)
         if package:config("shared") then
@@ -18,11 +26,16 @@ package("libsndfile")
     end)
 
     on_install("windows", "linux", "macosx", "iphoneos", "mingw", "android", function (package)
-        local configs = {}
+        -- we pass libogg as packagedeps instead of findOgg.cmake (it does not work)
+        io.replace("cmake/SndFileChecks.cmake", [[find_package (Ogg 1.3 CONFIG)]], [[]], {plain = true})
+        local configs = {
+            "-DCMAKE_POLICY_DEFAULT_CMP0057=NEW",
+            "-DCMAKE_FIND_PACKAGE_PREFER_CONFIG=ON"
+        }
         table.insert(configs, "-DBUILD_PROGRAMS=OFF")
         table.insert(configs, "-DBUILD_EXAMPLES=OFF")
         table.insert(configs, "-DBUILD_TESTING=OFF")
-        table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
+        table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
         table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
         table.insert(configs, "-DENABLE_MPEG=OFF")
 
@@ -34,7 +47,7 @@ package("libsndfile")
                 cmake:close()
             end
         end
-        import("package.tools.cmake").install(package, configs)
+        import("package.tools.cmake").install(package, configs, {packagedeps = "libogg"})
    end)
 
     on_test(function (package)

+ 90 - 0
packages/p/pulseaudio/xmake.lua

@@ -0,0 +1,90 @@
+package("pulseaudio")
+    set_homepage("https://www.freedesktop.org/wiki/Software/PulseAudio/")
+    set_description("A featureful, general-purpose sound server")
+    set_license("LGPL-2.1-or-later")
+
+    add_urls("https://github.com/pulseaudio/pulseaudio/archive/refs/tags/$(version).tar.gz",
+             "https://github.com/pulseaudio/pulseaudio.git")
+    add_versions("v17.0", "ed36c8a0cdff7b57382a258d3e1a916f42500fbafd64dd3c2e258ed8f017ee90")
+
+    add_configs("shared", {description = "Build shared library.", default = true, type = "boolean", readonly = true})
+
+    add_extsources("pkgconfig::libpulse")
+    if is_plat("linux") then
+        add_extsources("pacman::libpulse", "apt::libpulse-dev")
+    end
+
+    if is_plat("linux", "bsd") then
+        add_syslinks("pthread")
+    end
+
+    add_deps("meson", "ninja")
+    if is_plat("linux") then
+        add_deps("alsa-lib")
+    end
+    add_deps("dbus", "fftw", "glib", "jack2", "libatomic_ops", "libiconv", "libsndfile", "openssl3", "soxr", "speex")
+
+    on_install("linux", function (package)
+        -- FFTW dependency has broken CMakeConfig
+        io.replace("meson.build",
+            "fftw_dep = dependency('fftw3f', required : get_option('fftw'))",
+            "fftw_dep = dependency('fftw3', method: 'pkg-config', required : get_option('fftw'))", {plain = true})
+        -- SndFile dependency has 4 FindDep.cmake files
+        io.replace("meson.build",
+            "sndfile_dep = dependency('sndfile', version : '>= 1.0.20')",
+            "sndfile_dep = dependency('SndFile', method: 'cmake')", {plain = true})
+        if package:version_str() then
+            local v = package:version_str():gsub("v", "")
+            io.writefile(".tarball-version", v)
+            os.rm("git-version-gen")
+            io.replace("meson.build",
+                "run_command(find_program('git-version-gen'), join_paths(meson.current_source_dir(), '.tarball-version'), check : false).stdout().strip()",
+                "'" .. v .. "'", {plain = true})
+        end
+        local configs = {
+            "-Dgstreamer=disabled",
+            "-Ddaemon=false",
+            "-Dclient=true",
+            "-Ddoxygen=false",
+            "-Dgcov=false",
+            "-Dman=false",
+            "-Dtests=false",
+            "-Dbashcompletiondir=no",
+            "-Dzshcompletiondir=no",
+            "-Dasyncns=disabled",
+            "-Davahi=disabled",
+            "-Dbluez5=disabled",
+            "-Dconsolekit=disabled",
+            "-Ddbus=enabled",
+            "-Delogind=disabled",
+            "-Dfftw=enabled",
+            "-Dglib=enabled",
+            "-Dgsettings=disabled",
+            "-Dgtk=disabled",
+            "-Dhal-compat=false",
+            "-Dipv6=true",
+            "-Djack=enabled",
+            "-Dlirc=enabled",
+            "-Dopenssl=enabled",
+            "-Dorc=disabled",
+            "-Dsoxr=enabled",
+            "-Dspeex=enabled",
+            "-Dsystemd=disabled",
+            "-Dtcpwrap=disabled",
+            "-Dudev=disabled",
+            "-Dvalgrind=disabled",
+            "-Dx11=disabled",
+            "-Dadrian-aec=false",
+            "-Dwebrtc-aec=disabled"
+        }
+
+        table.insert(configs, "-Dalsa=" .. (package:is_plat("linux") and "enabled" or "disabled"))
+        table.insert(configs, "-Doss-output=" .. (package:is_plat("linux") and "enabled" or "disabled"))
+        table.insert(configs, "-Ddefault_library=" .. (package:config("shared") and "shared" or "static"))
+        
+        import("package.tools.meson").install(package, configs, {packagedeps = {"libiconv", "libflac", "libopus", "libvorbis", "libogg"}})
+    end)
+
+    on_test(function (package)
+        assert(package:has_cfuncs("pa_simple_new", {includes = "pulse/simple.h"}))
+    end)

+ 3 - 9
packages/s/soxr/xmake.lua

@@ -3,21 +3,15 @@ package("soxr")
     set_description("The SoX Resampler library libsoxr performs fast, high-quality one-dimensional sample rate conversion.")
     set_license("LGPL-2.1")
 
-    add_urls("https://sourceforge.net/code-snapshots/git/s/so/soxr/code.git/soxr-code-$(version).zip", {alias = "snapshot", version = function (version)
-        local versions = {
-            ["0.1.3"] = "945b592b70470e29f917f4de89b4281fbbd540c0"
-        }
-        return versions[tostring(version)]
-    end})
+    add_urls("https://salsa.debian.org/multimedia-team/libsoxr/-/archive/upstream/$(version)/libsoxr-upstream-$(version).zip")
 
-    add_versions("snapshot:0.1.3", "b797a5d23078be234e520af1041b5e11b49864696d56f0d0b022a0349d1e8d1b")
+    add_versions("0.1.3", "b755c59aa3eebeb7fb5591fc606bf56f4214d86d3668886ac6df48d3a9552817")
 
     add_configs("openmp",   {description = "Include OpenMP threading.", default = false, type = "boolean"})
     add_configs("lsr",      {description = "Include a `libsamplerate'-like interface.", default = true, type = "boolean"})
     if is_plat("mingw") and is_subhost("macosx") then
         add_configs("shared", {description = "Build shared library.", default = true, type = "boolean", readonly = true})
-    end
-    if is_plat("linux") and is_arch("arm64") then
+    elseif is_plat("linux") and is_arch("arm64") then
         add_configs("shared", {description = "Build shared library.", default = true, type = "boolean", readonly = true})
     end