# $Id: Portfile 108377 2013-07-21 22:06:08Z mfeiri@macports.org $

PortSystem              1.0
name                    libc-headers
revision                1
version                 825.26
categories              devel
platforms               macosx
maintainers             mfeiri openmaintainer
license                 APSL-1.1 APSL-2 BSD MIT

description             Darwin Libc Headers
long_description        Headers files for the C standard library

homepage                http://opensource.apple.com/source/Libc/
master_sites            http://opensource.apple.com/tarballs/Libc/

distname                Libc-${version}

checksums               rmd160  049a2571ea2ee6b0d69f805db7aa0bd8376a950f \
                        sha256  cad389f3bd3c661a2f12e14073a2ec01675e63094673c6217730893e7e60e273

conflicts               libpftputil
depends_build           path:bin/unifdef:developer_cmds

use_configure           no

build                   {}

destroot.target         installhdrs
destroot.destdir        DESTDIR=${destroot}${prefix}


post-destroot {
    # instead of extensive rewrites of the darwin <12 installation scripts
    if [file exists ${destroot}${prefix}/usr/include] {
        file rename -force ${destroot}${prefix}/usr/include ${destroot}${prefix}/
    }
    file delete -force ${destroot}${prefix}/usr
    file delete -force ${destroot}${prefix}/System
}

platform darwin 9 {
    version             498.1.7
    distname            Libc-${version}
    checksums           rmd160  4f2c531805165b82e3f3587fca3cd88dd56db592 \
                        sha256  77122a555050d6b4ba866699507195d05d270700a9b411ab5ee8740857078609

    build.type          bsd
}

platform darwin 10 {
    version             594.9.5
    distname            Libc-${version}
    checksums           rmd160  160ea30d68d79d5aa10608a67f0246cb65bb33f2 \
                        sha256  a7a7b65fc4d185db076d30ac8e453f16be555d36c9b8a3b6162d317713686840

    depends_build-append    port:coreosmakefiles
    build.type              bsd
}

platform darwin 11 {
    version             763.13
    distname            Libc-${version}
    checksums           rmd160  d2484c13b9ff5b401e732946e1929dd5ca8e9ad4 \
                        sha256  a1d88010d04f7bc3af3b52d61aacdf0c6826aa0cfa2814e65bdef365cae28bc9

    depends_build-append    port:coreosmakefiles
    build.type              bsd
}

platform darwin 12 {

    pre-destroot {
        reinplace "s|/System/Library|/Library|g" ${worksrcpath}/xcodescripts/headers.sh
        reinplace "s|/usr||g" ${worksrcpath}/xcodescripts/manpages.sh
        file attributes ${worksrcpath}/xcodescripts/headers.sh -permissions +x
        file attributes ${worksrcpath}/xcodescripts/manpages.sh -permissions +x
    }

    destroot.env        ARCHS=${build_arch} PLATFORM_NAME=${platforms} \
                        DSTROOT=${destroot}${prefix} DERIVED_FILES_DIR=${workpath} \
                        SRCROOT=${worksrcpath} PUBLIC_HEADERS_FOLDER_PATH=/include \
                        PRIVATE_HEADERS_FOLDER_PATH=/include
    destroot.cmd        "./xcodescripts/headers.sh && ./xcodescripts/manpages.sh"
}

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