Skip to content

Commit 6923326

Browse files
authored
Merge pull request #171902 from Homebrew/gstreamer-libnice
gstreamer 1.24.8 + break circular dependency between gstreamer and libnice
2 parents ed63664 + 41dd247 commit 6923326

File tree

4 files changed

+263
-29
lines changed

4 files changed

+263
-29
lines changed

Formula/g/gstreamer.rb

+33-19
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,26 @@ class Gstreamer < Formula
44
license all_of: ["LGPL-2.0-or-later", "LGPL-2.1-or-later", "MIT"]
55

66
stable do
7-
url "https://gitlab.freedesktop.org/gstreamer/gstreamer/-/archive/1.24.7/gstreamer-1.24.7.tar.bz2"
8-
sha256 "72b4454664dac0a0816dcddf673206296ad3b974afcbdb9a8cecddcc14312aa6"
7+
url "https://gitlab.freedesktop.org/gstreamer/gstreamer/-/archive/1.24.8/gstreamer-1.24.8.tar.bz2"
8+
sha256 "41fd1325acebb69cec23a46c6c2fe68b4bcf9b25c392b94ffadb3b222bb2422b"
9+
10+
# Fix build failure with new gobject-introspection
11+
# https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7554
12+
patch do
13+
url "https://gitlab.freedesktop.org/gstreamer/gstreamer/-/commit/f1aedd65f4c276578b767b4555ba7cdf68fe024b.diff"
14+
sha256 "830de511c0c6c53fc96b16acc03d433c0942ab5686afca5d3386dd77cc7d7c13"
15+
end
16+
17+
# Backport fix for build of gst-plugins-rs when using uninstalled pkgconfig files
18+
patch do
19+
url "https://gitlab.freedesktop.org/gstreamer/gstreamer/-/commit/6ce72488face35277643d3781d3da7c4f95d5e1e.diff"
20+
sha256 "e8526ba4da7a92904a0e55608bacb3ca823f60c398a922877b5945f65c5ddbfb"
21+
end
922

1023
# When updating this resource, use the tag that matches the GStreamer version.
1124
resource "rs" do
12-
url "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/archive/gstreamer-1.24.7/gst-plugins-rs-gstreamer-1.24.7.tar.bz2"
13-
sha256 "0d499a6854920c31034587bbbabbddbf8b3949387ceb615749a80998da9d440f"
25+
url "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/archive/gstreamer-1.24.8/gst-plugins-rs-gstreamer-1.24.8.tar.bz2"
26+
sha256 "a355edefea2d2de555fad9702079fe219e6c071198fe811a4692b5b48cb7b139"
1427

1528
# Backport support for newer `dav1d`
1629
# upstream commit ref, https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/commit/7e1ab086de00125bc0d596f9ec5d74c9b82b2cc0
@@ -19,12 +32,6 @@ class Gstreamer < Formula
1932
sha256 "d17677a523af021b226969937550f19151b8042f6962eae9fa39ee0e0fc0fe3a"
2033
end
2134
end
22-
23-
# Backport fix for build of gst-plugins-rs when using uninstalled pkgconfig files
24-
patch do
25-
url "https://gitlab.freedesktop.org/gstreamer/gstreamer/-/commit/6ce72488face35277643d3781d3da7c4f95d5e1e.diff"
26-
sha256 "e8526ba4da7a92904a0e55608bacb3ca823f60c398a922877b5945f65c5ddbfb"
27-
end
2835
end
2936

3037
livecheck do
@@ -33,14 +40,12 @@ class Gstreamer < Formula
3340
end
3441

