# $Id: Portfile 92837 2012-05-09 00:51:48Z ryandesign@macports.org $

PortSystem 1.0

name		poldek
version		0.30-cvs20080225.00
revision	1
platforms	darwin
categories	sysutils
maintainers	nomaintainer
description	A full-featured frontend to RPM
long_description \
poldek is an RPM package management tool which allows you to easily \
perform package verification, installation (including system \
installation from scratch), upgrading, and removal. \
\
Program can be used in batch (like apt-get from Debian's \
APT) or interactive mode. The interactive mode puts you into a \
readline interface with command line autocompletion and history, \
similar to the shell mode of Perl's CPAN.
homepage	http://poldek.pld-linux.org/
master_sites	${homepage}download/snapshots/
use_bzip2	yes
checksums	md5 22b2cfb19cebd123e8d8148fb6ca27de

depends_lib	port:rpm port:argp-standalone port:ncurses \
		lib:libpcre:pcre lib:libcheck:check lib:libxml2:libxml2


patchfiles	patch-obsoletes.c patch-rpmdb_it.c patch-pm.h \
		patch-utillibs.diff patch-realpath.diff \
		patch-rpmlog.diff patch-libvfile.sym \
		patch-libpoldek.sym patch-libpoclidek.sym
use_autoconf	yes
post-patch 	{ system "aclocal -I${prefix}/share/aclocal" }

configure.cppflags-append	"-I${prefix}/include/rpm"
post-configure { reinplace "s;-largp;;" ${worksrcpath}/cli/Makefile }

# build system keeps clobbering the changes done to Makefile, due to changed config.status
pre-build {
	system "cd ${worksrcpath}; ${build.cmd} || true"
	reinplace "s;-largp;;" ${worksrcpath}/cli/Makefile
	# some other lame thing forgets to replace a var:
	ln -s mkinstalldirs ${worksrcpath}/@MKINSTALLDIRS@
}

post-destroot {
	xinstall -d ${destroot}${prefix}/etc/poldek
	copy ${filespath}/macports-source.conf ${destroot}${prefix}/etc/poldek/macports-source.conf
	reinplace "s|_distro  = pld|_distro  = macports|" ${destroot}${prefix}/etc/poldek/poldek.conf
	reinplace "s|@@ARCH@@|${os.arch}|g" ${destroot}${prefix}/etc/poldek/macports-source.conf
	reinplace "s|@@PLATFORM@@|${os.platform}|g" ${destroot}${prefix}/etc/poldek/macports-source.conf
}
