3 |
3 |
|
4 |
4 |
EAPI=7
|
5 |
5 |
|
|
6 |
inherit systemd
|
|
7 |
|
6 |
8 |
DESCRIPTION="MJPG-streamer takes JPGs from Linux-UVC compatible webcams"
|
7 |
|
HOMEPAGE="https://sourceforge.net/projects/mjpg-streamer"
|
8 |
|
SRC_URI="https://dev.gentoo.org/~aidecoe/distfiles/${CATEGORY}/${PN}/${P}.tar.bz2"
|
|
9 |
HOMEPAGE="https://github.com/jacksonliam/mjpg-streamer"
|
|
10 |
EGIT_COMMIT="85f89a8c321e799fabb1693c5d133f3fb48ee748"
|
|
11 |
SRC_URI="https://github.com/jacksonliam/${PN}/archive/${EGIT_COMMIT}.tar.gz -> ${P}.tar.gz"
|
9 |
12 |
|
10 |
13 |
LICENSE="GPL-2"
|
11 |
14 |
SLOT="0"
|
12 |
|
KEYWORDS="~amd64 ~x86"
|
|
15 |
KEYWORDS="~amd64 ~arm64 ~x86"
|
13 |
16 |
|
14 |
|
INPUT_PLUGINS="input-testpicture input-control input-file input-uvc"
|
15 |
|
OUTPUT_PLUGINS="output-file output-udp output-http output-autofocus output-rtsp"
|
|
17 |
INPUT_PLUGINS="input-testpicture input-control input-file input-uvc input-http input-ptp2 input-raspicam"
|
|
18 |
OUTPUT_PLUGINS="output-file output-udp output-http output-autofocus output-rtsp output-viewer output-zmqserver"
|
16 |
19 |
IUSE_PLUGINS="${INPUT_PLUGINS} ${OUTPUT_PLUGINS}"
|
17 |
|
IUSE="input-testpicture input-control +input-file input-uvc output-file
|
18 |
|
output-udp +output-http output-autofocus output-rtsp
|
19 |
|
www"
|
|
20 |
IUSE="input-testpicture input-control +input-file input-uvc input-http input-ptp2 input-raspicam
|
|
21 |
output-file output-udp +output-http output-autofocus output-rtsp output-viewer output-zmqserver
|
|
22 |
www http-management wxp-compat"
|
20 |
23 |
REQUIRED_USE="|| ( ${INPUT_PLUGINS} )
|
21 |
24 |
|| ( ${OUTPUT_PLUGINS} )"
|
22 |
25 |
|
23 |
26 |
RDEPEND="virtual/jpeg
|
24 |
|
input-uvc? ( media-libs/libv4l )"
|
|
27 |
input-uvc? ( media-libs/libv4l acct-group/video )
|
|
28 |
input-ptp2? ( media-libs/libgphoto2 )
|
|
29 |
input-raspicam? (
|
|
30 |
|| ( media-libs/raspberrypi-userland media-libs/raspberrypi-userland-bin )
|
|
31 |
)
|
|
32 |
output-zmqserver? (
|
|
33 |
dev-libs/protobuf-c
|
|
34 |
net-libs/zeromq
|
|
35 |
)"
|
25 |
36 |
DEPEND="${RDEPEND}
|
26 |
37 |
input-testpicture? ( media-gfx/imagemagick )"
|
27 |
38 |
|
28 |
|
PATCHES=(
|
29 |
|
"${FILESDIR}/make-var-instead-of-cmd.patch"
|
30 |
|
"${FILESDIR}/to-work-with-kernel-3.18.patch"
|
31 |
|
)
|
|
39 |
S="${WORKDIR}/${PN}-${EGIT_COMMIT}/${PN}-experimental"
|
32 |
40 |
|
33 |
41 |
src_prepare() {
|
34 |
|
default
|
|
42 |
sed -i -e "s|.*RPATH.*||g" CMakeLists.txt || die
|
|
43 |
if use wxp-compat; then
|
|
44 |
sed -i -e \
|
|
45 |
's|^add_feature_option(WXP_COMPAT "Enable compatibility with WebcamXP" OFF)|add_feature_option(WXP_COMPAT "Enable compatibility with WebcamXP" ON)|g' \
|
|
46 |
CMakeLists.txt || die
|
|
47 |
fi
|
35 |
48 |
|
36 |
49 |
local flag switch
|
37 |
|
|
38 |
50 |
for flag in ${IUSE_PLUGINS}; do
|
39 |
51 |
use ${flag} && switch='' || switch='#'
|
40 |
52 |
flag=${flag/input-/input_}
|
41 |
53 |
flag=${flag/output-/output_}
|
42 |
|
sed -i \
|
43 |
|
-e "s|^#*PLUGINS +\?= ${flag}.so|${switch}PLUGINS += ${flag}.so|" \
|
44 |
|
Makefile
|
|
54 |
sed -i -e \
|
|
55 |
"s|^add_subdirectory(plugins\/${flag})|${switch}add_subdirectory(plugins/${flag})|" \
|
|
56 |
CMakeLists.txt || die
|
45 |
57 |
done
|
46 |
|
}
|
|
58 |
if use http-management; then
|
|
59 |
sed -i -e \
|
|
60 |
's|^add_feature_option(ENABLE_HTTP_MANAGEMENT "Enable experimental HTTP management option" OFF)|add_feature_option(ENABLE_HTTP_MANAGEMENT "Enable experimental HTTP management option" ON)|g' \
|
|
61 |
plugins/output_http/CMakeLists.txt || die
|
|
62 |
fi
|
|
63 |
sed -e "s|@LIBDIR@|$(get_libdir)/${PN}/$(get_libdir)|g" "${FILESDIR}/${PN}.initd" > ${PN}.initd || die
|
47 |
64 |
|
48 |
|
src_compile() {
|
49 |
|
local v4l=$(use input-uvc && echo 'USE_LIBV4L2=true')
|
50 |
|
emake ${v4l}
|
|
65 |
default
|
51 |
66 |
}
|
52 |
67 |
|
53 |
68 |
src_install() {
|
54 |
69 |
into /usr
|
55 |
70 |
dobin ${PN//-/_}
|
|
71 |
into "/usr/$(get_libdir)/${PN}"
|
56 |
72 |
dolib.so *.so
|
57 |
73 |
|
58 |
74 |
if use www ; then
|
... | ... | |
60 |
76 |
doins -r www
|
61 |
77 |
fi
|
62 |
78 |
|
63 |
|
dodoc README TODO
|
|
79 |
dodoc README.md TODO
|
64 |
80 |
|
65 |
|
sed -e "s|@LIBDIR@|$(get_libdir)|g" "${FILESDIR}/${PN}.initd" | newinitd - ${PN}
|
|
81 |
newinitd ${PN}.initd ${PN}
|
66 |
82 |
newconfd "${FILESDIR}"/${PN}.confd ${PN}
|
|
83 |
systemd_dounit mjpg_streamer@.service
|
67 |
84 |
}
|
68 |
85 |
|
69 |
86 |
pkg_postinst() {
|
|
87 |
einfo
|
70 |
88 |
elog "Remember to set an input and output plugin for mjpg-streamer."
|
71 |
89 |
|
|
90 |
if use input-uvc ; then
|
|
91 |
elog "To use the UVC plugin as a regular user, you must be a part of the video group"
|
|
92 |
fi
|
|
93 |
|
72 |
94 |
if use www ; then
|
73 |
|
echo
|
|
95 |
einfo
|
74 |
96 |
elog "An example webinterface has been installed into"
|
75 |
97 |
elog "/usr/share/mjpg-streamer/www for your usage."
|
76 |
98 |
fi
|
|
99 |
einfo
|
77 |
100 |
}
|