3542
bottle do
36-
sha256 arm64_sequoia: "31db92e94215659739a7340e68ff40f81cca067ff758b0c4eaeeb19210e62092"
37-
sha256 arm64_sonoma: "9d246b779b36a42346004b290306cfc47e7d5ededc0d9d999579fd6d6d61d04a"
38-
sha256 arm64_ventura: "70ef869e83ab51ab6ce41ad6dc0e25e45feb35212a1d1be8824452f719d26ba9"
39-
sha256 arm64_monterey: "cd4f6f35e5c7106882f96a1b77c89ad5a80da324845bc097ce454cb68b2b3797"
40-
sha256 sonoma: "d2340cb25e37bf8ae84711ed43371bbfa26d7c703e0a4f49db339e9407a54c31"
41-
sha256 ventura: "1f2cb4177eaa2ac93b3e587a6a4ccc8436caf2c6eb39dd002bc69200b29fac6a"
42-
sha256 monterey: "66efa6fbcfff8e0411e68c451b4273ae735e5f03686a854cb4650df0206f8a88"
43-
sha256 x86_64_linux: "6c8884c463bc4e9cdb5cc0e3cadbd2695ea24df7beeddd65a7d4284213c0230e"
43+
sha256 arm64_sequoia: "2b78738e0893b28d52f68de60508ba108dff7fae0b0d5116bbfb018703a0429e"
44+
sha256 arm64_sonoma: "eb3792c3ea9d153078b219d3797c3a824152bba0aa02f04ec5522caebb7c6a8e"
45+
sha256 arm64_ventura: "c4283b905bea61bd5f35a8ba1fbf0e49f7d9156ef4881662e21379bfeb2fa001"
46+
sha256 sonoma: "bdd6b82100b185a381283b7a715cb381615abb8a4e5088ff41724c4fade0924e"
47+
sha256 ventura: "a6114eb5ae706e12af0725c721f603aa70601ca1263339eeaaa4625014e396ad"
48+
sha256 x86_64_linux: "cb1222dc5819548797e7bbef657ad88d799b357b44c6be5b8a0b7cda8de1d1b1"
4449
end
4550

4651
head do
@@ -78,6 +83,7 @@ class Gstreamer < Formula
7883
depends_on "json-glib"
7984
depends_on "lame"
8085
depends_on "libass"
86+
depends_on "libnice"
8187
depends_on "libogg"
8288
depends_on "libpng"
8389
depends_on "libshout"
@@ -223,7 +229,7 @@ def install
223229
# https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/279
224230
plugin_dir = lib/"gstreamer-1.0"
225231
rpath_args = [loader_path, rpath(source: plugin_dir)].map { |path| "-rpath,#{path}" }
226-
ENV["RUSTFLAGS"] = "--codegen link-args=-Wl,#{rpath_args.join(",")}"
232+
ENV.append "RUSTFLAGS", "--codegen link-args=-Wl,#{rpath_args.join(",")}"
227233
inreplace "subprojects/gst-plugins-rs/cargo_wrapper.py",
228234
"env['RUSTFLAGS'] = shlex_join(rust_flags)",
229235
"env['RUSTFLAGS'] = ' '.join(rust_flags)"
@@ -237,6 +243,14 @@ def install
237243
system "meson", "install", "-C", "build"
238244
end
239245

246+
def post_install
247+
# Support finding the `libnice` plugin, which is in a separate formula.
248+
# Needs to be done in `post_install`, since bottling prunes this symlink.
249+
libnice_gst_plugin = Formula["libnice-gstreamer"].opt_libexec/"gstreamer-1.0"/shared_library("libgstnice")
250+
gst_plugin_dir = lib/"gstreamer-1.0"
251+
ln_sf libnice_gst_plugin.relative_path_from(gst_plugin_dir), gst_plugin_dir
252+
end
253+
240254
def caveats
241255
<<~EOS
242256
All gst-* GStreamer plugins are now bundled in this formula.

Formula/lib/libnice-gstreamer.rb

