commit:     6c7d4c175f83975aa4503c3351129ee15a25cee2
Author:     Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org>
AuthorDate: Thu Apr 13 19:30:56 2023 +0000
Commit:     Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org>
CommitDate: Thu Apr 13 19:31:05 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6c7d4c17

media-video/droidcam: add 2.0.0

Signed-off-by: Andrew Ammerlaan <andrewammerlaan <AT> gentoo.org>

 media-video/droidcam/Manifest                      |   1 +
 media-video/droidcam/droidcam-2.0.0.ebuild         | 158 +++++++++++++++++++++
 .../files/droidcam-2.0.0-libusbmuxd-20.patch       |  13 ++
 3 files changed, 172 insertions(+)

diff --git a/media-video/droidcam/Manifest b/media-video/droidcam/Manifest
index 692eb532df0f..005c1b937a44 100644
--- a/media-video/droidcam/Manifest
+++ b/media-video/droidcam/Manifest
@@ -1 +1,2 @@
 DIST droidcam-1.9.0.tar.gz 85083 BLAKE2B 
ab96fd70a8514ff6f3ebb98fc482e6d8ee17f984c4929c26441ed1f6223ce5dc6421039e99068ab747012fbcb252d6e158c4c778a45f117cb8143aa278766ded
 SHA512 
47532731688c08d90dfe1c7d177154ea68180a84061050bf6602669bfb867ce6d44e1d1f351cb5526d3d4abf1c6235c26ddf53b423e3641a2956afd392f9f5f6
+DIST droidcam-2.0.0.tar.gz 85146 BLAKE2B 
95b96e7474ee457589d751caff156f9715f75cab3e54bef151334f8fe6371f5eed919e9a5df050ec683a65f15c2e40a06efc66e80e5323a8b0e6713980c75174
 SHA512 
68fe4de308df238fc096ad8b658c5d330400113c7ddf54bf0f070c9852e375273f80c7a8293bd9b5e357163305573931c94bb2bd005673086f718121181b2212

