summaryrefslogtreecommitdiff
path: root/dev-db/libpg_query/libpg_query-16.5.1.0.ebuild
blob: bb9c746e30178ccfc726d3020adac0c4493ece54 (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 2023-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

MY_PV="${PV/16\./16-}"
DESCRIPTION="C library for accessing the PostgreSQL parser outside of the server environment"
HOMEPAGE="https://github.com/pganalyze/libpg_query"
SRC_URI="https://github.com/pganalyze/libpg_query/archive/${MY_PV}.tar.gz -> ${P}.gh.tar.gz"
S="${WORKDIR}/${PN}-${MY_PV}"

LICENSE="BSD"
SLOT="0/16"
KEYWORDS="~amd64"
IUSE="examples static-libs"

BDEPEND="
	dev-libs/protobuf-c
	dev-libs/xxhash
"

src_prepare() {
	default

	if ! use static-libs; then
		sed -i -e "s/^install: \$(ARLIB) \$(SOLIB)$/install: \$(SOLIB)/" "${S}"/Makefile || die
		sed -i -e "/^	\$(INSTALL) -m 644 \$(ARLIB) \"\$(DESTDIR)\"\$(libdir)\/\$(ARLIB)$/d" "${S}"/Makefile || die
	fi
}

src_compile() {
	emake build_shared
	use static-libs && emake build
	use examples && emake examples
}

src_test() {
	emake test
}

src_install() {
	emake \
		prefix="${ED}"/usr \
		libdir="${ED}/usr/$(get_libdir)" \
		install
}