summaryrefslogtreecommitdiff
blob: e5610ca1418426a315c2400ddbe7dce391af29fb (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
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=6

inherit flag-o-matic

DESCRIPTION="BibTool is a powerful command-line tool to manipulate BibTeX databases."
HOMEPAGE="http://www.gerd-neugebauer.de/software/TeX/BibTool.en.html"
SRC_URI="http://mirror.ctan.org/biblio/bibtex/utils/bibtool/${P}.tar.gz"

LICENSE="GPL-1"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="doc"

DEPEND="
	dev-libs/kpathsea
	doc? ( app-text/texlive )"
RDEPEND="$DEPEND"

S="${WORKDIR}/${PN}"

src_prepare()
{
	sed -e 's,^INSTALL_DIR.*\./mkdirchain,INSTALL_DIR = install -d,g' \
		-e 's,^BIBTOOL_DEFAULT.*$,BIBTOOL_DEFAULT = \\"\.:/usr/share/bibtool\\",g' \
		-e 's,^LIBDIR.*$,LIBDIR = @libdir@/bibtool,g' \
		-e 's,^NON_ANSI_DEFS.*,NON_ANSI_DEFS = @DEFS@ -DSTDC_HEADERS,g' \
		-e 's,\$(INSTALLPREFIX),\$(DESTDIR)\$(INSTALLPREFIX),g' \
		-i AutoConf/makefile.in || die
	default
}

src_configure()
{
	append-flags -fno-strict-aliasing
	econf
	sed -i -e 's#@kpathsea_lib_static@##' makefile || die "sed failed"
}

src_compile() {
	emake CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}"
	if use doc ; then
		ln -s makefile Makefile
		emake doc
	fi
}

src_install()
{
	emake DESTDIR="${D}" install

	doman doc/bibtool.1 || die

	if use doc ; then
		dodoc doc/{bibtool.pdf,c_lib.pdf,ref_card.pdf} || die
	fi
}