+221
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,221 @@
1+
class LibniceGstreamer < Formula
2+
desc "GStreamer Plugin for libnice"
3+
homepage "https://wiki.freedesktop.org/nice/"
4+
url "https://libnice.freedesktop.org/releases/libnice-0.1.22.tar.gz"
5+
sha256 "a5f724cf09eae50c41a7517141d89da4a61ec9eaca32da4a0073faed5417ad7e"
6+
license any_of: ["LGPL-2.1-only", "MPL-1.1"]
7+
8+
livecheck do
9+
formula "libnice"
10+
end
11+
12+
bottle do
13+
sha256 cellar: :any, arm64_sequoia: "aa2003f8a95578016094c529b41b9e0afae4124421796c7917f2af3dee116c41"
14+
sha256 cellar: :any, arm64_sonoma: "e78f31b88426c267bd4ccc9626494130fe1f02cf2279a2941f32b96f825e0742"
15+
sha256 cellar: :any, arm64_ventura: "b2c462902cec4eb8b59e895c9b2cc9e027b42d1421dcf0f8199c9ee41bace504"
16+
sha256 cellar: :any, sonoma: "f1289203e767492cbe9662b55f2a57f475756599cd76bee48496236f544bf52f"
17+
sha256 cellar: :any, ventura: "919a1d68e6aee4608a4de25f0ca4db6e9619d8721f83c638b9426531116a92e4"
18+
sha256 x86_64_linux: "7afcec37ace358ed8bbd079e36333af68605f2d592828ffdf3dc492c7dc7e963"
19+
end
20+
21+
depends_on "meson" => :build
22+
depends_on "ninja" => :build
23+
depends_on "pkg-config" => [:build, :test]
24+
depends_on "glib"
25+
depends_on "gnutls"
26+
depends_on "gstreamer"
27+
depends_on "libnice"
28+
29+
on_macos do
30+
depends_on "gettext"
31+
end
32+
33+
on_linux do
34+
depends_on "intltool" => :build
35+
end
36+
37+
# Enable building only the gstreamer plugin
38+
# https://gitlab.freedesktop.org/libnice/libnice/-/merge_requests/271
39+
patch :DATA
40+
41+
def install
42+
system "meson", "setup", "build", "-Dgstreamer=enabled", "-Dgstreamer-plugin-only=true", *std_meson_args
43+
system "meson", "compile", "-C", "build", "--verbose"
44+
system "meson", "install", "-C", "build"
45+
46+
# Move the gstreamer plugin out of the way to prevent `brew link` conflicts.
47+
libexec.install lib/"gstreamer-1.0"
48+
end
49+
50+
test do
51+
system "gst-inspect-1.0", "--exists", "nicesrc"
52+
end
53+
end
54+
55+
__END__
56+
From aa632be3d9f2e7ec309a1312ddb7ff4cc538ea2e Mon Sep 17 00:00:00 2001
57+
From: Nirbheek Chauhan <nirbheek@centricular.com>
58+
Date: Wed, 21 Feb 2024 18:15:51 +0530
59+
Subject: [PATCH] meson: Add an option to build only the gstreamer plugin
60+
61+
This is one possible approach to break the circular dep between
62+
gstreamer and libnice.
63+
---
64+
.gitlab-ci.yml | 12 ++++++++++++
65+
gst/gstnicesink.h | 2 +-
66+
gst/gstnicesrc.h | 2 +-
67+
gst/meson.build | 3 ++-
68+
meson.build | 32 +++++++++++++++++++++-----------
69+
meson_options.txt | 2 ++
70+
6 files changed, 39 insertions(+), 14 deletions(-)
71+
72+
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
73+
index 88102067..00b8dff1 100644
74+
--- a/.gitlab-ci.yml
75+
+++ b/.gitlab-ci.yml
76+
@@ -89,6 +89,18 @@ build:
77+
paths:
78+
- build/
79+
80+
+build gstreamer-plugin-only:
81+
+ stage: build
82+
+ extends:
83+
+ - build
84+
+ script:
85+
+ ## && true to make gitlab-ci happy
86+
+ - source scl_source enable rh-python36 && true
87+
+ - meson --werror --warnlevel 2 -Dgtk_doc=enabled -Dgstreamer=disabled -Dgstreamer-plugin-only=false --prefix=$PREFIX -Db_coverage=true build_libs/
88+
+ - ninja -C build_libs install
89+
+ - meson --werror --warnlevel 2 -Dgstreamer=enabled -Dgstreamer-plugin-only=true --prefix=$PREFIX -Db_coverage=true --pkg-config-path=$PREFIX/lib64/pkgconfig build_plugin/
90+
+ - ninja -C build_plugin/ install
91+
+
92+
93+
.build windows:
94+
image: 'registry.freedesktop.org/gstreamer/gstreamer/amd64/windows:2023-08-24.0-main'
95+
diff --git a/gst/gstnicesink.h b/gst/gstnicesink.h
96+
index b9e6e6c5..49c2d5ce 100644
97+
--- a/gst/gstnicesink.h
98+
+++ b/gst/gstnicesink.h
99+
@@ -41,7 +41,7 @@
100+
#include <gst/gst.h>
101+
#include <gst/base/gstbasesink.h>
102+
103+
-#include <nice/nice.h>
104+
+#include <nice.h>
105+
106+
G_BEGIN_DECLS
107+
108+
diff --git a/gst/gstnicesrc.h b/gst/gstnicesrc.h
109+
index 9d00bfaa..8b906e6f 100644
110+
--- a/gst/gstnicesrc.h
111+
+++ b/gst/gstnicesrc.h
112+
@@ -41,7 +41,7 @@
113+
#include <gst/gst.h>
114+
#include <gst/base/gstpushsrc.h>
115+
116+
-#include <nice/nice.h>
117+
+#include <nice.h>
118+
119+
G_BEGIN_DECLS
120+
121+
diff --git a/gst/meson.build b/gst/meson.build
122+
index 4ed4794f..31e3e5fb 100644
123+
--- a/gst/meson.build
124+
+++ b/gst/meson.build
125+
@@ -8,10 +8,11 @@ gst_nice_args = ['-DGST_USE_UNSTABLE_API']
126+
127+
gst_plugins_install_dir = join_paths(get_option('libdir'), 'gstreamer-1.0')
128+
129+
+configure_file(output : 'config.h', configuration : cdata)
130+
+
131+
libgstnice = library('gstnice',
132+
gst_nice_sources,
133+
c_args : gst_nice_args,
134+
- include_directories: nice_incs,
135+
dependencies: [libnice_dep, gst_dep],
136+
install_dir: gst_plugins_install_dir,
137+
install: true)
138+
diff --git a/meson.build b/meson.build
139+
index 4faffb40..81cd7eaf 100644
140+
--- a/meson.build
141+
+++ b/meson.build
142+
@@ -31,6 +31,7 @@ nice_datadir = join_paths(get_option('prefix'), get_option('datadir'))
143+
144+
cc = meson.get_compiler('c')
145+
static_build = get_option('default_library') == 'static'
146+
+gstreamer_plugin_only = get_option('gstreamer-plugin-only')
147+
148+
syslibs = []
149+
150+
@@ -79,12 +80,17 @@ add_project_arguments('-D_GNU_SOURCE',
151+
'-DHAVE_CONFIG_H',
152+
'-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_' + glib_req_minmax_str,
153+
'-DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_' + glib_req_minmax_str,
154+
- '-DNICE_VERSION_MAJOR=' + version_major,
155+
- '-DNICE_VERSION_MINOR=' + version_minor,
156+
- '-DNICE_VERSION_MICRO=' + version_micro,
157+
- '-DNICE_VERSION_NANO=' + version_nano,
158+
language: 'c')
159+
160+
+if not gstreamer_plugin_only
161+
+ add_project_arguments(
162+
+ '-DNICE_VERSION_MAJOR=' + version_major,
163+
+ '-DNICE_VERSION_MINOR=' + version_minor,
164+
+ '-DNICE_VERSION_MICRO=' + version_micro,
165+
+ '-DNICE_VERSION_NANO=' + version_nano,
166+
+ language: 'c')
167+
+endif
168+
+
169+
cdata = configuration_data()
170+
171+
cdata.set_quoted('PACKAGE_STRING', meson.project_name())
172+
@@ -296,11 +302,15 @@ endif
173+
174+
gir = find_program('g-ir-scanner', required : get_option('introspection'))
175+
176+
-subdir('agent')
177+
-subdir('stun')
178+
-subdir('socket')
179+
-subdir('random')
180+
-subdir('nice')
181+
+if gstreamer_plugin_only
182+
+ libnice_dep = dependency('nice', version: '=' + meson.project_version())
183+
+else
184+
+ subdir('agent')
185+
+ subdir('stun')
186+
+ subdir('socket')
187+
+ subdir('random')
188+
+ subdir('nice')
189+
+endif
190+
191+
if gst_dep.found()
192+
subdir('gst')
193+
@@ -316,11 +326,11 @@ else
194+
endif
195+
endif
196+
197+
-if not get_option('tests').disabled()
198+
+if not gstreamer_plugin_only and not get_option('tests').disabled()
199+
subdir('tests')
200+
endif
201+
202+
-if not get_option('examples').disabled()
203+
+if not gstreamer_plugin_only and not get_option('examples').disabled()
204+
subdir('examples')
205+
endif
206+
207+
diff --git a/meson_options.txt b/meson_options.txt
208+
index cd980cb5..cd7c879b 100644
209+
--- a/meson_options.txt
210+
+++ b/meson_options.txt
211+
@@ -2,6 +2,8 @@ option('gupnp', type: 'feature', value: 'auto',
212+
description: 'Enable or disable GUPnP IGD support')
213+
option('gstreamer', type: 'feature', value: 'auto',
214+
description: 'Enable or disable build of GStreamer plugins')
215+
+option('gstreamer-plugin-only', type: 'boolean', value: 'false',
216+
+ description: 'Only build the gstreamer plugin, for breaking the circular dependency')
217+
option('ignored-network-interface-prefix', type: 'array', value: ['docker', 'veth', 'virbr', 'vnet'],
218+
description: 'Ignore network interfaces whose name starts with a string from this list in the ICE connection check algorithm. For example, "virbr" to ignore virtual bridge interfaces added by virtd, which do not help in finding connectivity.')
219+
option('crypto-library', type: 'combo', choices : ['auto', 'gnutls', 'openssl'], value : 'auto')
220+
--
221+
GitLab