diff --git a/media-video/droidcam/droidcam-2.0.0.ebuild 
b/media-video/droidcam/droidcam-2.0.0.ebuild
new file mode 100644
index 000000000000..74b79660afd3
--- /dev/null
+++ b/media-video/droidcam/droidcam-2.0.0.ebuild
@@ -0,0 +1,158 @@
+# Copyright 2019-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit desktop linux-mod xdg
+
+DESCRIPTION="Use your phone or tablet as webcam with a v4l device driver and 
app"
+HOMEPAGE="https://www.dev47apps.com/droidcam/linux/";
+SRC_URI="https://github.com/dev47apps/${PN}/archive/v${PV//_rc1/-RC}.tar.gz -> 
${P}.tar.gz"
+S="${WORKDIR}/${PN}-${PV//_rc1/-RC}"
+
+KEYWORDS="~amd64"
+LICENSE="GPL-2"
+SLOT="0"
+
+IUSE="gtk"
+
+# Requires connection to phone/tablet
+RESTRICT="test"
+
+DEPEND="
+       app-pda/libplist
+       app-pda/libusbmuxd
+       dev-libs/glib
+       dev-libs/libayatana-appindicator
+       dev-libs/libxml2
+       dev-util/android-tools
+       media-libs/alsa-lib
+       media-libs/libjpeg-turbo
+       >=media-libs/speex-1.2.0-r1
+       media-video/ffmpeg
+       gtk? (
+               x11-libs/gdk-pixbuf
+               x11-libs/gtk+:3
+               x11-libs/libX11
+               x11-libs/pango
+       )
+"
+RDEPEND="${DEPEND}"
+BDEPEND="virtual/pkgconfig"
+
+BUILD_TARGETS="all"
+MODULE_NAMES="v4l2loopback-dc(video:${S}/v4l2loopback:${S}/v4l2loopback)"
+MODULESD_V4L2LOOPBACK_DC_ENABLED="yes"
+
+CONFIG_CHECK="~SND_ALOOP VIDEO_DEV MEDIA_SUPPORT MEDIA_CAMERA_SUPPORT"
+ERROR_SND_ALOOP="CONFIG_SND_ALOOP is optionally required for audio support"
+
+PATCHES=(
+       "${FILESDIR}/${P}-libusbmuxd-20.patch"
+)
+
+src_prepare() {
+       if ! use gtk; then
+               default
+               sed -i -e '/cflags gtk+/d' Makefile || die
+       else
+               default
+               # remove path and extension from Icon and Exec entry
+               sed -i -e 's/Icon=\/opt\/droidcam-icon.png/Icon=droidcam/g' \
+                       -e 's/\/usr\/local\/bin\/droidcam/droidcam/g' \
+                       droidcam.desktop || die
+               sed -i -e 
's%/opt/droidcam-icon.png%/usr/share/icons/hicolor/96x96/apps/droidcam.png%g' 
src/droidcam.c || die
+       fi
+}
+
+src_configure() {
+       set_arch_to_kernel
+       default
+}
+
+src_compile() {
+       if use gtk; then
+               emake droidcam
+       fi
+       emake droidcam-cli
+
+       if linux_chkconfig_present CC_IS_CLANG; then
+               BUILD_PARAMS+=' CC=${CHOST}-clang'
+               if linux_chkconfig_present LD_IS_LLD; then
+                       BUILD_PARAMS+=' LD=ld.lld'
+                       if linux_chkconfig_present LTO_CLANG_THIN; then
+                               # kernel enables cache by default leading to 
sandbox violations
+                               BUILD_PARAMS+=' ldflags-y=--thinlto-cache-dir= 
LDFLAGS_MODULE=--thinlto-cache-dir='
+                       fi
+               fi
+       fi
+       export KERNEL_DIR || die
+       linux-mod_src_compile
+}
+
+src_test() {
+       pushd "v4l2loopback" || die
+       default
+       ./test || die
+       popd || die
+}
+
+src_install() {
+       if use gtk; then
+               dobin droidcam
+               newicon -s 32 icon.png droidcam.png
+               newicon -s 96 icon2.png droidcam.png
+               domenu droidcam.desktop
+       fi
+       dobin droidcam-cli
+
+       # The cli and gui do not auto load the module if unloaded (why not 
though?)
+       # so we just put it in modules-load.d to make sure it always works
+       insinto /etc/modules-load.d
+       if linux_config_exists; then
+               if linux_chkconfig_module SND_ALOOP; then
+                       newins - "${PN}.conf" <<-EOF
+                               v4l2loopback-dc
+                               snd_aloop
+                       EOF
+               else
+                       newins - "${PN}.conf" <<-EOF
+                               v4l2loopback-dc
+                       EOF
+               fi
+       fi
+
+       einstalldocs
+       linux-mod_src_install
+}
+
+pkg_preinst() {
+       linux-mod_pkg_preinst
+       if use gtk; then
+               xdg_pkg_preinst
+       fi
+}
+
+pkg_postinst() {
+       linux-mod_pkg_postinst
+       if use gtk; then
+               xdg_pkg_postinst
+       else
+               elog
+               elog "Only droidcam-cli has been installed since 'gtk' flag was 
not set"
+               elog
+       fi
+
+       elog "The default resolution for v4l2loopback-dc (i.e. droidcam) is 
640x480."
+       elog "You can change this value in /etc/modprobe.d/v4l2loopback-dc.conf"
+       elog
+       elog "Links to the Android/iPhone/iPad apps can be found at"
+       elog "https://www.dev47apps.com/";
+}
+
+pkg_postrm() {
+       linux-mod_pkg_postrm
+       if use gtk; then
+               xdg_pkg_postrm
+       fi
+}

diff --git a/media-video/droidcam/files/droidcam-2.0.0-libusbmuxd-20.patch 
b/media-video/droidcam/files/droidcam-2.0.0-libusbmuxd-20.patch
new file mode 100644
index 000000000000..71625224aabe
--- /dev/null
+++ b/media-video/droidcam/files/droidcam-2.0.0-libusbmuxd-20.patch
@@ -0,0 +1,13 @@
+diff --git a/Makefile b/Makefile
+index f45cd20..0cf696b 100644
+--- a/Makefile
++++ b/Makefile
+@@ -20,7 +20,7 @@ GTK   = `pkg-config --libs --cflags gtk+-3.0` `pkg-config 
--libs x11`
+ GTK  += `pkg-config --libs --cflags $(APPINDICATOR)`
+ LIBAV = `pkg-config --libs --cflags libswscale libavutil`
+ JPEG  = `pkg-config --libs --cflags libturbojpeg`
+-USBMUXD = `pkg-config --libs --cflags libusbmuxd`
++USBMUXD = `pkg-config --libs --cflags libusbmuxd-2.0`
+ LIBS  = -lspeex -lasound -lpthread -lm
+ SRC   = src/connection.c src/settings.c src/decoder*.c src/av.c src/usb.c 
src/queue.c
+ 

Reply via email to