Gentoo Archives: gentoo-commits

From: Andrew Ammerlaan <andrewammerlaan@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: media-video/droidcam/
Date: Tue, 07 Dec 2021 10:04:02
Message-Id: 1638871436.11969b481623edbaf7ea89dff434f24917da08be.andrewammerlaan@gentoo
1 commit: 11969b481623edbaf7ea89dff434f24917da08be
2 Author: Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org>
3 AuthorDate: Tue Dec 7 09:59:36 2021 +0000
4 Commit: Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org>
5 CommitDate: Tue Dec 7 10:03:56 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=11969b48
7
8 media-video/droidcam: add version 1.8.1
9
10 Package-Manager: Portage-3.0.28, Repoman-3.0.3
11 Signed-off-by: Andrew Ammerlaan <andrewammerlaan <AT> gentoo.org>
12
13 media-video/droidcam/Manifest | 1 +
14 media-video/droidcam/droidcam-1.8.1.ebuild | 156 +++++++++++++++++++++++++++++
15 2 files changed, 157 insertions(+)
16
17 diff --git a/media-video/droidcam/Manifest b/media-video/droidcam/Manifest
18 index eaca205848fa..eeff2b0ec94a 100644
19 --- a/media-video/droidcam/Manifest
20 +++ b/media-video/droidcam/Manifest
21 @@ -1 +1,2 @@
22 DIST droidcam-1.8.0.tar.gz 84376 BLAKE2B 581e57e2c80dd9662764e399dd797e5893f617e69ee2501a1063d1c51434baf64d7d2b72779debede6d679127f31fa95a4e67953978da591acbf6a41bd05551d SHA512 b448f686562030b352630c6b677a098ecb5041582dd06e57809b04674cb334d02ddfdf1d09b43e1ecc70897e8073714ad6913ab14d894a7679fc433adb3fda82
23 +DIST droidcam-1.8.1.tar.gz 84566 BLAKE2B ba023c98159003bef39eac2fcff211243aa5fb2cc4369a333c5b78c9708b8c34ff9987d6b84628b32e436bab776e0c8c83f75b7c6a788f85831d3d17dd468833 SHA512 58ce6014004edcbf89b4847ed916f9cd2757865172c61e446a04b2f6d93395db1013f0cb31f0b10161bfd83a1436e684891c3457371a3ad62308509bb85b4cf4
24
25 diff --git a/media-video/droidcam/droidcam-1.8.1.ebuild b/media-video/droidcam/droidcam-1.8.1.ebuild
26 new file mode 100644
27 index 000000000000..d81482560789
28 --- /dev/null
29 +++ b/media-video/droidcam/droidcam-1.8.1.ebuild
30 @@ -0,0 +1,156 @@
31 +# Copyright 2019-2021 Gentoo Authors
32 +# Distributed under the terms of the GNU General Public License v2
33 +
34 +EAPI=7
35 +
36 +inherit desktop linux-mod xdg
37 +
38 +DESCRIPTION="Use your phone or tablet as webcam with a v4l device driver and app"
39 +HOMEPAGE="https://www.dev47apps.com/droidcam/linux/"
40 +SRC_URI="https://github.com/dev47apps/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
41 +
42 +KEYWORDS="~amd64"
43 +LICENSE="GPL-2"
44 +SLOT="0"
45 +
46 +IUSE="gtk"
47 +
48 +# Requires connection to phone/tablet
49 +RESTRICT="test"
50 +
51 +DEPEND="
52 + app-pda/libplist
53 + app-pda/libusbmuxd
54 + dev-libs/glib
55 + dev-libs/libappindicator:3
56 + dev-libs/libxml2
57 + dev-util/android-tools
58 + media-libs/alsa-lib
59 + media-libs/libjpeg-turbo
60 + >=media-libs/speex-1.2.0-r1
61 + media-video/ffmpeg
62 + gtk? (
63 + dev-cpp/gtkmm:3.0
64 + x11-libs/gdk-pixbuf
65 + x11-libs/gtk+:3
66 + x11-libs/libX11
67 + x11-libs/pango
68 + )
69 +"
70 +RDEPEND="${DEPEND}"
71 +BDEPEND="virtual/pkgconfig"
72 +
73 +BUILD_TARGETS="all"
74 +MODULE_NAMES="v4l2loopback-dc(video:${S}/v4l2loopback:${S}/v4l2loopback)"
75 +MODULESD_V4L2LOOPBACK_DC_ENABLED="yes"
76 +
77 +CONFIG_CHECK="~SND_ALOOP VIDEO_DEV MEDIA_SUPPORT MEDIA_CAMERA_SUPPORT"
78 +ERROR_SND_ALOOP="CONFIG_SND_ALOOP is optionally required for audio support"
79 +
80 +PATCHES="${FILESDIR}/${PN}-makefile-fixes.patch"
81 +
82 +src_prepare() {
83 + if ! use gtk; then
84 + sed -i -e '/cflags gtk+/d' Makefile || die
85 + default
86 + else
87 + # remove path and extension from Icon and Exec entry
88 + sed -i -e 's/Icon=\/opt\/droidcam-icon.png/Icon=droidcam/g' \
89 + -e 's/\/usr\/local\/bin\/droidcam/droidcam/g' \
90 + droidcam.desktop || die
91 + sed -i -e 's%/opt/droidcam-icon.png%/usr/share/icons/hicolor/96x96/apps/droidcam.png%g' src/droidcam.c || die
92 + xdg_src_prepare
93 + fi
94 +}
95 +
96 +src_configure() {
97 + set_arch_to_kernel
98 + default
99 +}
100 +
101 +src_compile() {
102 + if use gtk; then
103 + emake droidcam
104 + fi
105 + emake droidcam-cli
106 +
107 + if linux_chkconfig_present CC_IS_CLANG; then
108 + BUILD_PARAMS+=' CC=${CHOST}-clang'
109 + if linux_chkconfig_present LD_IS_LLD; then
110 + BUILD_PARAMS+=' LD=ld.lld'
111 + if linux_chkconfig_present LTO_CLANG_THIN; then
112 + # kernel enables cache by default leading to sandbox violations
113 + BUILD_PARAMS+=' ldflags-y=--thinlto-cache-dir= LDFLAGS_MODULE=--thinlto-cache-dir='
114 + fi
115 + fi
116 + fi
117 + export KERNEL_DIR || die
118 + linux-mod_src_compile
119 +}
120 +
121 +src_test() {
122 + pushd "v4l2loopback" || die
123 + default
124 + ./test || die
125 + popd || die
126 +}
127 +
128 +src_install() {
129 + if use gtk; then
130 + dobin droidcam
131 + newicon -s 32 icon.png droidcam.png
132 + newicon -s 96 icon2.png droidcam.png
133 + domenu droidcam.desktop
134 + fi
135 + dobin droidcam-cli
136 +
137 + # The cli and gui do not auto load the module if unloaded (why not though?)
138 + # so we just put it in modules-load.d to make sure it always works
139 + insinto /etc/modules-load.d
140 + if linux_config_exists; then
141 + if linux_chkconfig_module SND_ALOOP; then
142 + newins - "${PN}.conf" <<-EOF
143 + v4l2loopback-dc
144 + snd_aloop
145 + EOF
146 + else
147 + newins - "${PN}.conf" <<-EOF
148 + v4l2loopback-dc
149 + EOF
150 + fi
151 + fi
152 +
153 + einstalldocs
154 + linux-mod_src_install
155 +}
156 +
157 +pkg_preinst() {
158 + linux-mod_pkg_preinst
159 + if use gtk; then
160 + xdg_pkg_preinst
161 + fi
162 +}
163 +
164 +pkg_postinst() {
165 + linux-mod_pkg_postinst
166 + if use gtk; then
167 + xdg_pkg_postinst
168 + else
169 + elog
170 + elog "Only droidcam-cli has been installed since 'gtk' flag was not set"
171 + elog
172 + fi
173 +
174 + elog "The default resolution for v4l2loopback-dc (i.e. droidcam) is 640x480."
175 + elog "You can change this value in /etc/modprobe.d/v4l2loopback-dc.conf"
176 + elog
177 + elog "Links to the Android/iPhone/iPad apps can be found at"
178 + elog "https://www.dev47apps.com/"
179 +}
180 +
181 +pkg_postrm() {
182 + linux-mod_pkg_postrm
183 + if use gtk; then
184 + xdg_pkg_postrm
185 + fi
186 +}