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

EAPI=7

inherit flag-o-matic toolchain-funcs

DESCRIPTION="A set of utilities for constructing finite-state automata and transducers"
HOMEPAGE="https://github.com/mhulden/foma"
SRC_URI="https://bitbucket.org/mhulden/foma/downloads/${P}.tar.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="amd64 x86"

DEPEND="sys-libs/readline:*
	sys-libs/zlib"
RDEPEND="${DEPEND}"

PATCHES=( "${FILESDIR}/foma-0.9.18-clean-makefile.patch" )

src_prepare() {
	default

	# Install to correct libdir
	sed "s|/lib|/$(get_libdir)|" -i Makefile || die

	append-cflags -fcommon
}

src_compile() {
	export CC="$(tc-getCC)"
	export RANLIB="$(tc-getRANLIB)"

	export CFLAGS="${CFLAGS} -Wl,--as-needed -D_GNU_SOURCE -std=c99 -fvisibility=hidden -fPIC"
	export FLOOKUPLDFLAGS="${LDFLAGS} libfoma.a -lz"
	export LDFLAGS="${LDFLAGS} -lreadline -lz -lncurses"

	default
}

src_install() {
	emake prefix="${D}"/usr install
	einstalldocs
	find "${D}" -name '*.a' -delete || die
}