# $Id: Portfile 104991 2013-04-06 23:05:55Z mfeiri@macports.org $

PortSystem              1.0
name                    csu
version                 79
revision                3
categories              devel
platforms               darwin
maintainers             mfeiri
license                 {APSL-1.1 APSL-2}
description             Common startup and C runtime setup code
long_description        Common startup and C runtime setup code
homepage                http://opensource.apple.com/source/Csu/
master_sites            http://opensource.apple.com/tarballs/Csu/

distname                Csu-${version}
checksums               rmd160  2ab6404116ff40c0e5a3c1cf6f4afc592db33fe2 \
                        sha256  d052e1daa1f5de7fc02e7e7cb8b79ee2eeaad0f321c0a70bea4fc7217e232ec2

use_configure           no
default_variants        +universal
build.env-append        CC='${configure.cc} -Wl,-new_linker'


variant universal {
    if {${os.major} == 9} {
        configure.universal_archs ppc ppc64 i386 x86_64
    }
    build.env-append    RC_ARCHS='${configure.universal_archs}'
}

post-extract {
    reinplace "s|USRLIBDIR = /usr/lib|USRLIBDIR = ${destroot}${prefix}/lib|g" ${worksrcpath}/Makefile
    reinplace "s|LOCLIBDIR = /usr/local/lib|LOCLIBDIR = ${destroot}${prefix}/lib|g" ${worksrcpath}/Makefile
}

platform darwin 9 {
    version             75
    distname            Csu-${version}
    checksums           rmd160  5ccb1772c638f495f8ab28250ed8203d82b00c13 \
                        sha256  a038b1f51884bbca68ed9b6d6bfa4ff349658a658bacfb411545eb88dba104bc
}

livecheck.type          regex
livecheck.regex         "Csu-(\[\\d.\]+)"
