commit: c5e77d623333c44dd5ef82715a11a22ade63ad51 Author: Andrew Ammerlaan <andrewammerlaan <AT> riseup <DOT> net> AuthorDate: Wed Jul 29 11:21:50 2020 +0000 Commit: Andrew Ammerlaan <andrewammerlaan <AT> riseup <DOT> net> CommitDate: Wed Jul 29 11:21:50 2020 +0000 URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=c5e77d62
media-tv/droidcam: many fixes to the ebuild - added missing deps - bumped to a offical release version (jeej there are now releases) - improved makefile patch - added gtk use flag, it is now possible to only install the cli part of the program - expanded config check, package now has audio support Many thanks to @henrikp See also: https://github.com/gentoo/gentoo/pull/16736 Package-Manager: Portage-3.0.1, Repoman-2.3.23 Signed-off-by: Andrew Ammerlaan <andrewammerlaan <AT> riseup.net> media-tv/droidcam/Manifest | 2 +- media-tv/droidcam/droidcam-1.4.ebuild | 126 +++++++++++++++++++++ .../droidcam/droidcam-6.7.7_pre20200506.ebuild | 74 ------------ media-tv/droidcam/files/README.gentoo | 6 + .../droidcam/files/droidcam-libjpeg-location.patch | 13 --- .../droidcam/files/droidcam-makefile-fixes.patch | 44 +++++++ 6 files changed, 177 insertions(+), 88 deletions(-) diff --git a/media-tv/droidcam/Manifest b/media-tv/droidcam/Manifest index affc279..13a8d36 100644 --- a/media-tv/droidcam/Manifest +++ b/media-tv/droidcam/Manifest @@ -1 +1 @@ -DIST droidcam-6.7.7_pre20200506.tar.gz 54514 BLAKE2B 1a68736bf70b11f216eea9893bc858ea6b859c2d0b6a89d9e5e5c9d7a9dc1a7ed97d6e1cea96ae3c8683d08effa861c59b9576dcf804bbae7a25c368b3fee50b SHA512 e9864cdd311e91fd417ce5d33ec15ce76dd9b4f3fa50eef7dadddee8db2f788ad992dd869b1d27e41df02df1e9a08fec3544e539378808d3fa862ffdecea11a7 +DIST droidcam-1.4.tar.gz 84350 BLAKE2B 3d627f94aa9d04b3ce9785005b5a3d06895c74254001033c7d881bdc2359e3d34db5668e0df59a9f293014f7cd78e6f4aa07f25cd8a8ed3f54c1658a9406e7d8 SHA512 60ca2d15514a03a71e04e0f5e1382a5af4e7244329d4113e8af1dd0adb8a448febc60adf94bbcad8db8de0e0ffd906de1f2427488dc9e27ebe7739c7331ac99d diff --git a/media-tv/droidcam/droidcam-1.4.ebuild b/media-tv/droidcam/droidcam-1.4.ebuild new file mode 100644 index 0000000..9048b4b --- /dev/null +++ b/media-tv/droidcam/droidcam-1.4.ebuild @@ -0,0 +1,126 @@ +# Copyright 2019-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit desktop eutils linux-mod readme.gentoo-r1 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/v${PV}.tar.gz -> ${P}.tar.gz" + +KEYWORDS="~amd64" +LICENSE="GPL-2" +SLOT="0" + +IUSE="gtk" + +# Requires connection to android phone +RESTRICT="test" + +DEPEND=" + gtk? ( + dev-cpp/gtkmm:3.0 + media-video/ffmpeg + ) + =app-pda/libusbmuxd-1* + media-libs/alsa-lib +" + +BDEPEND=" + media-libs/libjpeg-turbo + >=media-libs/speex-1.2.0-r1 + virtual/pkgconfig +" + +S="${WORKDIR}/${P}/linux" + +PATCHES="${FILESDIR}/${PN}-makefile-fixes.patch" + +DOCS=( README.md README-DKMS.md ) +DISABLE_AUTOFORMATTING="true" +DOC_CONTENTS=" + The default resolution for v4l2loopback-dc[1] is 640x480. You can override the + value by copying droidcam.conf.default to /etc/modprobe.d/droidcam.conf + and modifying 'width' and 'height'. + [1] https://github.com/aramg/droidcam/issues/56 +" + +BUILD_TARGETS="all" +MODULE_NAMES="v4l2loopback-dc(video:${S}/v4l2loopback:${S}/v4l2loopback)" +CONFIG_CHECK="VIDEO_DEV ~SND_ALOOP MEDIA_SUPPORT MEDIA_CAMERA_SUPPORT" +ERROR_SND_ALOOP="CONFIG_SND_ALOOP: missing, required for audio support" +MODULESD_V4L2LOOPBACK_DC_ENABLED="yes" + +src_prepare() { + default + if ! use gtk ; then + sed -i -e '/cflags gtk+/d' Makefile + fi + linux-mod_pkg_setup +} + +src_configure() { + set_arch_to_kernel + default +} + +src_compile() { + if use gtk ; then + emake droidcam + fi + emake droidcam-cli + KERNELRELEASE="${KV_FULL}" linux-mod_src_compile +} + +src_test() { + pushd "v4l2loopback" + default + ./test || die + popd +} + +src_install() { + if use gtk ; then + dobin droidcam + newicon -s 32 icon.png droidcam.png + newicon -s 48 icon2.png droidcam.png + make_desktop_entry "${PN}" "DroidCam Client" "${PN}" AudioVideo + fi + dobin "${PN}-cli" + + readme.gentoo_create_doc + + # 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" + + einstalldocs + linux-mod_src_install +} + +pkg_postinst() { + linux-mod_pkg_postinst + + if use gtk ; then + xdg_pkg_postinst + fi + + elog "" + elog "To use this package, 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" + + elog "" + optfeature "to connection with USB via ADB instead of over wifi" dev-util/android-tools +} + +pkg_postrm() { + if use gtk ; then + xdg_pkg_postrm + fi + + linux-mod_pkg_postrm +} diff --git a/media-tv/droidcam/droidcam-6.7.7_pre20200506.ebuild b/media-tv/droidcam/droidcam-6.7.7_pre20200506.ebuild deleted file mode 100644 index 580c12f..0000000 --- a/media-tv/droidcam/droidcam-6.7.7_pre20200506.ebuild +++ /dev/null @@ -1,74 +0,0 @@ -# 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" -} diff --git a/media-tv/droidcam/files/README.gentoo b/media-tv/droidcam/files/README.gentoo new file mode 100644 index 0000000..6a5bdb4 --- /dev/null +++ b/media-tv/droidcam/files/README.gentoo @@ -0,0 +1,6 @@ +The default resolution for v4l2loopback-dc is 640x480. You can override these +values in /etc/modprobe.d/v4l2loopback-dc.conf +and modifying 'width' and 'height'. + +See https://github.com/aramg/droidcam/issues/56 on why a fork of v4l2loopback +is currently being used here. diff --git a/media-tv/droidcam/files/droidcam-libjpeg-location.patch b/media-tv/droidcam/files/droidcam-libjpeg-location.patch deleted file mode 100644 index 1b1a1e0..0000000 --- a/media-tv/droidcam/files/droidcam-libjpeg-location.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/Makefile b/Makefile -index 3a37443..2a68b2e 100644 ---- a/Makefile -+++ b/Makefile -@@ -13,7 +13,7 @@ JPEG_LIB ?= $(JPEG_DIR)/lib`getconf LONG_BIT` - CC = -no-pie - GTK = `pkg-config --libs --cflags gtk+-2.0` `pkg-config --libs x11` - LIBS = `pkg-config --libs --cflags libswscale libavutil` --JPEG = -I$(JPEG_INCLUDE) $(JPEG_LIB)/libturbojpeg.a -+JPEG = -I/usr/include /usr/lib`getconf LONG_BIT`/libturbojpeg.so - SRC = src/connection.c src/decoder.c - NO_WARN = -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast - diff --git a/media-tv/droidcam/files/droidcam-makefile-fixes.patch b/media-tv/droidcam/files/droidcam-makefile-fixes.patch new file mode 100644 index 0000000..238898c --- /dev/null +++ b/media-tv/droidcam/files/droidcam-makefile-fixes.patch @@ -0,0 +1,44 @@ +diff --git a/Makefile b/Makefile +index 97a6e1f..6779293 100644 +--- a/Makefile ++++ b/Makefile +@@ -6,7 +6,7 @@ + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + # Use at your own risk. See README file for more details. + +-JPEG_DIR ?= /opt/libjpeg-turbo ++JPEG_DIR ?= /usr + JPEG_INCLUDE ?= $(JPEG_DIR)/include + JPEG_LIB ?= $(JPEG_DIR)/lib`getconf LONG_BIT` + +@@ -15,14 +15,14 @@ CC = -std=c++11 -x c++ -Wall -fPIC -no-pie + GTK = `pkg-config --libs --cflags gtk+-3.0` `pkg-config --libs x11` + LIBAV = `pkg-config --libs --cflags libswscale libavutil` + LIBS = -lspeex -lasound -lpthread -lm +-JPEG = -I$(JPEG_INCLUDE) $(JPEG_LIB)/libturbojpeg.a ++JPEG = -I$(JPEG_INCLUDE) $(JPEG_LIB)/libturbojpeg.so + SRC = src/connection.c src/settings.c src/decoder*.c src/av.c src/usb.c + + all: droidcam-cli droidcam + + ifeq "$(RELEASE)" "1" +-LIBAV = /usr/lib/x86_64-linux-gnu/libswscale.a /usr/lib/x86_64-linux-gnu/libavutil.a +-SRC += /usr/lib/x86_64-linux-gnu/libusbmuxd.a /usr/lib/x86_64-linux-gnu/libxml2.a src/libplist-2.0.a ++LIBAV = /usr/lib/x86_64-linux-gnu/libswscale.so /usr/lib/x86_64-linux-gnu/libavutil.so ++SRC += /usr/lib/x86_64-linux-gnu/libusbmuxd.so /usr/lib/x86_64-linux-gnu/libxml2.so src/libplist-2.0.so + package: clean all + zip -x *.png src/ src/* Makefile -r droidcam_`date +%s`.zip ./* + +@@ -34,10 +34,10 @@ gresource: .gresource.xml icon2.png + glib-compile-resources .gresource.xml --generate-source --target=src/resources.c + + droidcam-cli: src/droidcam-cli.c $(SRC) +- $(GXX) $(CC) $^ $(JPEG) $(LIBAV) $(LIBS) -o droidcam-cli ++ $(GXX) $(CC) $(LDFLAGS) $(CFLAGS) $^ $(JPEG) $(LIBAV) $(LIBS) -o droidcam-cli + + droidcam: src/droidcam.c src/resources.c $(SRC) +- $(GXX) $(CC) $^ $(GTK) $(JPEG) $(LIBAV) $(LIBS) -o droidcam ++ $(GXX) $(CC) $(LDFLAGS) $(CFLAGS) $^ $(GTK) $(JPEG) $(LIBAV) $(LIBS) -o droidcam + + clean: + rm droidcam || true