# $NetBSD: Makefile.common,v 1.46 2023/08/06 09:12:15 nia Exp $
# used by audio/gst-plugins1-dts/Makefile
# used by audio/gst-plugins1-faac/Makefile
# used by audio/gst-plugins1-faad/Makefile
# used by audio/gst-plugins1-fluidsynth/Makefile
# used by audio/gst-plugins1-gme/Makefile
# used by audio/gst-plugins1-ladspa/Makefile
# used by audio/gst-plugins1-lv2/Makefile
# used by audio/gst-plugins1-modplug/Makefile
# used by audio/gst-plugins1-musepack/Makefile
# used by audio/gst-plugins1-sndfile/Makefile
# used by audio/gst-plugins1-soundtouch/Makefile
# used by graphics/gst-plugins1-webp/Makefile
# used by multimedia/gst-plugins1-aom/Makefile
# used by multimedia/gst-plugins1-egl-gl/Makefile
# used by multimedia/gst-plugins1-egl-opengl/Makefile
# used by multimedia/gst-plugins1-libde265/Makefile
# used by multimedia/gst-plugins1-openh264/Makefile
# used by multimedia/gst-plugins1-resindvd/Makefile
# used by multimedia/gst-plugins1-x265/Makefile
# used by net/gst-plugins1-rtmp/Makefile

.include "../../multimedia/gstreamer1/version.mk"

DISTNAME=	gst-plugins-bad-${GST_VERSION}
MASTER_SITES=	https://gstreamer.freedesktop.org/src/gst-plugins-bad/
EXTRACT_SUFX=	.tar.xz

USE_LANGUAGES=	c c++
USE_TOOLS+=	pkg-config

DISTINFO_FILE=	${.CURDIR}/../../multimedia/gst-plugins1-bad/distinfo
PATCHDIR=	${.CURDIR}/../../multimedia/gst-plugins1-bad/patches

# "error: 'for' loop initial declarations are only allowed in C99 mode"
# needs default visibility for fdopen (etc.) on some platforms
FORCE_C_STD=	gnu99

