# $Id: Portfile,v 1.3 2006/01/07 22:07:49 mww Exp $

PortSystem 1.0

name			xrmap
version			2.33
categories		x11
platforms		darwin
maintainers		mww@opendarwin.org
description		X11 client for the CIA World data bank
long_description	The Xrmap program provides a user-friendly X client for \
				generating images of the Earth and manipulating the CIA World \
				data bank II global vector information.

homepage		http://frmas.free.fr/li_1.htm
master_sites	ftp://ftp.ac-grenoble.fr/ge/geosciences/xrmap/:src \
				ftp://ftp.ac-grenoble.fr/ge/geosciences/xrmap/data:data \
				freebsd::src freebsd::data
distfiles		${distname}.tar.bz2:src \
				CIA_WDB2.jpd.bz2:data \
				anthems-1.1.tar.bz2:data \
				flags-1.1.tar.bz2:data \
				hymns-1.2.tar.bz2:data \
				factbook_text_2002.tar.bz2:data
checksums		${distname}.tar.bz2 md5 c743f0c90699227d5bdba4984e3edf77 \
				CIA_WDB2.jpd.bz2 md5 8b5255a685bbb5eef2f86df182731a32 \
				anthems-1.1.tar.bz2 md5 4d63e6a61e9197f3c382e518de6503db \
				flags-1.1.tar.bz2 md5 e15fbfb1f1c8a313573ac499fb0ea090 \
				hymns-1.2.tar.bz2 md5 b5c1c26e1d5c842c53c9a5460cb02864 \
				factbook_text_2002.tar.bz2 md5 d28fc69a9fd48d9d39a1fda8099cfb1b
patchfiles		patch-earthview-Makefile

depends_lib		lib:libX11.6:XFree86

use_bzip2		yes
extract.only	${distname}.tar.bz2 \
				anthems-1.1.tar.bz2 \
				flags-1.1.tar.bz2 \
				hymns-1.2.tar.bz2 \
				factbook_text_2002.tar.bz2
post-extract	{
	file copy ${distpath}/CIA_WDB2.jpd.bz2 ${workpath}
	system "cd ${workpath} && bunzip2 CIA_WDB2.jpd.bz2"
}

configure	{
	system "cd ${worksrcpath} && xmkmf"
}

build.args		DESTDIR=${prefix} \
				BINDIR=/bin \
				MANDIR=/share/man/man1 \
				SHAREDIR=/share/${name} \
				LIBPNGLIBDIR=${prefix}/lib LIBPNGINCDIR=${prefix}/include \
				ZLIBDIR=-L${prefix}/lib INCROOT=${prefix}/include

pre-destroot {
	xinstall -m 755 -d ${destroot}${prefix}/share/rmap/doc
}
destroot.destdir	DESTDIR=${destroot}${prefix} \
				BINDIR=/bin \
				MANDIR=/share/man/man1 \
				SHAREDIR=/share/${name} \
				DOCHTMLDIR=/share/doc/${name} \
				INSTALLFLAGS=-c

post-destroot	{
	xinstall -m 644 ${workpath}/CIA_WDB2.jpd ${destroot}${prefix}/share/${name}
	file copy ${workpath}/anthems ${destroot}${prefix}/share/${name}/
	file copy ${workpath}/factbook ${destroot}${prefix}/share/${name}/
	file delete -force ${destroot}${prefix}/share/${name}/flags
	file copy ${workpath}/flags ${destroot}${prefix}/share/${name}/
	file copy ${workpath}/hymns ${destroot}${prefix}/share/${name}
}

platform darwin 8 {
	build.args-append CC=/usr/bin/gcc-3.3 CXX=/usr/bin/g++-3.3 \
		CPP=/usr/bin/cpp-3.3 RAWCPP="/usr/bin/cpp-3.3 -undef" \
		PREPROCESSCMD="/usr/bin/gcc-3.3 -E"
}

