# $Id: Portfile 73151 2010-11-05 19:27:12Z ryandesign@macports.org $

PortSystem 1.0

name			libtommath
version			0.42.0
categories		math
platforms		darwin
maintainers		mww
license			Public-Domain

description		Comprehensive, modular and portable mathematical routines
long_description	LibTomMath provides highly optimized and portable routines \
			for a vast majority of integer based number theoretic \
			applications (including public key cryptography).

homepage		http://www.libtom.org/?page=features&whatfile=ltm
master_sites	http://www.libtom.org/files/ \
				freebsd
distname		ltm-${version}

checksums		sha1    9b192701cf62b85e9bd65fbb4d622d04cfa5ee0d \
				rmd160  9994d60d7e847a066715d8c644ce9b125932bf92

use_bzip2		yes
patchfiles		patch-makefile

worksrcdir		${name}-${version}

use_configure	no

variant universal {}
if {[variant_isset universal]} {
	set archflags ${configure.universal_cflags}
} else {
	set archflags ${configure.cc_archflags}
}

build.args		LIBPATH=${prefix}/lib \
				CC="${configure.cc} ${archflags}"

destroot {
	xinstall -m 755 -d ${destroot}${prefix}/include/${name}
	xinstall -m 644 -W ${worksrcpath} tommath.h tommath_class.h \
		tommath_superclass.h ${destroot}${prefix}/include/${name}
	xinstall -m 644 -W ${worksrcpath} libtommath.a libtommath.${version}.dylib \
		${destroot}${prefix}/lib
	ln -s libtommath.${version}.dylib ${destroot}${prefix}/lib/libtommath.0.dylib
	ln -s libtommath.${version}.dylib ${destroot}${prefix}/lib/libtommath.dylib
	
	set docdir ${destroot}${prefix}/share/doc/${name}
	xinstall -d ${docdir}
	xinstall -m 644 -W ${worksrcpath} \
		LICENSE \
		changes.txt \
		${docdir}
}

livecheck.type	regex
livecheck.url	${homepage}
livecheck.regex	ltm-(\[0-9.\]+)${extract.suffix}
