summaryrefslogtreecommitdiff
blob: f638af4de21444781c2fdce0c8f775d98471fcf3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=6

inherit toolchain-funcs

if [[ ${PV} == "9999" ]] ; then
	EGIT_REPO_URI="https://github.com/cvsync/cvsync.git"
	inherit git-r3
else
	SRC_URI="mirror://gentoo/${P}.tar.xz"
	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
	S="${WORKDIR}/${PN}"
fi

DESCRIPTION="portable CVS repository synchronization utility"
HOMEPAGE="https://github.com/cvsync/cvsync"

LICENSE="BSD"
SLOT="0"
IUSE="gcrypt mhash +openssl"
REQUIRED_USE="!openssl? ( ^^ ( gcrypt mhash ) )"

RDEPEND="sys-libs/zlib
	openssl? ( dev-libs/openssl:0= )
	!openssl? (
		gcrypt? ( dev-libs/libgcrypt:0= )
		mhash? ( app-crypt/mhash )
	)"
DEPEND="${RDEPEND}"

maint_pkg_create() {
	cd "${S}"
	local ver=$(date --date="$(git log -n1 --pretty=format:%ci HEAD)" -u "+%Y.%m.%d.%H%M%S")
	local tar="${T}/${PN}-${ver}.tar.xz"
	git archive --prefix "${PN}/" HEAD | xz > "${tar}" || die "creating tar failed"
	einfo "Packaged tar now available:"
	einfo "$(du -b "${tar}")"
}

src_unpack() {
	if [[ ${PV} == "9999" ]] ; then
		git-r3_src_unpack
		maint_pkg_create
	else
		default
	fi
}

_emake() {
	# USE flag settings are enforced by REQUIRED_USE.
	local hash=$(usex openssl openssl $(usex gcrypt gcrypt mhash))

	# Probably want to expand this at some point.
	local host_os="Linux"

	emake \
		CC="$(tc-getCC)" \
		ECHO="echo" \
		TEST="test" \
		INSTALL="install" \
		HASH_TYPE="${hash}" \
		HOST_OS="${host_os}" \
		BINOWN="$(id -u)" \
		BINGRP="$(id -g)" \
		BINDIR="\$(PREFIX)/usr/bin" \
		MANDIR="\$(PREFIX)/usr/share/man" \
		"$@"
}

src_compile() {
	_emake PREFIX="${EPREFIX}"
}

src_install() {
	dodir /usr/bin /usr/share/man/man1
	_emake PREFIX="${ED}" install
	dodoc samples/*.conf
}