summaryrefslogtreecommitdiff
blob: 8b6e03cbfea9199024723e65006c84ad2744ca45 (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
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

EAPI=6

inherit autotools

DESCRIPTION="A tool like sed, awk, cut, join, and sort for name-indexed data (CSV, JSON, ..)"
HOMEPAGE="http://johnkerl.org/miller"
LICENSE="BSD-2"

SLOT="0"
SRC_URI="https://github.com/johnkerl/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"

KEYWORDS="~amd64 ~arm ~x86"
IUSE="doc test"

DEPEND="sys-devel/flex"

my_for_each_test_dir() {
	local test_dirs=( c/{reg,unit}_test )
	if use test ; then
		for d in "${test_dirs[@]}" ; do
			pushd "${d}" >/dev/null || die
			"${@}" || die
			popd >/dev/null || die
		done
	fi
}

src_prepare() {
	default

	local sed_args=(
		# respect FLAGS
		-e '/.*FLAGS[^=]*=/ s:(-g|-pg|-O[0-9]) ::g'
	)
	find -type f -name "Makefile.am" | xargs sed -r "${sed_args[@]}" -i --
	assert

	# disable docs rebuilding as they're shipped prebuilt
	sed -e '/SUBDIRS[^=]*=/ s:doc::g' -i -- Makefile.am || die

	# disable building tests automagically
	use test || sed -e '/SUBDIRS[^=]*=/ s:[^ ]*_test::g' -i -- c/Makefile.am || die

	eautoreconf
}

src_test() {
	my_for_each_test_dir emake check
}

src_install() {
	local HTML_DOCS=( $(usev doc) )

	default

	doman 'doc/mlr.1'
}