# -*- 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           github 1.0

name                legacy-support
categories          devel
platforms           darwin

maintainers         {jonesc @cjones051073} {kencu @kencu} openmaintainer
license             MIT

description         Installs wrapper headers to add missing functionality to legacy OSX versions.
long_description    ${description}

subport ${name} {
    conflicts           ${name}-devel
    github.setup        macports macports-legacy-support 0.9 v
    checksums           rmd160  4f9dc8cee3bbbabf5d025270edff0039af2ca525 \
                        sha256  37af545d422ff41ba7b79f045f794af36985f7b29e43af953199242cf442b64a \
                        size    27205
}

subport ${name}-devel {
    conflicts           ${name}
    github.setup        macports macports-legacy-support 5607e8902a9569b27ed4917bc0aeac55c10796b5
    version             20190308
    revision            1
    livecheck.type      none
    checksums           rmd160  d74ee47542e46b534a9dcbe29386900665e7bcea \
                        sha256  cb338e120ade088c1296c827d85816c34bfb50e95eb51835979b52ff787d51f5 \
                        size    33098
}

use_configure       no

test.run            yes
test.target         test

variant universal {}

build.env           CXX="${configure.cxx}" \
                    CXXFLAGS="${configure.cxxflags} [get_canonical_archflags cxx]" \
                    CC="${configure.cc}" \
                    CFLAGS="${configure.cflags} [get_canonical_archflags cc]" \
                    LDFLAGS="${configure.ldflags}  [get_canonical_archflags ld]" \
                    PREFIX=${prefix}

destroot.env        PREFIX=${prefix}

post-destroot {
  if { ${subport} eq "${name}-devel" } {
    platform darwin 8 {
      # install Tiger-specific fixes -- not quite ready
        #copy ${worksrcpath}/tiger_only/include/libproc.h \
        #     ${destroot}${prefix}/include/LegacySupport/libproc.h

        #copy ${worksrcpath}/tiger_only/include/sys/proc_info.h \
        #     ${destroot}${prefix}/include/LegacySupport/sys/proc_info.h

        copy ${worksrcpath}/tiger_only/bin/which \
             ${destroot}${prefix}/bin/which
    }
  }
}