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

EAPI=5

inherit eutils multilib toolchain-funcs flag-o-matic

DESCRIPTION="A free stand-alone ini file parsing library"
HOMEPAGE="https://github.com/ndevilla/iniparser"
SRC_URI="https://github.com/ndevilla/iniparser/archive/v${PV}.tar.gz -> ${P}.tar.gz"

LICENSE="MIT"
SLOT="4"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
IUSE="doc examples static-libs"

DEPEND="doc? ( app-doc/doxygen )"
RDEPEND=""

DOCS=( AUTHORS README.md )

PATCHES=(
	"${FILESDIR}"/${P}-cflags.patch
	"${FILESDIR}"/${P}-soname.patch
)

_newlib_so_with_symlinks() {
	local source="${1}" base="${2}" current="${3}" revision="${4}" age="${5}"
	local libdir="$(get_libdir)"

	newlib.so ${source} ${base}.so.${current}.${revision}.${age}
	for i in ".${current}" '' ; do
		dosym ${base}.so.${current}.${revision}.${age} /usr/${libdir}/${base}.so${i}
	done
}

src_prepare() {
	epatch "${PATCHES[@]}"
	rm -R html || die
}

src_configure() {
	append-lfs-flags
}

_emake() {
	emake CC="$(tc-getCC)" AR="$(tc-getAR)" V=1 "$@"
}

src_compile() {
	_emake
}

src_test() {
	_emake -C test
}

src_install() {
	use static-libs && newlib.a lib${PN}.a lib${PN}${SLOT}.a
	_newlib_so_with_symlinks lib${PN}.so lib${PN}${SLOT} 1 0 0

	insinto /usr/include/${PN}${SLOT}
	doins src/*.h

	if use doc; then
		emake -C doc
		dohtml -r html/*
	fi

	if use examples ; then
		local examplesdir="/usr/share/doc/${PF}/examples"
		insinto "${examplesdir}"
		doins example/*
		docompress -x "${examplesdir}"
	fi

	dodoc "${DOCS[@]}"
}