Merge remote-tracking branch 'jirutka/lxc-grsec'
[gentoo.git] / dev-cpp / ctemplate / ctemplate-2.2.ebuild
1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI="4"
6
7 inherit elisp-common python
8
9 DESCRIPTION="A simple but powerful template language for C++"
10 HOMEPAGE="https://github.com/olafvdspek/ctemplate"
11 SRC_URI="https://ctemplate.googlecode.com/files/${P}.tar.gz"
12
13 LICENSE="BSD"
14 SLOT="0"
15 KEYWORDS="amd64 arm ppc x86 ~amd64-linux ~x86-linux"
16 IUSE="doc emacs vim-syntax static-libs test"
17
18 DEPEND="test? ( =dev-lang/python-2* )"
19 RDEPEND="vim-syntax? ( >=app-editors/vim-core-7 )
20         emacs? ( virtual/emacs )"
21
22 SITEFILE="70ctemplate-gentoo.el"
23
24 pkg_setup() {
25         if use test ; then
26                 python_set_active_version 2
27                 python_pkg_setup
28         fi
29 }
30
31 src_configure() {
32         econf \
33                 --enable-shared \
34                 $(use_enable static-libs static)
35 }
36
37 src_compile() {
38         default
39
40         if use emacs ; then
41                 elisp-compile contrib/tpl-mode.el || die "elisp-compile failed"
42         fi
43 }
44
45 src_install() {
46         emake DESTDIR="${D}" install
47
48         # Installs just every piece
49         rm -rf "${ED}/usr/share/doc"
50
51         dodoc AUTHORS ChangeLog NEWS README
52         use doc && dohtml doc/*
53
54         if use vim-syntax ; then
55                 cd "${S}/contrib"
56                 sh highlighting.vim || die "unpacking vim scripts failed"
57                 insinto /usr/share/vim/vimfiles
58                 doins -r .vim/*
59         fi
60
61         if use emacs ; then
62                 cd "${S}/contrib"
63                 elisp-install ${PN} tpl-mode.el tpl-mode.elc || die "elisp-install failed"
64                 elisp-site-file-install "${FILESDIR}/${SITEFILE}"
65         fi
66
67         find "${ED}" -name '*.la' -exec rm -f {} +
68 }
69
70 pkg_postinst() {
71         use emacs && elisp-site-regen
72 }
73
74 pkg_postrm() {
75         use emacs && elisp-site-regen
76 }