# -*- coding: utf-8; mode: tcl; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=2:ts=2:sts=2
# $Id: Portfile 60454 2009-11-12 23:35:31Z ryandesign@macports.org $

PortSystem							1.0

name										gaul-devel
version									0.1850
license									GPL
categories							math
maintainers							vince
description							Genetic algorithms library
long_description				\
												A flexible programming library for evolutionary \
												computation. Steady-state, generational and island \
												model genetic algorithms are supported, using \
												Darwinian, Lamarckian or Baldwinian evolution. \
												Includes support for multiprocessor and distributed \
												systems.

platforms								darwin
homepage								http://gaul.sourceforge.net/
master_sites						sourceforge:gaul
distname								${name}-${version}-${revision}

checksums								md5			3a832c882b0df0f5c46f733d360fd7bb \
												sha1		2ec57a5bce2ff7fc9f9c3453b2ea2d3aec248350 \
												rmd160	efd4f1dad25bbe487e1e8bd56cb499a07c92a1e7

# Finds out the number of CPU on the machine
set	nb_th								[expr [exec sysctl -n hw.logicalcpu] * 2]

# Configuration
configure.args-append		--enable-g=yes
configure.args-append		--enable-ccoptim=yes
configure.args-append		--enable-padding=yes
configure.args-append		--enable-pthread
configure.args-append		--enable-num-threads=${nb_th}
configure.args-append		--enable-num-procs=${nb_th}

variant mpi {
	configure.args-append	--enable-mpi=yes
}

variant slang {
	depends.lib-append		port:slang
	configure.args-append	--enable-slang=yes
}

# Patches
post-configure {
	system "chmod +x ${filespath}/patch-config_h"
	system "${filespath}/patch-config_h ${worksrcpath}/config.h"
	reinplace -E \
		"s|^CC=\"(.*)\"|CC=\"\\1 ${configure.universal_cflags}\"|" \
		${worksrcpath}/libtool
}
