-
-
Notifications
You must be signed in to change notification settings - Fork 12.1k
/
gstreamer.rb
268 lines (238 loc) 路 9.51 KB
/
gstreamer.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
class Gstreamer < Formula
desc "Development framework for multimedia applications"
homepage "https://gstreamer.freedesktop.org/"
license all_of: ["LGPL-2.0-or-later", "LGPL-2.1-or-later", "MIT"]
stable do
url "https://gitlab.freedesktop.org/gstreamer/gstreamer/-/archive/1.24.3/gstreamer-1.24.3.tar.bz2"
sha256 "28caa0b49df73dcb0ff6884484bd7e1e1dcf1c9d6a501881f6ec3b8bf625be07"
# When updating this resource, use the tag that matches the GStreamer version.
resource "rs" do
url "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/archive/gstreamer-1.24.3/gst-plugins-rs-gstreamer-1.24.3.tar.bz2"
sha256 "2c4f6d1e0874be42ce680affe15064e5a702d476e89dcd21bda44e11bad81085"
# Backport support for newer `dav1d`
patch do
url "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/commit/7e1ab086de00125bc0d596f9ec5d74c9b82b2cc0.diff"
sha256 "0e4e0454a750d1bbf232bd19f250d9321ea5dba29cd38cc9bb8ca60ccd73ecfe"
end
end
end
livecheck do
url "https://gstreamer.freedesktop.org/src/gstreamer/"
regex(/href=.*?gstreamer[._-]v?(\d+\.\d*[02468](?:\.\d+)*)\.t/i)
end
bottle do
sha256 arm64_sonoma: "b29527f52e9dda73cdf654eae8f5ab89b937661db57ca2b093002d9cef4638eb"
sha256 arm64_ventura: "befb3f4bb9be0ac2d2546d9f3c5e64d860fa14bb231038e52f352ef8b9cdf710"
sha256 arm64_monterey: "b1c690848ff32cd96f9e43087b58f7369752daa6a89fb0c0dbda6d6788eb04b5"
sha256 sonoma: "ab0053803141663072fb4e8e5be8b4d31bee71c1ac79870df58b58d450f1ad25"
sha256 ventura: "f92286a135f2b81344fdd5770ea1f89439fb853065cf762a96ebe6839ebcf925"
sha256 monterey: "0d8c988386385723754508aa9f98cd4fc1fe4433b5daf30e71e2aee938da237b"
sha256 x86_64_linux: "2c5da5f89053333f2201474fd3465f287a08bed51024ae80f4689c0d0ef136a2"
end
head do
url "https://gitlab.freedesktop.org/gstreamer/gstreamer.git", branch: "main"
resource "rs" do
url "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git", branch: "main"
end
end
depends_on "bison" => :build
depends_on "cargo-c" => :build
depends_on "gitlint" => :build
depends_on "gobject-introspection" => :build
depends_on "meson" => :build
depends_on "nasm" => :build
depends_on "ninja" => :build
depends_on "pkg-config" => :build
depends_on "rust" => :build
depends_on "yasm" => :build
depends_on "cairo"
depends_on "dav1d"
depends_on "faac"
depends_on "faad2"
depends_on "fdk-aac"
depends_on "ffmpeg@6"
depends_on "flac"
depends_on "gettext"
depends_on "glib"
depends_on "glib-networking"
depends_on "graphene"
depends_on "gtk+3"
depends_on "gtk4"
depends_on "jpeg-turbo"
depends_on "json-glib"
depends_on "lame"
depends_on "libogg"
depends_on "libpng"
depends_on "libpthread-stubs"
depends_on "libshout"
depends_on "libsodium"
depends_on "libsoup"
depends_on "libusrsctp"
depends_on "libvorbis"
depends_on "libvpx"
depends_on "openexr"
depends_on "openssl@3"
depends_on "opus"
depends_on "orc"
depends_on "pango"
depends_on "pygobject3"
depends_on "python@3.12"
depends_on "rav1e"
depends_on "rtmpdump"
depends_on "speex"
depends_on "srtp"
depends_on "taglib"
depends_on "theora"
depends_on "x264"
depends_on "xz"
uses_from_macos "flex" => :build
uses_from_macos "curl"
on_macos do
# musepack is not bottled on Linux
# https://github.com/Homebrew/homebrew-core/pull/92041
depends_on "musepack"
end
on_linux do
depends_on "freeglut"
end
def python3
which("python3.12")
end
# These paths used to live in various `gst-*` formulae.
link_overwrite "bin/gst-*", "lib/ligst*", "lib/libges*", "lib/girepository-1.0/Gst*-1.0.typelib"
link_overwrite "lib/girepository-1.0/GES-1.0.typelib", "lib/gst-validate-launcher/*", "lib/gstreamer-1.0/*"
link_overwrite "lib/pkgconfig/gst*.pc", "lib/python3.12/site-packages/gi/overrides/*", "include/gstreamer-1.0/*"
link_overwrite "share/gir-1.0/Gst*.gir", "share/gir-1.0/GES-1.0.gir", "share/gstreamer-1.0/*"
link_overwrite "share/locale/*/LC_MESSAGES/gst-*.mo", "share/man/man1/g*"
# Avoid overlinking of `gst-python` python extension module.
# https://gitlab.freedesktop.org/gstreamer/gst-python/-/merge_requests/41
# TODO: Migrate patch to gstreamer monorepo.
patch :DATA
def install
odie "rs resource needs to be updated" if build.stable? && version != resource("rs").version
(buildpath/"subprojects/gst-plugins-rs").install resource("rs")
site_packages = Language::Python.site_packages(python3)
# To pass arguments to subprojects (e.g. `gst-editing-services`), use
# -Dsubproject:option=value
args = %W[
-Dpython.platlibdir=#{site_packages}
-Dpython.purelibdir=#{site_packages}
-Dpython=enabled
-Dlibav=enabled
-Dlibnice=disabled
-Dbase=enabled
-Dgood=enabled
-Dugly=enabled
-Dbad=enabled
-Ddevtools=enabled
-Dges=enabled
-Drtsp_server=enabled
-Drs=enabled
-Dtls=enabled
-Dqt5=disabled
-Dtools=enabled
-Dorc-source=system
-Dgpl=enabled
-Dtests=disabled
-Dexamples=disabled
-Dnls=enabled
-Dorc=enabled
-Ddoc=disabled
-Dgtk_doc=disabled
-Dintrospection=enabled
-Dpackage-origin=#{tap.default_remote}
-Dgst-devtools:validate=enabled
-Dgst-devtools:cairo=enabled
-Dgst-editing-services:pygi-overrides-dir=#{site_packages}/gi/overrides
-Dgst-python:pygi-overrides-dir=#{site_packages}/gi/overrides
-Dgst-python:python=#{python3}
-Dgst-plugins-bad:opencv=disabled
-Dgst-plugins-bad:sctp=enabled
-Dgst-plugins-bad:sctp-internal-usrsctp=disabled
-Dgst-plugins-good:soup=enabled
-Dgst-plugins-rs:closedcaption=enabled
-Dgst-plugins-rs:dav1d=enabled
-Dgst-plugins-rs:sodium=enabled
-Dgst-plugins-rs:csound=disabled
-Dgst-plugins-rs:gtk4=enabled
-Dgst-plugins-rs:sodium-source=system
]
# The apple media plug-in uses API that was added in Mojave
args << "-Dgst-plugins-bad:applemedia=disabled" if OS.mac? && MacOS.version <= :high_sierra
# Ban trying to chown to root.
# https://bugzilla.gnome.org/show_bug.cgi?id=750367
args << "-Dgstreamer:ptp-helper-permissions=none"
# Prevent the build from downloading an x86-64 version of bison.
args << "-Dbuild-tools-source=system"
# Set `RPATH` since `cargo-c` doesn't seem to.
# https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/279
plugin_dir = lib/"gstreamer-1.0"
rpath_args = [loader_path, rpath(source: plugin_dir)].map { |path| "-rpath,#{path}" }
ENV["RUSTFLAGS"] = "--codegen link-args=-Wl,#{rpath_args.join(",")}"
inreplace "subprojects/gst-plugins-rs/cargo_wrapper.py",
"env['RUSTFLAGS'] = shlex_join(rust_flags)",
"env['RUSTFLAGS'] = ' '.join(rust_flags)"
# Make sure the `openssl-sys` crate uses our OpenSSL.
ENV["OPENSSL_NO_VENDOR"] = "1"
ENV["OPENSSL_DIR"] = Formula["openssl@3"].opt_prefix
system "meson", "setup", "build", *args, *std_meson_args
system "meson", "compile", "-C", "build", "--verbose"
system "meson", "install", "-C", "build"
end
def caveats
<<~EOS
All gst-* GStreamer plugins are now bundled in this formula.
For GStreamer to find your own plugins, add their paths to `GST_PLUGIN_PATH`.
For example, if you have plugins in `~/.local/lib/gstreamer-1.0`:
export GST_PLUGIN_PATH="~/.local/lib/gstreamer-1.0"
Do not install plugins into GStreamer's prefix. They will be deleted
by `brew upgrade`.
EOS
end
test do
# TODO: Improve test according to suggestions at
# https://github.com/orgs/Homebrew/discussions/3740
system bin/"gst-inspect-1.0"
# system bin/"gst-validate-launcher", "--usage" # disabled until 3.12 is made the default python
system bin/"ges-launch-1.0", "--ges-version"
system bin/"gst-inspect-1.0", "libav"
system bin/"gst-inspect-1.0", "--plugin", "dvbsuboverlay"
system bin/"gst-inspect-1.0", "--plugin", "fdkaac"
system bin/"gst-inspect-1.0", "--plugin", "volume"
system bin/"gst-inspect-1.0", "--plugin", "cairo"
system bin/"gst-inspect-1.0", "--plugin", "dvdsub"
system bin/"gst-inspect-1.0", "--plugin", "x264"
system bin/"gst-inspect-1.0", "--plugin", "rtspclientsink"
system bin/"gst-inspect-1.0", "--plugin", "rsfile"
system bin/"gst-inspect-1.0", "hlsdemux2"
system python3, "-c", <<~EOS
import gi
gi.require_version('Gst', '1.0')
from gi.repository import Gst
print (Gst.Fraction(num=3, denom=5))
EOS
end
end
__END__
diff --git a/subprojects/gst-python/gi/overrides/meson.build b/subprojects/gst-python/gi/overrides/meson.build
index 20aeb06ac9..3c53eab6d7 100644
--- a/subprojects/gst-python/gi/overrides/meson.build
+++ b/subprojects/gst-python/gi/overrides/meson.build
@@ -7,8 +7,10 @@ python.install_sources(pysources,
host_system = host_machine.system()
if host_system == 'windows'
gst_dep_for_gi = gst_dep
+ python_ext_dep = python_dep
else
gst_dep_for_gi = gst_dep.partial_dependency(compile_args: true, includes: true, sources: true)
+ python_ext_dep = python_dep.partial_dependency(compile_args: true)
endif
gstpython = python.extension_module('_gi_gst',
@@ -17,7 +19,7 @@ gstpython = python.extension_module('_gi_gst',
install_dir : pygi_override_dir,
install_tag: 'python-runtime',
include_directories : [configinc],
- dependencies : [gst_dep_for_gi, python_dep, pygobject_dep],
+ dependencies : [gst_dep_for_gi, python_ext_dep, pygobject_dep],
)
env = environment()