app-editors/nvi: don't force <=sys-libs/db-4.8
[gentoo.git] / app-editors / nvi / nvi-1.81.6-r7.ebuild
1 # Copyright 1999-2016 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI=6
6
7 inherit autotools db-use flag-o-matic
8
9 DESCRIPTION="Vi clone"
10 HOMEPAGE="https://sites.google.com/a/bostic.com/keithbostic/vi"
11 SRC_URI="http://garage.linux.student.kuleuven.be/~skimo/nvi/devel/${P}.tar.bz2"
12
13 LICENSE="BSD"
14 SLOT="0"
15 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~mips ~ppc ~ppc64 ~sparc ~x86"
16 IUSE="perl tcl unicode"
17
18 CDEPEND=">=sys-libs/db-4.2.52_p5:=
19         >=sys-libs/ncurses-5.6-r2:=
20         perl? ( dev-lang/perl )
21         tcl? ( >=dev-lang/tcl-8.5:0 )"
22
23 DEPEND="${CDEPEND}
24         virtual/pkgconfig"
25
26 RDEPEND="${CDEPEND}
27         app-eselect/eselect-vi"
28
29 REQUIRED_USE="tcl? ( !unicode )"
30
31 PATCHES=(
32         "${FILESDIR}"/${P}-strlen-macro-renaming.patch
33         "${FILESDIR}"/${P}-db44.patch
34         "${FILESDIR}"/${P}-db.patch
35         "${FILESDIR}"/${P}-perl-as-needed.patch
36         "${FILESDIR}"/${P}-perl-shortnames.patch
37         "${FILESDIR}"/${P}-ac_config_header.patch
38         "${FILESDIR}"/${P}-use_pkgconfig_for_ncurses.patch
39         "${FILESDIR}"/${P}-printf-types.patch
40         )
41
42 src_prepare() {
43         default
44
45         cd dist || die
46         chmod +x findconfig || die
47
48         mv configure.{in,ac} || die
49         sed -i -e "s@-ldb@-l$(db_libname)@" configure.ac || die
50         sed -i -e "s@^install-\(.*\)-local:@install-\1-hook:@" Makefile.am || die
51         eautoreconf -Im4
52 }
53
54 src_configure() {
55         local myconf
56
57         use perl && myconf="${myconf} --enable-perlinterp"
58         use unicode && myconf="${myconf} --enable-widechar"
59         use tcl && myconf="${myconf} --enable-tclinterp"
60
61         append-cppflags "-D_PATH_MSGCAT=\"\\\"${EPREFIX%/}/usr/share/vi/catalog/\\\"\""
62         append-cppflags -I"$(db_includedir)"
63
64         pushd dist 2>/dev/null || die
65         econf \
66                 --program-prefix=n \
67                 ${myconf}
68         popd 2>/dev/null || die
69 }
70
71 src_compile() {
72         emake -C dist
73 }
74
75 src_install() {
76         emake -C dist DESTDIR="${D}" install
77 }
78
79 pkg_postinst() {
80         einfo "Setting /usr/bin/vi symlink"
81         eselect vi update --if-unset
82 }
83
84 pkg_postrm() {
85         einfo "Updating /usr/bin/vi symlink"
86         eselect vi update --if-unset
87 }