summaryrefslogtreecommitdiff
blob: 47cd0b69c89c02b3422ac521cc9dfb92aef1a254 (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
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=6

inherit cmake-utils

DESCRIPTION="Electronic Schematic and PCB design tools manuals"
HOMEPAGE="http://www.kicad-pcb.org/"
SRC_URI="https://github.com/KiCad/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"

LICENSE="|| ( GPL-3+ CC-BY-3.0 ) GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="html +pdf"
LANGS="en fr it ja nl pl"
for lang in ${LANGS}; do
	LUSE+=" l10n_${lang}"
done
IUSE+=${LUSE}
REQUIRED_USE="|| ( html pdf ) ^^ ( ${LUSE} )"
unset lang
unset LUSE

DEPEND=">=app-text/asciidoc-8.6.9
	app-text/dblatex
	app-text/texlive:=[l10n_en?,l10n_fr?,l10n_it?,l10n_ja?,l10n_nl?,l10n_pl?]
	>=app-text/po4a-0.45
	>=sys-devel/gettext-0.18
	dev-util/source-highlight
	dev-perl/Unicode-LineBreak
	l10n_ja? ( media-fonts/vlgothic )"
RDEPEND=""

src_prepare() {
	DOCPATH="KICAD_DOC_INSTALL_PATH share/doc/kicad"
	sed "s|${DOCPATH}|${DOCPATH}-${PV}|g" -i CMakeLists.txt || die "sed failed"
	cmake-utils_src_prepare
}

src_configure() {
	local formats=""
	local doclang=""
	local format lang

	# construct format string
	for format in html pdf; do
		use ${format} && formats+="${format};"
	done

	# find out which language is requested
	for lang in ${LANGS}; do
		if use l10n_${lang}; then
			if [[ -z ${doclang} ]]; then
				doclang="${lang}"
			else
				ewarn "Only one single language can be enabled." \
					"Using \"${doclang}\", ignoring \"${lang}\"."
			fi
		fi
	done

	local mycmakeargs=(
		-DBUILD_FORMATS="${formats}"
		-DSINGLE_LANGUAGE="${doclang}"
	)
	cmake-utils_src_configure
}