# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
# $Id$

PortSystem        1.0

name              asdf-binary-locations
version           0.3.9
categories        devel
license           MIT
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      ${homepage}

platforms         darwin
supported_archs   noarch

distname          ${name}
dist_subdir       ${name}/${version}

checksums         md5     96a670f18a20740d512534c5b42d9e16 \
                  sha1    348f34147f1137566e6713e7d56d267404ae09ca \
                  rmd160  43ed18aa3a9070f5a7f8e8f887bcd868b6e39ad9

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
    }
}