# $Id: Portfile 64197 2010-02-25 02:39:24Z mcalhoun@macports.org $

PortSystem 1.0
PortGroup  muniversal 1.0
name		gts
version		0.7.6
categories	math
platforms	darwin
maintainers	nomaintainer
description	The GNU Triangulated Surface library
long_description	\
		GTS stands for the GNU Triangulated Surface Library.	\
		It is an Open Source Free Software Library intended	\
		to provide a set of useful functions to deal with	\
		3D surfaces meshed with interconnected triangles.

homepage	http://gts.sourceforge.net/
master_sites	sourceforge

checksums	md5 9f710aefd2ed9b3cc1b1216171fc5a8a

depends_lib	path:lib/pkgconfig/glib-2.0.pc:glib2

if { [variant_isset universal] } {
    # Find architectures which will not run on build platform.
    if { ${os.arch}=="i386" } {
        if { ${os.major} >= 10 } {
            set cross_archs "ppc ppc64"
        } else {
            set cross_archs "ppc64"
        }
    } else {
        set cross_archs "i386 x86_64"
    }
    
    set run_arch [lindex ${universal_archs} 0]
    if { [lsearch ${cross_archs} ${run_arch}] >= 0 } {
        ui_msg "When building a universal binary of ${name}, make sure none of {${cross_archs}} is first in universal_archs in ${prefix}/etc/macports/macports.conf"
        error "incompatible universal_archs value"
    }

    post-configure {
        foreach arch ${cross_archs} {
            if { [file exists ${worksrcpath}-${arch}/src/Makefile] } {
                reinplace "s|\\./predicates_init|${worksrcpath}-${run_arch}/src/predicates_init|" \
                    ${worksrcpath}-${arch}/src/Makefile
            }
        }
    }
}
