ab756e635713f3c6b5f95f8b03c4c1213867d96c
[gentoo.git] / net-misc / rsync / rsync-3.1.3.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 inherit flag-o-matic prefix systemd
7
8 DESCRIPTION="File transfer program to keep remote files into sync"
9 HOMEPAGE="https://rsync.samba.org/"
10 SRC_URI="https://rsync.samba.org/ftp/rsync/src/${P}.tar.gz"
11 [[ "${PV}" = *_pre* ]] && SRC_URI="https://rsync.samba.org/ftp/rsync/src-previews/${P/_/}.tar.gz"
12
13 LICENSE="GPL-3"
14 SLOT="0"
15 [[ ${PV} = *_pre* ]] || \
16 KEYWORDS="~alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 ~riscv s390 sparc x86 ~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
17 IUSE="acl examples iconv ipv6 static stunnel xattr"
18
19 LIB_DEPEND="acl? ( virtual/acl[static-libs(+)] )
20         xattr? ( kernel_linux? ( sys-apps/attr[static-libs(+)] ) )
21         >=dev-libs/popt-1.5[static-libs(+)]"
22 RDEPEND="!static? ( ${LIB_DEPEND//\[static-libs(+)]} )
23         iconv? ( virtual/libiconv )"
24 DEPEND="${RDEPEND}
25         static? ( ${LIB_DEPEND} )"
26
27 S="${WORKDIR}/${P/_/}"
28
29 src_configure() {
30         use static && append-ldflags -static
31         local myeconfargs=(
32                 --with-rsyncd-conf="${EPREFIX}"/etc/rsyncd.conf
33                 --without-included-popt
34                 $(use_enable acl acl-support)
35                 $(use_enable iconv)
36                 $(use_enable ipv6)
37                 $(use_enable xattr xattr-support)
38         )
39         econf "${myeconfargs[@]}"
40         touch proto.h-tstamp #421625
41 }
42
43 src_install() {
44         emake DESTDIR="${D}" install
45
46         newconfd "${FILESDIR}"/rsyncd.conf.d rsyncd
47         newinitd "${FILESDIR}"/rsyncd.init.d-r1 rsyncd
48
49         dodoc NEWS OLDNEWS README TODO tech_report.tex
50
51         insinto /etc
52         newins "${FILESDIR}"/rsyncd.conf-3.0.9-r1 rsyncd.conf
53
54         insinto /etc/logrotate.d
55         newins "${FILESDIR}"/rsyncd.logrotate rsyncd
56
57         insinto /etc/xinetd.d
58         newins "${FILESDIR}"/rsyncd.xinetd-3.0.9-r1 rsyncd
59
60         # Install stunnel helpers
61         if use stunnel ; then
62                 emake DESTDIR="${D}" install-ssl-client
63                 emake DESTDIR="${D}" install-ssl-daemon
64         fi
65
66         # Install the useful contrib scripts
67         if use examples ; then
68                 exeinto /usr/share/rsync
69                 doexe support/*
70                 rm -f "${ED%/}"/usr/share/rsync/{Makefile*,*.c}
71         fi
72
73         eprefixify "${ED%/}"/etc/{,xinetd.d}/rsyncd*
74
75         systemd_dounit "${FILESDIR}/rsyncd.service"
76 }
77
78 pkg_postinst() {
79         if egrep -qis '^[[:space:]]use chroot[[:space:]]*=[[:space:]]*(no|0|false)' \
80                 "${EROOT}"/etc/rsyncd.conf "${EROOT}"/etc/rsync/rsyncd.conf ; then
81                 ewarn "You have disabled chroot support in your rsyncd.conf.  This"
82                 ewarn "is a security risk which you should fix.  Please check your"
83                 ewarn "/etc/rsyncd.conf file and fix the setting 'use chroot'."
84         fi
85         if use stunnel ; then
86                 einfo "Please install \">=net-misc/stunnel-4\" in order to use stunnel feature."
87                 einfo
88                 einfo "You maybe have to update the certificates configured in"
89                 einfo "${EROOT}/etc/stunnel/rsync.conf"
90         fi
91 }