# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
# $Id: Portfile 50984 2009-05-14 21:08:43Z and.damore@macports.org $

PortSystem        1.0

name              asdf-binary-locations
version           latest
categories        devel
maintainers       pobox.com:rlonstein
description       keep asdf-compiled lisp files in their places
long_description  Keep asdf-compiled lisp files in directories unique \
                  to the Lisp implementation, Lisp implementation version \
                  operating system and hardware architecture.

homepage          http://common-lisp.net/project/cl-containers/asdf-binary-locations/
master_sites      http://common-lisp.net/project/cl-containers/asdf-binary-locations/

platforms         darwin
universal_variant no

distfiles         ${name}${extract.suffix}
distname          ${name}

checksums           md5     c221dcb4a1fcb0c1f744cb5fc17d8903 \
                    sha1    e6420f5e95708cf7e38884e218f62336957f3091 \
                    rmd160  39e678334501d231f526b90ede21c3b28acd9624

use_configure     no
build     { }

variant ignore_lisp_version description {Don't include Lisp version when composing path} {
    pre-configure {
        ui_msg "\n\nWarning- Ignoring Lisp version can result in load failures"
        ui_msg "if fasl implementation changes between Lisp releases.\n"
        ui_msg "If this occurs it will be necessary to rebuild affected modules.\n"
    }
    patchfiles-append patch-dev-main.lisp.diff
}

set destroot-lisp "${destroot}${prefix}/share/common-lisp"

destroot {
    xinstall -m 0755 -d "${destroot-lisp}/src"
    xinstall -m 0755 -d "${destroot-lisp}/systems/${name}"

    file copy ${worksrcpath} ${destroot-lisp}/src/${name}
    system "find ${destroot-lisp}/src/${name} -type d -exec chmod 755 {} \\;"
    system "find ${destroot-lisp}/src/${name} -type f -exec chmod 644 {} \\;"

    foreach f [glob -dir ${destroot-lisp}/src/$name -tails *.asd] {
        ln -sf ../src/${name}/$f ${destroot-lisp}/systems/$f
    }
}
