summaryrefslogtreecommitdiff
blob: ccc6cc82e815da0f031e95c92b9e0aff4ca0d6f8 (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
81
82
83
84
85
86
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

EAPI=5
AUTOTOOLS_IN_SOURCE_BUILD=1

inherit autotools-utils perl-module sgml-catalog toolchain-funcs

DESCRIPTION="A toolset for processing LinuxDoc DTD SGML files"
HOMEPAGE="https://tracker.debian.org/pkg/linuxdoc-tools"
SRC_URI="mirror://debian/pool/main/l/${PN}/${PN}_${PV}.orig.tar.gz"

LICENSE="MIT SGMLUG"
SLOT="0"
KEYWORDS="amd64 ~ia64 ppc x86 ~x86-fbsd"
IUSE="doc"

DEPEND="
	|| ( app-text/openjade app-text/opensp )
	app-text/sgml-common
	dev-lang/perl:=
	|| ( sys-apps/gawk sys-apps/mawk )
	sys-apps/groff
	doc? (
		dev-texlive/texlive-fontsrecommended
		virtual/latex-base
	)
"
RDEPEND="${DEPEND}"

PATCHES=( "${FILESDIR}/${P}-compiler.patch" )

DOCS=( ChangeLog README )

sgml-catalog_cat_include "/etc/sgml/linuxdoc.cat" \
	"/usr/share/linuxdoc-tools/linuxdoc-tools.catalog"

src_prepare() {
	# Fix malloc include.
	sed -e \
		's/#include <malloc.h>/#include <stdlib.h>/' \
		-i rtf-fix/rtf2rtf.l || die

	# Fix SGML catalog path.
	sed -e \
		's%/iso-entities-8879.1986/iso-entities.cat%/sgml-iso-entities-8879.1986/catalog%' \
		-i perl5lib/LinuxDocTools.pm || die

	# Fix doc install path.
	sed -e \
		"s%/share/doc/linuxdoc-tools%/share/doc/${PF}%" \
		-i Makefile.in

	# Upstream developers unconditionally build docs during the install phase.
	# The only sane solution in this case is to patch things out from Makefile.
	# See Gentoo bug #558610 for more info.
	use doc || epatch "${FILESDIR}/${P}-disable-doc-build.patch"

	autotools-utils_src_prepare
}

src_configure() {
	perl_set_version
	tc-export CC
	local myeconfargs=(
		--with-texdir="/usr/share/texmf/tex/latex/misc"
		--with-perllibdir="${VENDOR_ARCH}"
		--with-installed-iso-entities
	)
	autotools-utils_src_configure
}

src_compile() {
	autotools-utils_src_compile
}

src_install() {
	# Prevent access violations from bitmap font files generation.
	export VARTEXFONTS="${T}/fonts"

	# Help linuxdoc-tools find sgml-iso-entities catalog again.
	export SGML_CATALOG_FILES="/usr/share/sgml/sgml-iso-entities-8879.1986/catalog"

	autotools-utils_src_install
}