ed88b00512a13b9f31efd92d429fee6117f6ec68
[gentoo.git] / app-admin / clsync / clsync-0.4.2.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 inherit autotools eutils linux-info
7
8 DESCRIPTION="Live sync tool based on inotify, written in GNU C"
9 HOMEPAGE="https://github.com/xaionaro/clsync http://ut.mephi.ru/oss/clsync"
10 SRC_URI="https://github.com/xaionaro/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
11 LICENSE="GPL-3+"
12 SLOT="0"
13 KEYWORDS="amd64 x86"
14 IUSE="+caps cluster control-socket cgroups debug extra-debug
15 extra-hardened gio hardened +highload-locks +inotify mhash
16 namespaces seccomp"
17
18 REQUIRED_USE="
19         || ( gio inotify )
20         extra-debug? ( debug )
21         extra-hardened? ( hardened )
22         mhash? ( cluster )
23         seccomp? ( caps )
24 "
25 CDEPEND="
26         dev-libs/glib:2
27         cgroups? ( dev-libs/libcgroup )
28         mhash? ( app-crypt/mhash )
29 "
30 DEPEND="${CDEPEND}
31         virtual/pkgconfig
32 "
33 RDEPEND="${CDEPEND}
34         ~app-doc/clsync-docs-${PV}
35 "
36
37 pkg_pretend() {
38         use namespaces && CONFIG_CHECK="~NAMESPACES ~UTS_NS ~IPC_NS ~USER_NS ~PID_NS ~NET_NS"
39         use seccomp && CONFIG_CHECK+=" ~SECCOMP"
40         check_extra_config
41 }
42
43 src_prepare() {
44         eapply_user
45         eautoreconf
46 }
47
48 src_configure() {
49         local harden_level=0
50         use hardened && harden_level=1
51         use extra-hardened && harden_level=2
52
53         local debug_level=0
54         use debug && debug_level=1
55         use extra-debug && debug_level=2
56
57         econf \
58                 --docdir="${EPREFIX}/usr/share/doc/${PF}" \
59                 --disable-socket-library \
60                 --enable-clsync \
61                 --enable-debug=${debug_level} \
62                 --enable-paranoid=${harden_level} \
63                 --without-bsm \
64                 --without-kqueue \
65                 $(use_enable caps capabilities) \
66                 $(use_enable cluster) \
67                 $(use_enable control-socket socket) \
68                 $(use_enable highload-locks) \
69                 $(use_enable namespaces unshare) \
70                 $(use_enable seccomp) \
71                 $(use_with cgroups libcgroup) \
72                 $(use_with gio gio lib) \
73                 $(use_with inotify inotify native) \
74                 $(use_with mhash)
75 }
76
77 src_install() {
78         emake DESTDIR="${D}" install
79
80         # docs go into clsync-docs
81         rm -rf "${ED}/usr/share/doc" || die
82
83         newinitd "${FILESDIR}/${PN}.initd" "${PN}"
84         newconfd "${FILESDIR}/${PN}.confd" "${PN}"
85
86         # filter rules and sync scripts are supposed to be here
87         insinto /etc/${PN}
88         newins "${FILESDIR}/${PN}.conf" "${PN}.conf"
89         keepdir /etc/${PN}
90 }
91
92 pkg_postinst() {
93         einfo "${PN} is just a convenient way to run synchronization tools on live data,"
94         einfo "it doesn't copy data itself, so you need to install software to do actual"
95         einfo "data transfer. Usually net-misc/rsync is a good choise, but ${PN} is"
96         einfo "is flexible enough to use any user tool, see manual page for details."
97         einfo
98         einfo "${PN} init script can be multiplexed, to use symlink init script to"
99         einfo "othername and use conf.d/othername to configure it."
100         einfo
101         einfo "If you're interested in improved security, enable"
102         einfo "USE=\"caps cgroups hardened namespaces seccomp\""
103 }