PKGCONFIG_OVERRIDE=		output/pkgconfig/*.pc
PKGCONFIG_OVERRIDE_STAGE=	pre-install

PYTHON_VERSIONS_INCOMPATIBLE=	27
PYTHON_FOR_BUILD_ONLY=		tool

# grep '^option' meson_options.txt | grep feature | \
# sed -e "s/',.*//g" -e "s/option('//g" | \
# xargs printf 'GST_PLUGINS_SET+=\t%s\n'

# unpackaged dependencies:
# dssim
# tinyalsa

GST_PLUGINS_SET+=	accurip
GST_PLUGINS_SET+=	adpcmdec
GST_PLUGINS_SET+=	adpcmenc
GST_PLUGINS_SET+=	aiff
GST_PLUGINS_SET+=	asfmux
GST_PLUGINS_SET+=	audiobuffersplit
GST_PLUGINS_SET+=	audiofxbad
GST_PLUGINS_SET+=	audiolatency
GST_PLUGINS_SET+=	audiomixmatrix
GST_PLUGINS_SET+=	audiovisualizers
GST_PLUGINS_SET+=	autoconvert
GST_PLUGINS_SET+=	bayer
GST_PLUGINS_SET+=	camerabin2
GST_PLUGINS_SET+=	codecalpha
GST_PLUGINS_SET+=	coloreffects
GST_PLUGINS_SET+=	debugutils
GST_PLUGINS_SET+=	dvbsubenc
GST_PLUGINS_SET+=	dvbsuboverlay
GST_PLUGINS_SET+=	dvdspu
GST_PLUGINS_SET+=	faceoverlay
GST_PLUGINS_SET+=	festival
GST_PLUGINS_SET+=	fieldanalysis
GST_PLUGINS_SET+=	freeverb
GST_PLUGINS_SET+=	frei0r
GST_PLUGINS_SET+=	gaudieffects
GST_PLUGINS_SET+=	gdp
GST_PLUGINS_SET+=	geometrictransform
GST_PLUGINS_SET+=	id3tag
GST_PLUGINS_SET+=	inter
GST_PLUGINS_SET+=	interlace
GST_PLUGINS_SET+=	ivfparse
GST_PLUGINS_SET+=	ivtc
GST_PLUGINS_SET+=	jp2kdecimator
GST_PLUGINS_SET+=	jpegformat
GST_PLUGINS_SET+=	librfb
GST_PLUGINS_SET+=	midi
GST_PLUGINS_SET+=	mpegdemux
GST_PLUGINS_SET+=	mpegpsmux
GST_PLUGINS_SET+=	mpegtsdemux
GST_PLUGINS_SET+=	mpegtsmux
GST_PLUGINS_SET+=	mxf
GST_PLUGINS_SET+=	netsim
GST_PLUGINS_SET+=	onvif
GST_PLUGINS_SET+=	pcapparse
GST_PLUGINS_SET+=	pnm
GST_PLUGINS_SET+=	proxy
GST_PLUGINS_SET+=	rawparse
GST_PLUGINS_SET+=	removesilence
GST_PLUGINS_SET+=	rist
GST_PLUGINS_SET+=	rtmp2
GST_PLUGINS_SET+=	rtp
GST_PLUGINS_SET+=	sdp
GST_PLUGINS_SET+=	segmentclip
GST_PLUGINS_SET+=	siren
GST_PLUGINS_SET+=	smooth
GST_PLUGINS_SET+=	speed
GST_PLUGINS_SET+=	subenc
GST_PLUGINS_SET+=	switchbin
GST_PLUGINS_SET+=	timecode
GST_PLUGINS_SET+=	videofilters
GST_PLUGINS_SET+=	videoframe_audiolevel
GST_PLUGINS_SET+=	videoparsers
GST_PLUGINS_SET+=	videosignal
GST_PLUGINS_SET+=	vmnc
GST_PLUGINS_SET+=	y4m
GST_PLUGINS_SET+=	opencv
GST_PLUGINS_SET+=	wayland
GST_PLUGINS_SET+=	x11
GST_PLUGINS_SET+=	aes
GST_PLUGINS_SET+=	aom
GST_PLUGINS_SET+=	avtp
GST_PLUGINS_SET+=	androidmedia
GST_PLUGINS_SET+=	applemedia
GST_PLUGINS_SET+=	asio
GST_PLUGINS_SET+=	assrender
GST_PLUGINS_SET+=	bluez
GST_PLUGINS_SET+=	bs2b
GST_PLUGINS_SET+=	bz2
GST_PLUGINS_SET+=	chromaprint
GST_PLUGINS_SET+=	closedcaption
GST_PLUGINS_SET+=	colormanagement
GST_PLUGINS_SET+=	curl
GST_PLUGINS_SET+=	curl-ssh2
GST_PLUGINS_SET+=	d3dvideosink
GST_PLUGINS_SET+=	d3d11
GST_PLUGINS_SET+=	dash
GST_PLUGINS_SET+=	dc1394
GST_PLUGINS_SET+=	decklink
GST_PLUGINS_SET+=	directfb
GST_PLUGINS_SET+=	directsound
GST_PLUGINS_SET+=	dtls
GST_PLUGINS_SET+=	dts
GST_PLUGINS_SET+=	dvb
GST_PLUGINS_SET+=	faac
GST_PLUGINS_SET+=	faad
GST_PLUGINS_SET+=	fbdev
GST_PLUGINS_SET+=	fdkaac
GST_PLUGINS_SET+=	flite
GST_PLUGINS_SET+=	fluidsynth
GST_PLUGINS_SET+=	gl
GST_PLUGINS_SET+=	gme
GST_PLUGINS_SET+=	gs
GST_PLUGINS_SET+=	gsm
GST_PLUGINS_SET+=	ipcpipeline
GST_PLUGINS_SET+=	iqa
GST_PLUGINS_SET+=	kate
GST_PLUGINS_SET+=	kms
GST_PLUGINS_SET+=	ladspa
GST_PLUGINS_SET+=	ldac
GST_PLUGINS_SET+=	libde265
GST_PLUGINS_SET+=	openaptx
GST_PLUGINS_SET+=	lv2
GST_PLUGINS_SET+=	mediafoundation
GST_PLUGINS_SET+=	microdns
GST_PLUGINS_SET+=	modplug
GST_PLUGINS_SET+=	mpeg2enc
GST_PLUGINS_SET+=	mplex
GST_PLUGINS_SET+=	msdk
GST_PLUGINS_SET+=	musepack
GST_PLUGINS_SET+=	neon
GST_PLUGINS_SET+=	nvcodec
GST_PLUGINS_SET+=	onnx
GST_PLUGINS_SET+=	openal
GST_PLUGINS_SET+=	openexr
GST_PLUGINS_SET+=	openh264
GST_PLUGINS_SET+=	openjpeg
GST_PLUGINS_SET+=	openmpt
GST_PLUGINS_SET+=	openni2
GST_PLUGINS_SET+=	opensles
GST_PLUGINS_SET+=	opus
GST_PLUGINS_SET+=	qroverlay
GST_PLUGINS_SET+=	resindvd
GST_PLUGINS_SET+=	rsvg
GST_PLUGINS_SET+=	rtmp
GST_PLUGINS_SET+=	sbc
GST_PLUGINS_SET+=	sctp
GST_PLUGINS_SET+=	shm
GST_PLUGINS_SET+=	smoothstreaming
GST_PLUGINS_SET+=	sndfile
GST_PLUGINS_SET+=	soundtouch
GST_PLUGINS_SET+=	spandsp
GST_PLUGINS_SET+=	srt
GST_PLUGINS_SET+=	srtp
GST_PLUGINS_SET+=	svthevcenc
GST_PLUGINS_SET+=	teletext
GST_PLUGINS_SET+=	tinyalsa
GST_PLUGINS_SET+=	transcode
GST_PLUGINS_SET+=	ttml
GST_PLUGINS_SET+=	uvch264
GST_PLUGINS_SET+=	va
GST_PLUGINS_SET+=	voaacenc
GST_PLUGINS_SET+=	voamrwbenc
GST_PLUGINS_SET+=	vulkan
GST_PLUGINS_SET+=	wasapi
GST_PLUGINS_SET+=	wasapi2
GST_PLUGINS_SET+=	webp
GST_PLUGINS_SET+=	webrtc
GST_PLUGINS_SET+=	webrtcdsp
GST_PLUGINS_SET+=	wildmidi
GST_PLUGINS_SET+=	winks
GST_PLUGINS_SET+=	winscreencap
GST_PLUGINS_SET+=	x265
GST_PLUGINS_SET+=	zbar
GST_PLUGINS_SET+=	zxing
GST_PLUGINS_SET+=	wpe
GST_PLUGINS_SET+=	magicleap
GST_PLUGINS_SET+=	v4l2codecs
GST_PLUGINS_SET+=	isac
GST_PLUGINS_SET+=	hls
GST_PLUGINS_SET+=	sctp-internal-usrsctp
GST_PLUGINS_SET+=	examples
GST_PLUGINS_SET+=	tests
GST_PLUGINS_SET+=	introspection
GST_PLUGINS_SET+=	nls
GST_PLUGINS_SET+=	orc
GST_PLUGINS_SET+=	doc
GST_PLUGINS_SET+=	gpl

.for i in ${GST_PLUGINS_SET}
.  if !empty(GST_PLUGINS:M${i})
MESON_ARGS+=	-D${i}=enabled
.  else
MESON_ARGS+=	-D${i}=disabled
.  endif
.endfor

.if defined(GST_EXT_BUILD)
GST_EXT_BASEDIR?=	ext

pre-configure: fix-subdirs

fix-subdirs:
	${AWK} -f ${.CURDIR}/../../multimedia/gst-plugins1-base/files/only-build-extensions.awk \
	    -v basedir=${GST_EXT_BASEDIR} \
	    ${WRKSRC}/meson.build > ${WRKSRC}/meson.build.new
	${MV} ${WRKSRC}/meson.build.new ${WRKSRC}/meson.build

post-install:
	${RM} -f ${DESTDIR}${PREFIX}/lib/pkgconfig/gstreamer-plugins-bad-1.0.pc
.endif

.include "../../devel/meson/build.mk"
.include "../../lang/python/tool.mk"
.include "../../multimedia/gst-plugins1-base/buildlink3.mk"
BUILDLINK_API_DEPENDS.gstreamer1+=	gstreamer1>=1.20.0
.include "../../multimedia/gstreamer1/buildlink3.mk"
