# -*- coding: utf-8; mode: tcl; tab-width: 4; truncate-lines: t; indent-tabs-mode: nil; c-basic-offset: 4 -*-
# vim: set fileencoding=utf-8 tabstop=8 shiftwidth=4 softtabstop=4 noexpandtab filetype=tcl :

PortSystem	    1.0

name		    gnat-charles
version		    20050913
#revision	    1
platforms	    darwin
categories	    devel
maintainers	    nomaintainer
description	    Charles is a container and algorithms library for Ada.
long_description								    \
    Charles is a container and algorithms library based in the			    \
    C++ STL. It is general, flexible, and efficient, and its design has been guided \
    by the philosophy that a library should stay out of the programmer's way.  The  \
    library comprises sequence containers and associative containers. Sequence      \
    containers include vectors, deques, and lists. The associative containers	    \
    include sets, multisets, maps, and multimaps.

homepage	    http://charles.tigris.org
master_sites	    http://charles.tigris.org/files/documents/1507/31292
distname	    charles-${version}

checksums           sha1 8c2e4fb5a948584b744c98c8e3b87d0a7c2e9862

use_zip		    yes
extract.mkdir       yes
use_parallel_build  yes
use_configure	    no

depends_lib	    port:gnat-gcc

build {
    system "
	unset ADA_INCLUDE_PATH
        unset ADA_OBJECTS_PATH
	pushd ${workpath}/${worksrcdir};
	    gnatmake -fPIC *.adb
	    ar rcs libcharles.a *.o
	    gcc -shared -fpic								    \
		-Wl,-L${prefix}/lib/gnat-gcc/gcc/i386-apple-darwin9.7.0/4.4.0/adalib	    \
		-Wl,-lgnat								    \
		-o libcharles-${version}.dylib						    \
		*.o
	    strip libcharles-${version}.dylib
	popd;
    "
}

destroot {
    set include_dir ${destroot}${prefix}/include/charles
    set lib_dir	    ${destroot}${prefix}/lib

    xinstall -m 775 -d ${include_dir}
    xinstall -m 775 -d ${lib_dir}

    xinstall -m 644 {*}[glob ${workpath}/${worksrcdir}/*.ad*] ${include_dir}
    xinstall -m 444 {*}[glob ${workpath}/${worksrcdir}/*.ali] ${include_dir}
    xinstall -m 644 {*}[glob ${workpath}/${worksrcdir}/lib*]  ${lib_dir}

    system "
	pushd ${lib_dir};
	    ln -s libcharles-${version}.so libcharles.so;
	popd;
    "
}

