|
| 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 |
0 commit comments