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

EAPI=8

inherit autotools flag-o-matic toolchain-funcs

DESCRIPTION="COmputer Language Manipulation"
HOMEPAGE="https://www.colm.net/open-source/colm/"
SRC_URI="https://www.colm.net/files/${PN}/${P}.tar.gz"

LICENSE="MIT"
SLOT="0"
KEYWORDS="~alpha amd64 arm arm64 hppa ~loong ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
IUSE="doc"

BDEPEND="
	doc? (
		|| ( app-text/asciidoc dev-ruby/asciidoctor )
		dev-python/pygments
	)
"
# libfsm moved from ragel -> colm, bug #766108
RDEPEND="!<dev-util/ragel-7.0.3"

PATCHES=(
	"${FILESDIR}"/${PN}-0.14.7-drop-julia-check.patch
	"${FILESDIR}"/${PN}-0.14.7-disable-static-lib.patch
	"${FILESDIR}"/${PN}-0.14.7-solaris.patch
)

src_prepare() {
	default

	# bug #733426
	sed -i -e 's/(\[ASCIIDOC\], \[asciidoc\], \[asciidoc\]/S([ASCIIDOC], [asciidoc asciidoctor]/' configure.ac || die

	# Respect CC/CXX (bug #766069), we also omit CFLAGS here because
	# it seems to crash with some combinations and the software is fragile
	# (bug #883993).
	sed -i -e "s|gcc|$(tc-getCC)|" src/main.cc || die
	sed -i -e "s|gcc|$(tc-getCC)|" test/colm.d/gentests.sh || die
	sed -i -e "s|g++|$(tc-getCXX)|" test/colm.d/gentests.sh || die

	# fix linkage on Darwin from colm itself during build
	if [[ ${CHOST} == *-darwin* ]] ; then
		sed -i -e 's/libcolm\.so/libcolm.dylib/' src/main.cc || die
	fi

	eautoreconf
}

src_configure() {
	# We need to be careful with both ragel and colm.
	# See bug #858341, bug #883993 bug #924163.
	filter-lto
	append-flags -fno-strict-aliasing

	econf $(use_enable doc manual)
}

src_test() {
	# Build tests
	default

	# Run them
	cd test || die
	./runtests || die
}

src_install() {
	default
	find "${ED}" -type f -name '*.la' -delete || die
}