# $Id: Portfile 62406 2010-01-06 21:56:01Z jmr@macports.org $

PortSystem		1.0

name			cryptlib
version			3.3.3
revision		1
categories		devel security crypto
maintainers		nomaintainer
description		cryptlib is a powerful security toolkit (library)

long_description \
	cryptlib is a powerful security toolkit that allows even inexperienced \
	crypto programmers to easily add encryption and authentication services \
	to their software. The high-level interface provides anyone with the \
	ability to add strong security capabilities to an application in as \
	little as half an hour, without needing to know any of the low-level \
	details that make the encryption or authentication work.

platforms		darwin sunos

homepage		http://www.cs.auckland.ac.nz/~pgut001/cryptlib/
master_sites	ftp://ftp.franken.de/pub/crypt/cryptlib/ \
                http://www.cypherpunks.to/~peter/
distname		cl[join [split $version .] ""]
dist_subdir     ${name}/${version}_1
use_zip			yes
checksums		md5 98effb4644e1336a57bd3be50bae07d4 \
				sha1 f745ec44b4578b76eae49702035b635a004dfa14

worksrcdir		cryptlib
pre-extract {
	extract.pre_args-append		"-a"
	extract.post_args			"-d ${worksrcpath}"
}

use_configure	no

build.target	default shared
build.args		LIBDIR="${prefix}/lib" \
                CFLAGS="${configure.cflags} ${configure.cc_archflags} -c -D__UNIX__ -DNDEBUG -I." \
                CC="${configure.cc}"

destroot {
	set drprefix	${destroot}${prefix}
	file mkdir "${drprefix}/lib" "${drprefix}/include" \
		"${drprefix}/share/doc/${name}"
	xinstall -m 644 ${worksrcpath}/libcl.a ${worksrcpath}/${cryptlibDylib} \
		${drprefix}/lib
	system "ln -s ${cryptlibDylib} ${drprefix}/lib/${cryptlibDylibLink}"
	xinstall -m 644 ${worksrcpath}/cryptlib.h ${drprefix}/include
	xinstall -m 644 ${worksrcpath}/README ${drprefix}/share/doc/${name}
	system "/bin/echo ${homepage} > ${drprefix}/share/doc/${name}/website"
}

platform darwin {
    patchfiles-append patch-crypt_osconfig.h
	global cryptlibDylib cryptlibDylibLink
	set cryptlibDylib		libcl.3.3.dylib
	set cryptlibDylibLink	libcl.dylib
}

platform darwin 10 {
    patchfiles-append lresolv.diff
}

platform sunos {
	global cryptlibDylib cryptlibDylibLink
	patchfiles-append	patch-makefile.sunos
	set cryptlibDylib		libcl.so.3.3
	set cryptlibDylibLink	libcl.so
}
