aboutsummaryrefslogtreecommitdiff
blob: 580c12ffddc0554dc817c7cbeb7e717e6579e231 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# Copyright 2019-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

COMMIT="98cbf07def9604f92fd74ea2964d483347388909"

inherit desktop linux-mod xdg

DESCRIPTION="Use android phone as webcam, using a v4l device driver and app"
HOMEPAGE="https://www.dev47apps.com/droidcam/linuxx/
	https://github.com/aramg/droidcam"
SRC_URI="https://github.com/aramg/${PN}/archive/${COMMIT}.tar.gz -> ${P}.tar.gz"

KEYWORDS="~amd64"
LICENSE="droidcam"
SLOT="0"

# Requires connection to android phone
RESTRICT="test"

BDEPEND="media-libs/libjpeg-turbo"

RDEPEND="x11-libs/gtk+:2"

S="${WORKDIR}/${PN}-${COMMIT}/linux"

PATCHES="${FILESDIR}/${PN}-libjpeg-location.patch"

CONFIG_CHECK="VIDEO_DEV"
MODULE_NAMES="v4l2loopback-dc(video:${S}/v4l2loopback:${S}/v4l2loopback)"
MODULESD_V4L2LOOPBACK_DC_ENABLED="yes"
BUILD_TARGETS="all"

src_configure() {
	set_arch_to_kernel
	default
}

src_compile() {
	default
	KERNELRELEASE="${KV_FULL}" linux-mod_src_compile
}

src_test() {
	pushd "v4l2loopback"
	default
	./test || die
	popd
}

src_install() {
	linux-mod_src_install
	dobin "${PN}"
	dobin "${PN}-cli"

	newicon -s 32x32 icon.png ${PN}.png
	newicon -s 64x64 icon2.png ${PN}.png
	make_desktop_entry ${PN} "Droidcam" ${PN} 'AudioVideo;Video'

	# The cli and gui do not auto load the module if unloaded (why not tho?)
	# so we just put it in modules-load.d to make sure it always works
	insinto /usr/lib/modules-load.d/
	doins "${FILESDIR}/v4l2loopback-dc.conf"
}

pkg_postinst() {
	linux-mod_pkg_postinst
	xdg_pkg_postinst

	elog "To use this, you'll need to download the android app as well:"
	elog "Free version: https://play.google.com/store/apps/details?id=com.dev47apps.droidcam"
	elog "Paid version: https://play.google.com/store/apps/details?id=com.dev47apps.droidcamx"
}