summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: e48e8cd0c4a97d9eb0a7d036286397d509404660 (plain)
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
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
# Maintainer: Mubashshir <ahmubashshir@gmail.com>
# Co-Maintainer: MarsSeed <marcell.meszaros@runbox.eu>
# Contributor: Felix Yan <felixonmars@archlinux.org>
# Contributor: Chris Kitching <chriskitching@linux.com>

declare -Ii LIB32GST_DISABLE_AV LIB32GST_DISABLE_BAD

pkgbase=lib32-gst-bad-ugly
pkgname=(lib32-gst-plugins-ugly)

((LIB32GST_DISABLE_AV)) || pkgname+=(lib32-gst-libav)
((LIB32GST_DISABLE_BAD)) || pkgname+=(
	lib32-gst-plugins-bad-libs
	lib32-gst-plugins-bad
)
readonly LIB32GST_DISABLE_{AV,BAD}

pkgver=1.24.3
pkgrel=2
pkgdesc="Multimedia graph framework (32-bit)"
url="https://gstreamer.freedesktop.org/"
arch=(x86_64)
license=(LGPL)
_libav_depends=(lib32-ffmpeg)
_common_depends=("lib32-gst-plugins-base-libs>=$pkgver")
_bad_libs_depends=(
	lib32-libdrm		lib32-libgudev
	lib32-libusb		lib32-orc
	lib32-libx11		lib32-libxkbcommon-x11
)

_ugly_depends=(
	lib32-a52dec		lib32-libcdio
	lib32-libdvdread	lib32-libmpeg2
	lib32-opencore-amr	lib32-x264
)

_bad_depends=(
	lib32-aom		lib32-bzip2
	lib32-curl		lib32-faac
	lib32-faad2		lib32-fluidsynth
	lib32-lcms2		lib32-libass
	lib32-libavtp		lib32-libbs2b
	lib32-libdc1394		lib32-libdca
	lib32-libde265		lib32-libdvdnav
	lib32-libdvdread	lib32-libfdk-aac
	lib32-liblrdf		lib32-libmodplug
	lib32-libmpcdec		lib32-librsvg
	lib32-libsndfile	lib32-libsrtp
	lib32-libwebp		lib32-libxcb
	lib32-libxml2		lib32-lilv
	lib32-neon		lib32-nettle
	lib32-openal		lib32-openssl
	lib32-opus		lib32-pango
	lib32-rtmpdump		lib32-sbc
	lib32-soundtouch	lib32-srt
	lib32-vulkan-icd-loader	lib32-wayland
	lib32-wildmidi		lib32-x265
	lib32-zvbi		libltc
	lib32-libgme
)

makedepends=(
	# superproject
	git meson lib32-gstreamer lib32-gst-plugins-{base,good} wayland-protocols
	lib32-gtk3 python-packaging glib2-devel

	# _common
	"${_common_depends[@]}"

	# gst-plugins-ugly
	"${_ugly_depends[@]}"
)
((LIB32GST_DISABLE_BAD)) || makedepends+=(
	# gst-plugins-bad-libs
	"${_bad_libs_depends[@]}"

	# gst-plugins-bad
	"${_bad_depends[@]}"
	vulkan-headers lib32-vulkan-validation-layers
	lib32-shaderc lib32-bluez-libs
	lib32-ladspa lib32-lv2
	lib32-json-glib
)

((LIB32GST_DISABLE_AV)) || makedepends+=(
	# gst-libav
	"${_libav_depends[@]}"
)

checkdepends=(xorg-server-xvfb)
options=(!debug)
source=(
	"git+https://gitlab.freedesktop.org/gstreamer/gstreamer.git#tag=$pkgver"
	0001-Allow-disabling-gstreamer.patch
	0002-HACK-meson-Disable-broken-tests.patch
)
sha256sums=('SKIP'
            'dd928acaa15670225059b36ca5a29d808feba3855700f9b36128a2e55a335a50'
            '405adb6bf85b5e130cc1d2ba100abd5fa5c0694ceea3a5082365a966061d7eda')
#validpgpkeys=(D637032E45B8C6585B9456565D2EEE6F6F349D7C) # Tim Müller <tim@gstreamer-foundation.org>

source+=('0003-mr6505.diff::https://github.com/OpenMandrivaAssociation/gst-libav/raw/master/6505.diff')
sha256sums+=('0a8488ee58f22edd0d5d158c2b2347c0ddeb9f8112c903bac2bb36bed107d783')

pkgver() {
	cd gstreamer
	git describe --tags | sed 's/[^-]*-g/r&/;s/-/+/g'
}

