Merge remote-tracking branch 'github/pr/674'.
[gentoo.git] / app-arch / rpm / rpm-4.11.2.ebuild
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI=5
6
7 PYTHON_COMPAT=( python2_7 )
8
9 inherit eutils autotools flag-o-matic perl-module python-single-r1 versionator
10
11 DESCRIPTION="Red Hat Package Management Utils"
12 HOMEPAGE="http://www.rpm.org"
13 SRC_URI="http://rpm.org/releases/rpm-$(get_version_component_range 1-2).x/${P}.tar.bz2"
14
15 LICENSE="GPL-2 LGPL-2"
16 SLOT="0"
17 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-linux ~x86-linux"
18
19 IUSE="nls python doc caps lua acl selinux"
20
21 CDEPEND="!app-arch/rpm5
22         >=sys-libs/db-4.5
23         >=sys-libs/zlib-1.2.3-r1
24         >=app-arch/bzip2-1.0.1
25         >=dev-libs/popt-1.7
26         >=app-crypt/gnupg-1.2
27         dev-libs/elfutils
28         virtual/libintl
29         >=dev-lang/perl-5.8.8
30         dev-libs/nss
31         python? ( ${PYTHON_DEPS} )
32         nls? ( virtual/libintl )
33         lua? ( >=dev-lang/lua-5.1.0[deprecated] )
34         acl? ( virtual/acl )
35         caps? ( >=sys-libs/libcap-2.0 )"
36
37 DEPEND="${CDEPEND}
38         nls? ( sys-devel/gettext )
39         doc? ( app-doc/doxygen )"
40 RDEPEND="${CDEPEND}
41         selinux? ( sec-policy/selinux-rpm )"
42 REQUIRED_USE="
43         python? ( ${PYTHON_REQUIRED_USE} )
44 "
45
46 src_prepare() {
47         epatch \
48                 "${FILESDIR}"/${PN}-4.11.0-autotools.patch \
49                 "${FILESDIR}"/${PN}-4.8.1-db-path.patch \
50                 "${FILESDIR}"/${PN}-4.9.1.2-libdir.patch
51
52         # fix #356769
53         sed -i 's:%{_var}/tmp:/var/tmp:' macros.in || die "Fixing tmppath failed"
54
55         eautoreconf
56
57         # Prevent automake maintainer mode from kicking in (#450448).
58         touch -r Makefile.am preinstall.am
59 }
60
61 src_configure() {
62         append-cppflags -I"${EPREFIX}/usr/include/nss" -I"${EPREFIX}/usr/include/nspr"
63         econf \
64                 --without-selinux \
65                 --with-external-db \
66                 --without-beecrypt \
67                 $(use_enable python) \
68                 $(use_with doc hackingdocs) \
69                 $(use_enable nls) \
70                 $(use_with lua) \
71                 $(use_with caps cap) \
72                 $(use_with acl)
73 }
74
75 src_compile() {
76         default
77 }
78
79 src_install() {
80         default
81
82         # remove la files
83         prune_libtool_files --all
84
85         mv "${ED}"/bin/rpm "${ED}"/usr/bin
86         rmdir "${ED}"/bin
87         # fix symlinks to /bin/rpm (#349840)
88         for binary in rpmquery rpmverify;do
89                 ln -sf rpm "${ED}"/usr/bin/${binary}
90         done
91
92         use nls || rm -rf "${ED}"/usr/share/man/??
93
94         keepdir /usr/src/rpm/{SRPMS,SPECS,SOURCES,RPMS,BUILD}
95
96         dodoc CHANGES CREDITS GROUPS README*
97         if use doc; then
98                 pushd doc/hacking/html
99                 dohtml -p hacking -r .
100                 popd
101                 pushd doc/librpm/html
102                 dohtml -p librpm -r .
103                 popd
104         fi
105
106         # Fix perllocal.pod file collision
107         perl_delete_localpod
108 }
109
110 pkg_postinst() {
111         if [[ -f "${EROOT}"/var/lib/rpm/Packages ]] ; then
112                 einfo "RPM database found... Rebuilding database (may take a while)..."
113                 "${EROOT}"/usr/bin/rpmdb --rebuilddb --root="${EROOT}"
114         else
115                 einfo "No RPM database found... Creating database..."
116                 "${EROOT}"/usr/bin/rpmdb --initdb --root="${EROOT}"
117         fi
118 }