summaryrefslogtreecommitdiff
blob: 8f0106b2c5a7af452e69cc5e5786e683d11a6702 (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
# Copyright 2012-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=6
RESTRICT="mirror"
inherit cmake-utils flag-o-matic multilib

DESCRIPTION="search ARCH database for packages with similar commands"
HOMEPAGE="https://github.com/metti/command-not-found/"
SRC_URI="https://github.com/metti/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"

LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE=""

COMMON="sys-libs/tdb"
DEPEND="${COMMON}"
RDEPEND="${COMMON}"

S="${WORKDIR}/${P}/src"

src_prepare() {
	PREFIX=${EPREFIX}
	filter-flags -fwhole-program
	sed -i -e 1d -e '2i#! /bin/sh' cnf-cron.in || die
	sed -i \
		-e "s!usr/lib!usr/$(get_libdir)!g" \
		-e "/^INSTALL.*cnf\.sh/,/^INSTALL/{/EXECUTE/d}" \
		CMakeLists.txt || die
	sed -i -e "s/function[[:space:]]*\([^[:space:](]*\)[[:space:]]*(/\1(/" \
		cnf.sh || die
	default
}

src_install() {
	dodir /var/lib/cnf
	cmake-utils_src_install
}

pkg_postrm() {
	local a
	if [ -z "${REPLACED_BY_VERSION}" ] && a="${EPREFIX}/var/lib/cnf" && \
		test -d "${a}"
	then	ewarn "removing now unneeded ${a}"
		rm -rf -- "${a}"
	fi
}