# -*- Mode: Tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:et:sw=4:ts=4:sts=4
# $Id: Portfile 57375 2009-09-10 08:16:41Z ryandesign@macports.org $

PortSystem        1.0

name              kernel-tools
version           8J2135
categories        sysutils
maintainers       sfiera
description       Tools required to build xnu for Intel
long_description \
  Installs a number of tools needed to build the xnu kernel on Intel, \
  including (but not limited to) relpath and seg_hack

homepage          http://kernel.macosforge.org/
master_sites      http://www.macosforge.org/files
distfiles         kernel-tools-${version}.root.tar.gz
checksums         md5 e47e75b43211a9094875d60502cc4e35
platforms         darwin

default_variants  universal

use_configure     no
build {}

pre-extract {
  xinstall -d ${worksrcpath}
}
extract.dir ${worksrcpath}

destroot {
  foreach top {include lib man} {
    fs-traverse file ${worksrcpath}/usr/local/${top} {
      set dest [string range $file [string length $worksrcpath/usr/local] end]
      if {$top == "man"} {
          set dest share/$dest
      }
      switch -exact [file type ${file}] {
        file      { xinstall -m 644 ${file} ${destroot}${prefix}/${dest} }
        directory { xinstall -d -m 755 ${destroot}${prefix}/${dest} }
        link      { system "ln -sf [file readlink ${file}] ${destroot}${prefix}/${dest}" }
      }
    }
  }
  foreach top {bin libexec} {
    fs-traverse file ${worksrcpath}/usr/local/${top} {
      set dest [string range $file [string length $worksrcpath/usr/local] end]
      switch -exact [file type ${file}] {
        file      { xinstall -m 755 ${file} ${destroot}${prefix}/${dest} }
        directory { xinstall -d -m 755 ${destroot}${prefix}/${dest} }
        link      { system "ln -sf [file readlink ${file}] ${destroot}${prefix}/${dest}" }
      }
    }
  }
}

livecheck.type  none