prepare() {
	cd gstreamer

	# Disable gstreamer
	git apply -3 ../0001-Allow-disabling-gstreamer.patch

	# Disable broken tests
	git apply -3 ../0002-HACK-meson-Disable-broken-tests.patch

	# libav: Fix compatibility with ffmpeg 7
	patch -d subprojects -p0 -i "$srcdir"/0003-mr6505.diff
}

_fix_pkgconf() {
	if $PKG_CONFIG --variable=libexecdir "$1" | grep -q /usr/libexec; then
		mkdir -p pc
		sed 's@/libexec@/lib32@' "/usr/lib32/pkgconfig/$1.pc" > "$srcdir/pc/$1.pc"
		case ":${PKG_CONFIG_PATH}:" in
			*:"$srcdir/pc":*) return;;
			*) export PKG_CONFIG_PATH="${PKG_CONFIG_PATH}${PKG_CONFIG_PATH+:}${srcdir}/pc";;
		esac
	fi
}

build() {
	local -a meson_switches=(enabled disabled)
	export CC='gcc -m32'
	export CXX='g++ -m32'
	export PKG_CONFIG='i686-pc-linux-gnu-pkg-config'
	_fix_pkgconf gstreamer-1.0
	_fix_pkgconf gstreamer-base-1.0

	local meson_options=(
		--libdir=lib32
		--libexecdir=lib32
		# Superproject options
		-D devtools=disabled
		-D doc=disabled
		-D examples=disabled
		-D gobject-cast-checks=disabled
		-D ges=disabled
		-D gpl=enabled
		-D gst-examples=disabled
		-D introspection=disabled
		-D qt6=disabled
		-D webrtc=disabled
		-D libnice=disabled
#		-D omx=disabled
		-D orc-source=system
		-D package-origin="https://www.archlinux.org/"

		# Package names
		-D gst-plugins-bad:package-name="Arch Linux lib32-gst-plugins-bad $pkgver-$pkgrel"
		-D gst-plugins-ugly:package-name="Arch Linux lib32-gst-plugins-ugly $pkgver-$pkgrel"
		-D gst-libav:package-name="Arch Linux lib32-gst-libav $pkgver-$pkgrel"
		-D python=disabled
		-D qt5=disabled
		-D rs=disabled
		-D rtsp_server=disabled
		-D sharp=disabled
		-D vaapi=disabled
		-D base=disabled # already in repo
		-D good=disabled # already in repo
		-D gstreamer=disabled # already in repo

		# package scoped
		-D "libav=${meson_switches[LIB32GST_DISABLE_AV]}"
		-D ugly=enabled
		-D "bad=${meson_switches[LIB32GST_DISABLE_BAD]}"
		# subprojects
		-D gst-plugins-bad:mfx_api=oneVPL
		-D gst-plugins-bad:directfb=disabled
		-D gst-plugins-bad:directshow=disabled
		-D gst-plugins-bad:directsound=disabled
		-D gst-plugins-bad:flite=disabled
		-D gst-plugins-bad:gs=disabled
		-D gst-plugins-bad:iqa=disabled
		-D gst-plugins-bad:isac=disabled
		-D gst-plugins-bad:magicleap=disabled
		-D gst-plugins-bad:onnx=disabled
		-D gst-plugins-bad:openh264=disabled
		-D gst-plugins-bad:openni2=disabled
		-D gst-plugins-bad:opensles=disabled
		-D gst-plugins-bad:tinyalsa=disabled
		-D gst-plugins-bad:voaacenc=disabled
		-D gst-plugins-bad:voamrwbenc=disabled
		-D gst-plugins-bad:wasapi2=disabled
		-D gst-plugins-bad:wasapi=disabled
		# -- extra disabled libs not needed in wine --
		-D gst-plugins-bad:openjpeg=disabled
		-D gst-plugins-bad:chromaprint=disabled
		-D gst-plugins-bad:gsm=disabled
		-D gst-plugins-bad:spandsp=disabled
		-D gst-plugins-bad:mpeg2enc=disabled
		-D gst-plugins-bad:zbar=disabled
		-D gst-plugins-bad:mplex=disabled
		-D gst-plugins-bad:webrtc=disabled
		-D gst-plugins-bad:webrtcdsp=disabled
		-D gst-plugins-bad:aja=disabled
		-D gst-plugins-bad:qt6d3d11=disabled
		# -- end -- -D gst-plugins-bad:=disabled
		-D gst-plugins-bad:opencv=disabled # due to no lib32-opencv
		-D gst-plugins-bad:msdk=disabled # due to no msdk (32-bit) support
		-D gst-plugins-bad:qsv=disabled # due to no x86 support
		-D gst-plugins-bad:ldac=disabled # due to no lib32-libdac support
		-D gst-plugins-bad:microdns=disabled # due to no lib32-microdns support
		-D gst-plugins-bad:openaptx=disabled # due to no lib32-Xaptx support
		-D gst-plugins-bad:openexr=disabled # due to no lib32-openexr support
		-D gst-plugins-bad:openmpt=disabled # due to no lib32-openmpt support
		-D gst-plugins-bad:qroverlay=disabled # due to no lib32-qrencode support
		-D gst-plugins-bad:svthevcenc=disabled # due to no lib32-svthevcenc support
		-D gst-plugins-bad:svtav1=disabled # due to no lib32-svt-av1
		-D gst-plugins-bad:wpe=disabled # due to no lib32-wpe support
		-D gst-plugins-bad:lc3=disabled # no lib32 support
		-D gst-plugins-bad:va=disabled  # linker error
		-D gst-plugins-bad:zxing=disabled # due to no lib32-zxing support
		-D gst-plugins-bad:amfcodec=disabled # only support windows
		-D gst-plugins-ugly:sidplay=disabled
	)

	arch-meson gstreamer build "${meson_options[@]}"
	meson configure build	# Print config
	meson compile -C build
}

