profiles/arch/arm64: Unmask py3.8+3.9
[gentoo.git] / x11-misc / blockdpy / blockdpy-1-r1.ebuild
1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 inherit toolchain-funcs
7
8 DESCRIPTION="Tool to block access via the physical display while x11vnc is running"
9 HOMEPAGE="http://www.karlrunge.com/x11vnc/blockdpy.c"
10 SRC_URI="http://www.karlrunge.com/x11vnc/blockdpy.c"
11
12 LICENSE="GPL-2"
13 SLOT="0"
14 KEYWORDS="~amd64 ~x86"
15 IUSE=""
16
17 RDEPEND="
18         x11-libs/libX11
19         x11-libs/libXext"
20 DEPEND="${RDEPEND}
21         virtual/pkgconfig"
22
23 S=${WORKDIR}
24
25 src_unpack() {
26         cp "${DISTDIR}"/blockdpy.c blockdpy.c || die
27 }
28
29 src_prepare() {
30         default
31
32         # Add includes to avoid QA warnings.
33         sed -i '/#include <stdio.h>/i#include <stdlib.h>' blockdpy.c || die
34         sed -i '/#include <stdio.h>/i#include <string.h>' blockdpy.c || die
35 }
36
37 src_compile() {
38         $(tc-getCC) ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} \
39                 $($(tc-getPKG_CONFIG) --cflags x11) \
40                 $($(tc-getPKG_CONFIG) --cflags xext) \
41                 -o blockdpy blockdpy.c \
42                 $($(tc-getPKG_CONFIG) --libs x11) \
43                 $($(tc-getPKG_CONFIG) --libs xext) \
44                         || die "compile failed"
45
46         # Create README from head comment in source.
47         sed -n '1,/^ *\*\//s/^[ -]*\*[ \/]*//p' < blockdpy.c > README || die
48 }
49
50 src_install() {
51         dobin blockdpy
52         einstalldocs
53 }
54
55 pkg_postinst() {
56         # Just warn about missing xlock instead of requiring it in case
57         # the user wants to use something else.
58         if [[ ! -x ${EPREFIX}/usr/bin/xlock ]]; then
59                 ewarn 'The xlock executable was not found.'
60                 ewarn 'blockdpy runs "xlock" as the screen-lock program by default.'
61                 ewarn 'You should either install x11-misc/xlockmore or override the'
62                 ewarn 'default by calling blockdpy with the -lock option or by'
63                 ewarn 'setting the XLOCK_CMD environment variable.'
64                 ewarn
65                 ewarn "  Examples:  blockdpy -lock 'xscreensaver-command -lock'"
66                 ewarn "             blockdpy -lock 'kdesktop_lock --forcelock'"
67                 ewarn
68         fi
69 }