# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4

PortSystem          1.0
PortGroup           stub 1.0
PortGroup           select 1.0

name                gcc_select
version             0.1
revision            10
categories          sysutils
supported_archs     noarch
description         common files for selecting default gcc version
long_description    gcc_select installs files that allow 'port select' to \
                    switch the default version of gcc. \
                    It symlinks the standard compiler executables \
                    in the MacPorts prefix to the selected version.

post-destroot {
    select::install gcc ${filespath}/base
    select::install gcc ${filespath}/none

    if {[file exists /usr/bin/gcc-3.3]} {
        select::install gcc ${filespath}/gcc33
    }

    if {[file exists /usr/bin/gcc-4.0]} {
        select::install gcc ${filespath}/gcc40
    }

    if {[file exists /usr/bin/gcc-4.2]} {
        select::install gcc ${filespath}/gcc42
    }

    if {[file exists /usr/bin/llvm-gcc-4.2]} {
        select::install gcc ${filespath}/llvm-gcc42
    } elseif {[file exists ${developer_dir}/usr/bin/llvm-gcc-4.2]} {
        # llvm-gcc-4.2 is not available in /usr/bin on Leopard
        copy ${filespath}/llvm-gcc42 ${workpath}/llvm-gcc42
        reinplace "s|/usr/bin|${developer_dir}/usr/bin|" ${workpath}/llvm-gcc42
        select::install gcc ${workpath}/llvm-gcc42
    }
}

platform darwin 8 {
    # Prevent MacPorts base from adding a circular dependency on apple-gcc42
    configure.compiler gcc-4.0
}

livecheck.type      none