check() (
	export XDG_RUNTIME_DIR="$PWD/runtime-dir"
	mkdir -p -m 700 "$XDG_RUNTIME_DIR"

	export NO_AT_BRIDGE=1 GTK_A11Y=none

	# Flaky due to timeouts
	xvfb-run -s '-nolisten local' \
	meson test -C build --print-errorlogs || :
)

_cleanup() {
	rm -rf "$pkgdir"/usr/{include,share}

	if [[ -d "$pkgdir/usr/bin" ]];then
	for _i in "$pkgdir"/usr/bin/*; do
		mv "${_i}" "${_i}-32"
	done
	fi
}

package_lib32-gst-libav() {
	pkgdesc+=" - libav plugin"
	depends=("${_common_depends[@]}" "${_libav_depends[@]}")
	provides=("lib32-gst-ffmpeg=$pkgver")
	replaces=('lib32-gst-libav-latest')

	DESTDIR="$pkgdir" meson install -C build \
	--skip-subprojects gst-plugins-ugly,gst-plugins-bad
	_cleanup
}

package_lib32-gst-plugins-bad() {
	pkgdesc+=" - bad plugins"
	replaces=('lib32-gst-plugins-bad-latest')
	depends=("lib32-gst-plugins-bad-libs>=$pkgver" "${_bad_depends[@]}")
	mv -v "$pkgdir/../bad/usr" "$pkgdir/usr"
}

package_lib32-gst-plugins-bad-libs() {
	pkgdesc+=" - bad"
	replaces=('lib32-gst-plugins-bad-libs-latest')
	depends=("${_common_depends[@]}" "${_bad_libs_depends[@]}")

	DESTDIR="$pkgdir" meson install -C build \
	--skip-subprojects gst-plugins-ugly,gst-libav
	_cleanup

	# bad-libs
	local _libs _files
	_libs=(
	#adaptivedemux2 # new
	aes aom assrender
	avtp bs2b bz2
	closedcaption colormanagement
	curl dash dc1394 de265 dtls dtsdec
	faac faad fdkaac fluidsynthmidi
	gme hls ladspa lv2 modplug
	musepack neonhttpsrc
	openal opusparse resindvd
	rsvg rtmp sbc sctp smoothstreaming
	sndfile soundtouch srt
	srtp teletext timecode ttmlsubs
	vulkan waylandsink webp
	wildmidi x265
	)

	mkdir -p "$pkgdir/../bad/usr/lib32/gstreamer-1.0/"
	mapfile -t _files < <(
	printf "$pkgdir"'/usr/lib32/gstreamer-1.0/libgst%s.so\n' "${_libs[@]}"
	)
	mv -t "$pkgdir/../bad/usr/lib32/gstreamer-1.0/" "${_files[@]}"
}

package_lib32-gst-plugins-ugly() {
	pkgdesc+=" - ugly plugins"
	replaces=('lib32-gst-plugins-ugly-latest')
	depends=("${_common_depends[@]}" "${_ugly_depends[@]}")

	DESTDIR="$pkgdir" meson install -C build \
	--skip-subprojects gst-plugins-bad,gst-libav
	_cleanup
}

# vim: ft=sh:ts=8