# $Id: Portfile 92351 2012-04-25 23:30:53Z mfeiri@macports.org $

PortSystem              1.0
name                    csu
version                 79
revision                1
categories              devel
platforms               darwin
maintainers             mfeiri
license                 {APSL-1.1 APSL-2.0}
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 {
    build.env-append    RC_ARCHS='${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
}

if {${os.major} < 9} {
    pre-fetch {
        ui_error "${name} requires Mac OS X 10.5 or later."
        return -code error "incompatible Mac OS X version"
    }
}

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

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