summaryrefslogtreecommitdiff
blob: 3dad30704078cd0af96dc93d26585482944dd4db (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
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

EAPI=6

PYTHON_COMPAT=( python2_7 )

inherit autotools elisp-common python-any-r1

DESCRIPTION="A simple but powerful template language for C++"
HOMEPAGE="https://github.com/olafvdspek/ctemplate"
SRC_URI="https://dev.gentoo.org/~pinkbyte/distfiles/${P}.tar.bz2"

LICENSE="BSD"
SLOT="0"
KEYWORDS="amd64 ~arm ~ppc x86 ~amd64-linux ~x86-linux"
IUSE="doc emacs vim-syntax static-libs test"

DEPEND="test? ( ${PYTHON_DEPS} )"
RDEPEND="
	emacs? ( virtual/emacs )
	vim-syntax? ( >=app-editors/vim-core-7 )"

SITEFILE="70ctemplate-gentoo.el"

# Some tests are broken in 2.3
RESTRICT="test"

PATCHES=( "${FILESDIR}"/${PN}-2.3-fix-build-system.patch )

src_prepare() {
	default
	eautoreconf
}

src_configure() {
	econf $(use_enable static-libs static)
}

src_compile() {
	default

	if use emacs; then
		elisp-compile contrib/tpl-mode.el
	fi
}

src_install() {
	default
	if ! use doc; then
		rm -r "${ED%/}"/usr/share/doc/${PF}/html || die
	fi

	if use vim-syntax; then
		cd "${S}/contrib" || die
		sh highlighting.vim || die "unpacking vim scripts failed"
		insinto /usr/share/vim/vimfiles
		doins -r .vim/.
	fi

	if use emacs; then
		cd "${S}/contrib" || die
		elisp-install ${PN} tpl-mode.el tpl-mode.elc
		elisp-site-file-install "${FILESDIR}/${SITEFILE}"
	fi

	# package provides .pc files
	find "${D}" -name '*.la' -delete || die
}

pkg_postinst() {
	use emacs && elisp-site-regen
}

pkg_postrm() {
	use emacs && elisp-site-regen
}