# $Id: Portfile,v 1.5 2005/10/19 08:10:10 blb Exp $

PortSystem			1.0
name				jbigkit
version				1.6
categories			graphics
maintainers			blb@opendarwin.org
description			Data compression algorithm for bi-level high-res images
long_description \
	JBIG-KIT provides a portable library of compression and decompression \
	functions with a documented interface that you can very easily include \
	into your image or document processing software. In addition, JBIG-KIT \
	provides ready-to-use compression and decompression programs with a \
	simple command line interface (similar to the converters found in netpbm).

platforms			darwin

homepage			http://www.cl.cam.ac.uk/~mgk25/${name}
master_sites		http://www.cl.cam.ac.uk/~mgk25/download/

checksums			md5 ce196e45f293d40ba76af3dc981ccfd7

worksrcdir			${name}

post-patch {
	reinplace "s|@@PREFIX@@|${prefix}|g" ${worksrcpath}/libjbig/Makefile
}

use_configure		no

destroot {
	xinstall -m 755 -d ${destroot}/${prefix}/bin \
		${destroot}/${prefix}/include ${destroot}/${prefix}/lib \
		${destroot}/${prefix}/share/man/man1 \
		${destroot}/${prefix}/share/doc/${name} \
		${destroot}/${prefix}/share/examples
	xinstall -m 755 -W ${worksrcpath}/pbmtools jbgtopbm pbmtojbg \
		${destroot}/${prefix}/bin
	xinstall -m 644 -W ${worksrcpath}/pbmtools jbgtopbm.1 pbmtojbg.1 \
		${destroot}/${prefix}/share/man/man1
	xinstall -m 644 -W ${worksrcpath}/libjbig jbig.h \
		${destroot}/${prefix}/include
	xinstall -m 644 -W ${worksrcpath}/libjbig libjbig.a \
		${destroot}/${prefix}/lib
	system "ranlib ${destroot}/${prefix}/lib/libjbig.a"
	xinstall -m 644 -W ${worksrcpath} ANNOUNCE CHANGES COPYING INSTALL TODO \
		${destroot}/${prefix}/share/doc/${name}
	xinstall -m 644 -W ${worksrcpath}/libjbig jbig.doc \
		${destroot}/${prefix}/share/doc/${name}
	file copy ${worksrcpath}/examples \
		${destroot}/${prefix}/share/examples/${name}
}

variant darwin {
	patchfiles-append	patch-Makefile_darwin patch-libjbig_Makefile_darwin
	post-destroot {
		xinstall -m 644 -W ${worksrcpath}/libjbig libjbig.1.dylib \
			${destroot}/${prefix}/lib
		system "ln -s libjbig.1.dylib ${destroot}/${prefix}/lib/libjbig.dylib"
	}
}

