# $Id: Portfile,v 1.16 2006/03/21 21:26:55 mww Exp $

PortSystem 1.0

name			libsockets
version			2.0.2
categories		devel net
platforms		darwin
maintainers		mww@opendarwin.org
description		C++ Sockets is a C++ wrapper for BSD-style sockets.
long_description	${description}

homepage		http://www.alhem.net/Sockets/
master_sites	${homepage}:tar \
				http://www.die.net/doc/linux/include/uuid/:header
distfiles		uuid.h:header \
				Sockets-${version}.tar.gz:tar
checksums		uuid.h sha1 c466612c98aea27d92423589018e1a69d480c793 \
				Sockets-${version}.tar.gz sha1 c4f1001ba0c2ebfb7f5790c1ad3b0055e61c01f4
patchfiles		patch-Makefile

depends_lib		port:openssl

worksrcdir		Sockets-${version}

extract.only	Sockets-${version}.tar.gz
post-extract {
	file copy ${distpath}/uuid.h ${worksrcpath}
}

use_configure	no

build.args		PREFIX=${prefix}
build.env		CFLAGS=-I${prefix}/include LDFLAGS=-L${prefix}/lib
build.target	all libSocketsEx.a

post-build {
	system "cd ${worksrcpath} && \
		CC=\"g++\" LDFLAGS=\"-L${prefix}/lib -lssl -lcrypto\" \
		/bin/sh ${filespath}/create-dylib.sh libSockets.a 1.0.0 ${prefix}/lib"
	system "cd ${worksrcpath} && \
		CC=\"g++\" LDFLAGS=\"-L${worksrcpath} -lSockets\" \
		/bin/sh ${filespath}/create-dylib.sh libSocketsEx.a 1.0.0 ${prefix}/lib"
}

destroot.destdir	PREFIX=${destroot}${prefix}
post-destroot {
	xinstall -m 755 -W ${worksrcpath} libSockets.1.0.0.dylib libSockets.dylib \
		libSocketsEx.1.0.0.dylib libSocketsEx.dylib ${destroot}${prefix}/lib
}

