# $Id: Portfile 56061 2009-08-24 00:33:19Z ryandesign@macports.org $
PortSystem 1.0

name		xli
version		1.17.0
revision	2
categories	graphics
platforms	darwin
depends_lib	port:xorg-libs lib:png:libpng lib:jpeg:jpeg
master_sites	http://pantransit.reptiles.org/prog/
homepage	http://pantransit.reptiles.org/prog/index.html#xli
checksums	md5 996d8cd0b2be2071332412c6802852e6
maintainers	fenner
patchfiles	patch-Imakefile patch-rlelib.c
description	X11 Image Loading Utility
post-extract {
	# Handle "zopen" collision with /usr/include/stdio.h .
	#
	set files [glob "${worksrcpath}/*.\[ch]"]
	# It'd be nice to pass files to reinplace all at once.
	foreach file $files {
		# Some files come read-only and reinplace doesn't like that
		file attributes $file -permissions +w
		reinplace s/zopen/xli_zopen/ $file
	}
}
#use_xmkmf	yes
configure {
	system "cd ${worksrcpath} && imake -DUseInstalled -I/usr/X11R6/lib/X11/config -T${portpath}/${filesdir}/Port.tmpl"
}
pre-destroot {
	# XXX
	# need X11-in-prefix mtree
	xinstall -d -m 755 ${destroot}${prefix}/lib/X11/app-defaults

        reinplace "s|XAPPLOADDIR = \$(LIBDIR)/app-defaults|XAPPLOADDIR = ${prefix}/lib/X11/app-defaults|g" \
                "${worksrcpath}/Makefile"

}
destroot.destdir	DESTDIR=${destroot} prefix=${prefix}
build.args	prefix=${prefix} JPEG_INCLUDES=-I${prefix}/include JPEG_LDFLAGS=-L${prefix}/lib
long_description xli is a fast image viewer for X11, which supports \
 many different types of images.
