summaryrefslogtreecommitdiff
path: root/dev-util/source-highlight/source-highlight-9999.ebuild
blob: e53da05cff33d68921541e9703cb12f91e504827 (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
87
88
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit bash-completion-r1 flag-o-matic libtool optfeature autotools

DESCRIPTION="Generate highlighted source code as an (x)html document"
HOMEPAGE="https://www.gnu.org/software/src-highlite/source-highlight.html"

LICENSE="GPL-3"
SLOT="0"
if [[ ${PV} == *9999* ]] ; then
	inherit git-r3
	EGIT_REPO_URI="https://https.git.savannah.gnu.org/git/src-highlite.git"
else
	SRC_URI="mirror://gnu/src-highlite/${P}.tar.gz"
	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-solaris"
fi

IUSE="doc static-libs test"
RESTRICT="!test? ( test )"

RDEPEND="dev-libs/boost:="
DEPEND="${RDEPEND}"
BDEPEND="
	sys-devel/bison
	sys-devel/flex
	test? ( dev-util/ctags )
"

src_prepare() {
	default

	[[ ${PV} == 9999 ]] && eautoreconf

	if ! use doc; then
		sed -i -e 's/ doc / /g' Makefile* || die
	fi

	# Although all unpatched libtools are probably broken, this one ignores LTO
	# warning flags.
	elibtoolize
}

src_configure() {
	# Needs bison
	unset YACC LEX

	# Fails to build otherwise with some ambiguous refs
	append-cxxflags -std=gnu++17

	# ODR violations: https://savannah.gnu.org/bugs/index.php?65086
	filter-lto

	econf \
		--without-bash-completion \
		$(use_enable static-libs static) \
		--with-boost="${EPREFIX}/usr" \
		--with-boost-regex="boost_regex"
}

src_compile() {
	local -x LD_LIBRARY_PATH="${S}/lib/srchilite/.libs/"
	emake
}

src_test() {
	local -x LD_LIBRARY_PATH="${S}/lib/srchilite/.libs/"
	emake check
}

src_install() {
	use doc && local HTML_DOCS=( doc/*.{html,css,java} )
	default

	# That's not how we want it
	rm -rf "${ED}"/usr/share/{aclocal,doc} || die

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

	dobashcomp completion/source-highlight
}

pkg_postinst() {
	optfeature "ctags support" dev-util/ctags
}