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