*/*: Clean PYTHON_COMPAT of obsolete impls
[gentoo.git] / media-video / obs-studio / obs-studio-24.0.3.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 CMAKE_REMOVE_MODULES_LIST=( FindFreetype )
7 PYTHON_COMPAT=( python3_{6,7} )
8
9 inherit cmake-utils python-single-r1 xdg-utils
10
11 if [[ ${PV} == *9999 ]]; then
12         inherit git-r3
13         EGIT_REPO_URI="https://github.com/obsproject/obs-studio.git"
14         EGIT_SUBMODULES=()
15 else
16         SRC_URI="https://github.com/obsproject/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
17         KEYWORDS="~amd64 ~x86"
18 fi
19
20 DESCRIPTION="Software for Recording and Streaming Live Video Content"
21 HOMEPAGE="https://obsproject.com"
22
23 LICENSE="GPL-2"
24 SLOT="0"
25 IUSE="+alsa fdk imagemagick jack luajit nvenc pulseaudio python speex +ssl truetype v4l vlc"
26 REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
27
28 BDEPEND="
29         luajit? ( dev-lang/swig )
30         python? ( dev-lang/swig )
31 "
32 DEPEND="
33         >=dev-libs/jansson-2.5
34         dev-qt/qtcore:5
35         dev-qt/qtdeclarative:5
36         dev-qt/qtgui:5
37         dev-qt/qtmultimedia:5
38         dev-qt/qtnetwork:5
39         dev-qt/qtquickcontrols:5
40         dev-qt/qtsql:5
41         dev-qt/qtsvg:5
42         dev-qt/qtwidgets:5
43         dev-qt/qtx11extras:5
44         media-video/ffmpeg:=[x264]
45         net-misc/curl
46         x11-libs/libXcomposite
47         x11-libs/libXinerama
48         x11-libs/libXrandr
49         alsa? ( media-libs/alsa-lib )
50         fdk? ( media-libs/fdk-aac:= )
51         imagemagick? ( media-gfx/imagemagick:= )
52         jack? ( virtual/jack )
53         luajit? ( dev-lang/luajit:2 )
54         nvenc? (
55                 || (
56                         <media-video/ffmpeg-4[nvenc]
57                         >=media-video/ffmpeg-4[video_cards_nvidia]
58                 )
59         )
60         pulseaudio? ( media-sound/pulseaudio )
61         python? ( ${PYTHON_DEPS} )
62         speex? ( media-libs/speexdsp )
63         ssl? ( net-libs/mbedtls )
64         truetype? (
65                 media-libs/fontconfig
66                 media-libs/freetype
67         )
68         v4l? ( media-libs/libv4l )
69         vlc? ( media-video/vlc:= )
70 "
71 RDEPEND="${DEPEND}"
72
73 pkg_setup() {
74         use python && python-single-r1_pkg_setup
75 }
76
77 src_configure() {
78         local libdir=$(get_libdir)
79         local mycmakeargs=(
80                 -DDISABLE_ALSA=$(usex !alsa)
81                 -DDISABLE_FREETYPE=$(usex !truetype)
82                 -DDISABLE_JACK=$(usex !jack)
83                 -DDISABLE_LIBFDK=$(usex !fdk)
84                 -DDISABLE_PULSEAUDIO=$(usex !pulseaudio)
85                 -DDISABLE_SPEEXDSP=$(usex !speex)
86                 -DDISABLE_V4L2=$(usex !v4l)
87                 -DDISABLE_VLC=$(usex !vlc)
88                 -DLIBOBS_PREFER_IMAGEMAGICK=$(usex imagemagick)
89                 -DOBS_MULTIARCH_SUFFIX=${libdir#lib}
90                 -DOBS_VERSION_OVERRIDE=${PV}
91                 -DUNIX_STRUCTURE=1
92                 -DWITH_RTMPS=$(usex ssl)
93         )
94
95         if use luajit || use python; then
96                 mycmakeargs+=(
97                         -DDISABLE_LUA=$(usex !luajit)
98                         -DDISABLE_PYTHON=$(usex !python)
99                         -DENABLE_SCRIPTING=yes
100                 )
101         else
102                 mycmakeargs+=( -DENABLE_SCRIPTING=no )
103         fi
104
105         cmake-utils_src_configure
106 }
107
108 pkg_postinst() {
109         xdg_icon_cache_update
110
111         if ! use alsa && ! use pulseaudio; then
112                 elog
113                 elog "For the audio capture features to be available,"
114                 elog "either the 'alsa' or the 'pulseaudio' USE-flag needs to"
115                 elog "be enabled."
116                 elog
117         fi
118
119         if ! has_version "sys-apps/dbus"; then
120                 elog
121                 elog "The 'sys-apps/dbus' package is not installed, but"
122                 elog "could be used for disabling hibernating, screensaving,"
123                 elog "and sleeping.  Where it is not installed,"
124                 elog "'xdg-screensaver reset' is used instead"
125                 elog "(if 'x11-misc/xdg-utils' is installed)."
126                 elog
127         fi
128 }
129
130 pkg_postrm() {
131         xdg_icon_cache_update
132 }