# Copyright 1999-2007 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit eutils python autotools perl-module DESCRIPTION="Red Hat Package Management Utils" HOMEPAGE="http://rpm5.org" SRC_URI="http://rpm5.org/files/rpm/rpm-4.4/${P}.tar.gz" LICENSE="GPL-2" SLOT="0" KEYWORDS="~amd64 ~ppc ~ppc64 ~s390 ~sparc ~x86" IUSE="doc lua nls perl python sqlite syck debug" GUID="37" RDEPEND="sys-libs/db sys-libs/zlib dev-libs/elfutils virtual/libintl >=app-arch/bzip2-1.0.4 >=dev-libs/popt-1.6 >=app-crypt/gnupg-1.2 virtual/libintl >=dev-libs/beecrypt-4.1.2 lua? ( dev-lang/lua ) python? ( >=dev-lang/python-2.4 ) perl? ( >=dev-lang/perl-5.8.8 ) nls? ( sys-devel/gettext ) sqlite? ( >=dev-db/sqlite-3.3.5 ) syck? ( dev-libs/syck ) net-misc/neon" DEPEND="${RDEPEND} nls? ( sys-devel/gettext ) doc? ( app-doc/doxygen )" pkg_setup() { if use perl; then ewarn "Perl bindings are provided by perl module RPM2. Just run:" ewarn "emerge app-portage/g-cpan" ewarn "g-cpan -i RPM2" ewarn "or if you prefer:" ewarn "g-cpan -i RPM4" fi } src_unpack() { unpack ${A} cd "${S}" # If this dir is removed rpm links against Gentoo popt. rm -rf popt } src_compile() { use debug && append-flags -g2 -ggdb && filter-flags -fomit-frame-pointer # we use arch-gentoo-linux-{gnu,uclibc} tuple export CHOST="${CHOST//-pc-/-gentoo-}" export CHOST="${CHOST//-unknown-/-gentoo-}" local conf conf="--without-selinux" if use doc; then conf="${conf} --with-apidoc" fi if use python; then python_version conf="${conf} --with-python=${PYVER}" else conf="${conf} --without-python" fi local locations locations="--bindir=/usr/bin \ --sbindir=/usr/sbin \ --sysconfdir=/etc \ --mandir=/usr/share/man \ --infodir=/usr/share/info \ --datadir=/usr/share \ --localstatedir=/var/lib" #--libexecdir= #--sharedstatedir= #--libdir= #--includedir= #--oldincludedir= #--datarootdir= #--localedir= #--docdir= #--htmldir= #--dvidir= #--pdfdir= #--psdir= econf ${locations} \ ${conf} \ $(use_with lua) \ $(use_with perl) \ $(use_with sqlite) \ $(use_enable nls) \ $(use_with syck) \ || die "econf failed" emake -j1 || die "emake failed" } src_install() { emake DESTDIR="${D}" install || die "emake install failed" mv "${D}/bin/rpm" "${D}/usr/bin/" rmdir "${D}/bin" for magic_file in "magic.mime.mgc" "magic.mgc" "magic.mime" "magic"; do dosym /usr/share/misc/file/${magic_file} /usr/lib/rpm/${magic_file} done # So not to overwrite perlpod use perl && fixlocalpod dodoc CHANGES CREDITS GROUPS README* use doc && dohtml -r apidocs/html/* keepdir /usr/src/rpm/{SRPMS,SPECS,SOURCES,RPMS,BUILD} } pkg_preinst() { enewgroup ${PN} ${GUID} enewuser ${PN} ${GUID} /bin/bash /var/lib/rpm rpm } pkg_postinst() { chown -R rpm:rpm ${ROOT}/usr/lib/rpm chown -R rpm:rpm ${ROOT}/var/lib/rpm chown rpm:rpm ${ROOT}/usr/bin/rpm{,2cpio,build,db,query,sign,verify} if [[ -f ${ROOT}/var/lib/rpm/Packages ]] ; then einfo "RPM database found... Rebuilding database (may take a while)..." "${ROOT}"/usr/bin/rpm --rebuilddb --root=${ROOT} else einfo "No RPM database found... Creating database..." "${ROOT}"/usr/bin/rpm --initdb --root=${ROOT} fi chown rpm:rpm ${ROOT}/var/lib/rpm/* }