Formula/lib/libnice.rb

+8-10
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,13 @@ class Libnice < Formula
1111
end
1212

1313
bottle do
14-
sha256 cellar: :any, arm64_sequoia: "ba8cba3efa990c2900e54222096d5ea1f25cc1b85cb6f4ca891d386f4b26a48a"
15-
sha256 cellar: :any, arm64_sonoma: "561998831e0aa0fd61bd6ba913249959b5990a527f3b201151acebb9ba36e166"
16-
sha256 cellar: :any, arm64_ventura: "864676854f73e9d95de61dfd004f4e49e161fcca41a58b2aab7e6d2f03e1715d"
17-
sha256 cellar: :any, arm64_monterey: "c0b2d5e710b9748cb14804ccfc32b8f08949f4212313c0c3eed8b74fb0b2e3a9"
18-
sha256 cellar: :any, sonoma: "e05d0d12b548e049380c972439f152ebc10a58312eb1a2d3666df570e174a6b7"
19-
sha256 cellar: :any, ventura: "9848b98bcee8122cc9d4867332d4dc372faba88cfecf4a58e54ef6cbdb803f76"
20-
sha256 cellar: :any, monterey: "73566f6bbd1496154268a114ef5bc53f1b03330fd8f7b62a15d87de7dde35793"
21-
sha256 x86_64_linux: "392d7eb8bea2d013695a4d57d7a5849d702d018f9d1e2009accd01edbc979784"
14+
rebuild 1
15+
sha256 cellar: :any, arm64_sequoia: "e1f4f8532d745a6555e861c342f56ec7a0d0b827f13b4e80c4d6218857b3ae2f"
16+
sha256 cellar: :any, arm64_sonoma: "9582197a0a9f71c2e6751c739c24027e55294303a1ca878091a751513898417d"
17+
sha256 cellar: :any, arm64_ventura: "14745e9ade6980ce27101f8be9ea209180aabd691628f908acac939e8249a3e2"
18+
sha256 cellar: :any, sonoma: "bfa1f6813b1bc1fe0be25937d85b2eeff7288b8f93b1c5e70c3a1e72562febfb"
19+
sha256 cellar: :any, ventura: "e50b4f94bf2ec4bf8248bf41a32ea1af1fdc512037b1d6d7919cbbf14048d00b"
20+
sha256 x86_64_linux: "6805ee9bd44ec5f3573d1fc688d2beac5971904de5996c1239d406de74a37965"
2221
end
2322

2423
depends_on "meson" => :build
@@ -27,7 +26,6 @@ class Libnice < Formula
2726

2827
depends_on "glib"
2928
depends_on "gnutls"
30-
depends_on "gstreamer"
3129

3230
on_macos do
3331
depends_on "gettext"
@@ -38,7 +36,7 @@ class Libnice < Formula
3836
end
3937

4038
def install
41-
system "meson", "setup", "build", *std_meson_args
39+
system "meson", "setup", "build", "-Dgstreamer=disabled", *std_meson_args
4240
system "meson", "compile", "-C", "build", "--verbose"
4341
system "meson", "install", "-C", "build"
4442
end

synced_versions_formulae.json

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
["libnetworkit", "networkit"],
3434
["libnghttp2", "nghttp2"],
3535
["libngspice", "ngspice"],
36+
["libnice", "libnice-gstreamer"],
3637
["qalculate-gtk", "qalculate-qt"],
3738
["logcli", "loki", "promtail"],
3839
["mame", "rom-tools"],

0 commit comments

Comments
 (0)