Merge github#887: app-admin/collectd: Version bump to v5.5.1
[gentoo.git] / dev-vcs / cvsync / cvsync-2014.08.24.014706.ebuild
1 # Copyright 1999-2016 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI="5"
6
7 inherit toolchain-funcs
8
9 if [[ ${PV} == "9999" ]] ; then
10         EGIT_REPO_URI="https://github.com/cvsync/cvsync.git"
11         inherit git-2
12 else
13         SRC_URI="mirror://gentoo/${P}.tar.xz"
14         KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
15 fi
16
17 DESCRIPTION="portable CVS repository synchronization utility"
18 HOMEPAGE="https://github.com/cvsync/cvsync"
19
20 LICENSE="BSD"
21 SLOT="0"
22 IUSE="gcrypt mhash +openssl"
23 REQUIRED_USE="!openssl? ( ^^ ( gcrypt mhash ) )"
24
25 RDEPEND="sys-libs/zlib
26         openssl? ( dev-libs/openssl:0= )
27         !openssl? (
28                 gcrypt? ( dev-libs/libgcrypt:0= )
29                 mhash? ( app-crypt/mhash )
30         )"
31 DEPEND="${RDEPEND}"
32
33 S="${WORKDIR}/${PN}"
34
35 maint_pkg_create() {
36         cd "${S}"
37         local ver=$(date --date="$(git log -n1 --pretty=format:%ci HEAD)" -u "+%Y.%m.%d.%H%M%S")
38         local tar="${T}/${PN}-${ver}.tar.xz"
39         git archive --prefix "${PN}/" HEAD | xz > "${tar}" || die "creating tar failed"
40         einfo "Packaged tar now available:"
41         einfo "$(du -b "${tar}")"
42 }
43
44 src_unpack() {
45         if [[ ${PV} == "9999" ]] ; then
46                 git-2_src_unpack
47                 maint_pkg_create
48         else
49                 default
50         fi
51 }
52
53 _emake() {
54         # USE flag settings are enforced by REQUIRED_USE.
55         local hash=$(usex openssl openssl $(usex gcrypt gcrypt mhash))
56
57         # Probably want to expand this at some point.
58         local host_os="Linux"
59
60         emake \
61                 CC="$(tc-getCC)" \
62                 ECHO="echo" \
63                 TEST="test" \
64                 INSTALL="install" \
65                 HASH_TYPE="${hash}" \
66                 HOST_OS="${host_os}" \
67                 BINOWN="$(id -u)" \
68                 BINGRP="$(id -g)" \
69                 BINDIR="\$(PREFIX)/usr/bin" \
70                 MANDIR="\$(PREFIX)/usr/share/man" \
71                 "$@"
72 }
73
74 src_compile() {
75         _emake PREFIX="${EPREFIX}"
76 }
77
78 src_install() {
79         dodir /usr/bin /usr/share/man/man1
80         _emake PREFIX="${ED}" install
81         dodoc samples/*.conf
82 }