diff options
author | Jimi Huotari <chiitoo@gentoo.org> | 2018-03-18 00:29:00 +0200 |
---|---|---|
committer | Tony Vroon <chainsaw@gentoo.org> | 2018-07-13 10:36:15 +0100 |
commit | 56c84c9c9473e7651089b5d1fd0e64a542f71e69 (patch) | |
tree | 2c54e9e1bbd6e7ce0319649dfde38f9599c2f1b4 /media-video/obs-studio | |
parent | games-emulation/hatari: remove old (diff) | |
download | gentoo-56c84c9c9473e7651089b5d1fd0e64a542f71e69.tar.gz gentoo-56c84c9c9473e7651089b5d1fd0e64a542f71e69.tar.bz2 gentoo-56c84c9c9473e7651089b5d1fd0e64a542f71e69.zip |
media-video/obs-studio: add support for scripting
Scripting support for Lua and Python 3 is enabled by automagic, if
the required libraries are found. This commit adds USE-flags and
a patch that give the user control on whether or not to do so.
Closes: https://bugs.gentoo.org/656956
Package-Manager: Portage-2.3.41, Repoman-2.3.9
Closes: https://github.com/gentoo/gentoo/pull/9151
Closes: https://bugs.gentoo.org/656956
Diffstat (limited to 'media-video/obs-studio')
-rw-r--r-- | media-video/obs-studio/files/obs-studio-21.1.2-use-less-automagic.patch | 167 | ||||
-rw-r--r-- | media-video/obs-studio/metadata.xml | 4 | ||||
-rw-r--r-- | media-video/obs-studio/obs-studio-9999.ebuild | 26 |
3 files changed, 193 insertions, 4 deletions
diff --git a/media-video/obs-studio/files/obs-studio-21.1.2-use-less-automagic.patch b/media-video/obs-studio/files/obs-studio-21.1.2-use-less-automagic.patch new file mode 100644 index 000000000000..2c28c8e080d5 --- /dev/null +++ b/media-video/obs-studio/files/obs-studio-21.1.2-use-less-automagic.patch @@ -0,0 +1,167 @@ +From eee6541153cfb6788ee088181781793de100e54c Mon Sep 17 00:00:00 2001 +From: Jimi Huotari <chiitoo@gentoo.org> +Date: Mon, 9 Jul 2018 02:20:10 +0300 +Subject: [PATCH 1/2] deps/obs-scripting: Use less automagic for Lua/Python + detection + +This adds build-time options for disabling the Lua and/or Python +scripting support in cases where users do not wish to build +it, but have the required libraries installed. +--- + deps/obs-scripting/CMakeLists.txt | 73 +++++++++++++++++++------------ + 1 file changed, 45 insertions(+), 28 deletions(-) + +diff --git a/deps/obs-scripting/CMakeLists.txt b/deps/obs-scripting/CMakeLists.txt +index 835c1b30..46412779 100644 +--- a/deps/obs-scripting/CMakeLists.txt ++++ b/deps/obs-scripting/CMakeLists.txt +@@ -1,6 +1,7 @@ + cmake_minimum_required(VERSION 2.8) + + if(NOT ENABLE_SCRIPTING) ++ message(STATUS "Scripting plugin disabled") + return() + endif() + +@@ -11,44 +12,60 @@ if(MSVC) + w32-pthreads) + endif() + +-find_package(Luajit QUIET) +-find_package(PythonDeps QUIET) +-find_package(SwigDeps QUIET 2) ++option(DISABLE_LUA "Disable Lua scripting support" OFF) ++option(DISABLE_PYTHON "Disable Python scripting support" OFF) + + set(COMPILE_PYTHON FALSE CACHE BOOL "" FORCE) + set(COMPILE_LUA FALSE CACHE BOOL "" FORCE) + +-if(NOT SWIG_FOUND) +- message(STATUS "Scripting: SWIG not found; scripting disabled") +- return() +-endif() ++if(NOT DISABLE_LUA) ++ find_package(Luajit QUIET) + +-if(NOT PYTHONLIBS_FOUND AND NOT LUAJIT_FOUND) +- message(STATUS "Scripting: Neither Python 3 nor Luajit was found; scripting plugin disabled") +- return() +-endif() +- +-if(NOT LUAJIT_FOUND) +- message(STATUS "Scripting: Luajit not found; Luajit support disabled") ++ if(NOT DISABLE_LUA AND NOT LUAJIT_FOUND) ++ message(STATUS "Luajit support not found.") ++ set(LUAJIT_FOUND FALSE) ++ else() ++ message(STATUS "Scripting: Luajit supported") ++ set(COMPILE_LUA TRUE CACHE BOOL "" FORCE) ++ endif() + else() +- message(STATUS "Scripting: Luajit supported") +- set(COMPILE_LUA TRUE CACHE BOOL "" FORCE) ++ message(STATUS "Scripting: Luajit support disabled") ++ set(LUAJIT_FOUND FALSE) + endif() + +-if(NOT PYTHONLIBS_FOUND) +- message(STATUS "Scripting: Python 3 not found; Python support disabled") ++if(NOT DISABLE_PYTHON) ++ find_package(PythonDeps QUIET) ++ ++ if(NOT DISABLE_PYTHON AND NOT PYTHONLIBS_FOUND) ++ message(STATUS "Python support not found.") ++ set(PYTHON_FOUND FALSE) ++ set(PYTHONLIBS_FOUND FALSE) ++ else() ++ message(STATUS "Scripting: Python 3 supported") ++ set(PYTHON_FOUND TRUE) ++ set(COMPILE_PYTHON TRUE CACHE BOOL "" FORCE) ++ ++ get_filename_component(PYTHON_LIB "${PYTHON_LIBRARIES}" NAME) ++ string(REGEX REPLACE "\\.[^.]*$" "" PYTHON_LIB ${PYTHON_LIB}) ++ ++ if(WIN32) ++ string(REGEX REPLACE "_d" "" PYTHON_LIB "${PYTHON_LIB}") ++ endif() ++ endif() ++else() ++ message(STATUS "Scripting: Python 3 support disabled") + set(PYTHON_FOUND FALSE) + set(PYTHONLIBS_FOUND FALSE) +-else() +- message(STATUS "Scripting: Python 3 supported") +- set(PYTHON_FOUND TRUE) +- set(COMPILE_PYTHON TRUE CACHE BOOL "" FORCE) +- +- get_filename_component(PYTHON_LIB "${PYTHON_LIBRARIES}" NAME) +- string(REGEX REPLACE "\\.[^.]*$" "" PYTHON_LIB ${PYTHON_LIB}) +- if(WIN32) +- string(REGEX REPLACE "_d" "" PYTHON_LIB "${PYTHON_LIB}") +- endif() ++endif() ++ ++find_package(SwigDeps QUIET 2) ++ ++if(NOT SWIG_FOUND) ++ message(STATUS "Scripting: SWIG not found; scripting disabled") ++endif() ++ ++if(NOT PYTHONLIBS_FOUND AND NOT LUAJIT_FOUND) ++ message(STATUS "Scripting: Neither Python 3 nor Luajit was found; scripting plugin disabled") + endif() + + set(SCRIPTING_ENABLED ON CACHE BOOL "Interal global cmake variable" FORCE) +-- +2.18.0 + +From 79006adaf2b93ed4ddc07ff236a9ed1fcd09e47f Mon Sep 17 00:00:00 2001 +From: Jimi Huotari <chiitoo@gentoo.org> +Date: Wed, 11 Jul 2018 02:08:51 +0300 +Subject: [PATCH 2/2] obs-filters: Use less automagic for SpeexDSP detection + +This adds a build-time option for disabling the SpeexDSP-based +Noise Suppression filter support in cases where users do not +wish to build it, but have the required library installed. +--- + plugins/obs-filters/CMakeLists.txt | 24 +++++++++++++++++------- + 1 file changed, 17 insertions(+), 7 deletions(-) + +diff --git a/plugins/obs-filters/CMakeLists.txt b/plugins/obs-filters/CMakeLists.txt +index ec4289cc..4d862b0a 100644 +--- a/plugins/obs-filters/CMakeLists.txt ++++ b/plugins/obs-filters/CMakeLists.txt +@@ -1,13 +1,23 @@ + project(obs-filters) + +-find_package(Libspeexdsp QUIET) +-if(LIBSPEEXDSP_FOUND) +- set(obs-filters_LIBSPEEXDSP_SOURCES +- noise-suppress-filter.c) +- set(obs-filters_LIBSPEEXDSP_LIBRARIES +- ${LIBSPEEXDSP_LIBRARIES}) ++option(DISABLE_SPEEXDSP "Disable building of the SpeexDSP-based Noise Suppression filter" OFF) ++ ++if(DISABLE_SPEEXDSP) ++ message(STATUS "SpeexDSP support disabled") ++ set(LIBSPEEXDSP_FOUND FALSE) + else() +- message(STATUS "Speexdsp library not found, speexdsp filters disabled") ++ find_package(Libspeexdsp QUIET) ++ ++ if(NOT LIBSPEEXDSP_FOUND) ++ message(STATUS "SpeexDSP support not found") ++ set(LIBSPEEXDSP_FOUND FALSE) ++ else() ++ message(STATUS "SpeexDSP supported") ++ set(obs-filters_LIBSPEEXDSP_SOURCES ++ noise-suppress-filter.c) ++ set(obs-filters_LIBSPEEXDSP_LIBRARIES ++ ${LIBSPEEXDSP_LIBRARIES}) ++ endif() + endif() + + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/obs-filters-config.h.in" +-- +2.18.0 + diff --git a/media-video/obs-studio/metadata.xml b/media-video/obs-studio/metadata.xml index 27ed2bccb4cb..20792bdd8baa 100644 --- a/media-video/obs-studio/metadata.xml +++ b/media-video/obs-studio/metadata.xml @@ -14,7 +14,9 @@ <use> <flag name="fdk">Enable libfdk support for AAC encoding.</flag> <flag name="imagemagick">Use ImageMagick for image loading instead of FFmpeg.</flag> - <flag name="nvenc">Enable NVENC encoding for nVidia video cards</flag> + <flag name="luajit">Build support for scripting via Luajit.</flag> + <flag name="nvenc">Enable NVENC encoding for nVidia video cards.</flag> + <flag name="python">Build support for scripting via Python 3.</flag> </use> <upstream> <remote-id type="github">jp9000/obs-studio</remote-id> diff --git a/media-video/obs-studio/obs-studio-9999.ebuild b/media-video/obs-studio/obs-studio-9999.ebuild index e030ae7b1d73..b1dee2913b2b 100644 --- a/media-video/obs-studio/obs-studio-9999.ebuild +++ b/media-video/obs-studio/obs-studio-9999.ebuild @@ -3,9 +3,10 @@ EAPI=6 +PYTHON_COMPAT=( python{3_4,3_5,3_6} ) CMAKE_MIN_VERSION=3.9.6 -inherit cmake-utils gnome2-utils +inherit cmake-utils gnome2-utils python-any-r1 if [[ ${PV} == *9999 ]]; then inherit git-r3 @@ -21,7 +22,7 @@ HOMEPAGE="https://obsproject.com" LICENSE="GPL-2" SLOT="0" -IUSE="+alsa fdk imagemagick jack pulseaudio truetype v4l" +IUSE="+alsa fdk imagemagick jack luajit nvenc pulseaudio python truetype v4l" COMMON_DEPEND=" >=dev-libs/jansson-2.5 @@ -44,16 +45,24 @@ COMMON_DEPEND=" fdk? ( media-libs/fdk-aac:= ) imagemagick? ( media-gfx/imagemagick:= ) jack? ( virtual/jack ) + luajit? ( dev-lang/luajit:2 ) + nvenc? ( media-video/ffmpeg:=[nvenc] ) pulseaudio? ( media-sound/pulseaudio ) + python? ( ${PYTHON_DEPS} ) truetype? ( media-libs/fontconfig media-libs/freetype ) v4l? ( media-libs/libv4l ) " -DEPEND="${COMMON_DEPEND}" +DEPEND="${COMMON_DEPEND} + luajit? ( dev-lang/swig ) + python? ( dev-lang/swig ) +" RDEPEND="${COMMON_DEPEND}" +PATCHES="${FILESDIR}/${PN}-21.1.2-use-less-automagic.patch" + CMAKE_REMOVE_MODULES_LIST=( FindFreetype ) src_configure() { @@ -69,6 +78,17 @@ src_configure() { -DOBS_MULTIARCH_SUFFIX=${libdir#lib} -DUNIX_STRUCTURE=1 ) + + if use luajit || use python; then + mycmakeargs+=( + -DDISABLE_LUA=$(usex !luajit) + -DDISABLE_PYTHON=$(usex !python) + -DENABLE_SCRIPTING=yes + ) + else + mycmakeargs+=( -DENABLE_SCRIPTING=no ) + fi + cmake-utils_src_configure } |