# -*- 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
description Tun and tap virtual devices.
long_description Unix-style tun and tap virtual network interfaces for Mac \
OS X. You typically use these for VPN and OS virtualization.
homepage http://tuntaposx.sourceforge.net/
master_sites sourceforge:project/tuntaposx/tuntap/${version}
distname tuntap_${version}_src
checksums rmd160 bfdd394e10a982728c4867b2536b337ab78831e1 \
sha256 f01fe7a3dd0f2f64c13606ff0230696d3995f2eeae19f0cdeb778650db9f37ba
destroot.violate_mtree yes
destroot.args BASE=${destroot}${prefix}
patchfiles patch-src-tap-Makefile.diff \
patch-src-tun-Makefile.diff
set f ${worksrcpath}/src/${d}/Makefile
reinplace "s|@CC@|${configure.cc}|g" ${f}
reinplace "s|@CXX@|${configure.cxx}|g" ${f}
reinplace "s|@ARCHFLAGS@|[get_canonical_archflags cc]|" ${f}
# This patch and reinplace should be integrated with the above patches
# once it can be confirmed that all the different systems correctly use the SDK
# path, and that the <= 9 patches also still apply cleanly as well
patchfiles-append patch-mojave.diff
set f ${worksrcpath}/src/${d}/Makefile
reinplace "s|@SDKROOT@|${configure.sdkroot}|" ${f}
if { ${os.platform} eq "darwin" && ${os.major} <= 9} {
ui_error "${name} ${version} does not presently install on MacOSX 10.5 or earlier."
return -code error "Unsupported platform"
# Kernel can be 32-bit or 64-bit, so build both
default_variants +universal
configure.universal_archs i386 x86_64
set kext_dir ${prefix}/Library/Extensions
startupitem.start "kextload ${kext_dir}/tap.kext ; kextload ${kext_dir}/tun.kext"
startupitem.stop "kextunload ${kext_dir}/tap.kext ; kextunload ${kext_dir}/tun.kext"
set docs ${destroot}${prefix}/share/doc/${name}
xinstall -m 755 -d ${docs}
xinstall -m 644 -W ${worksrcpath} README Changelog ${docs}
set tap_loaded [expr [string length [exec kextstat -lb foo.tap]] > 0]
set tun_loaded [expr [string length [exec kextstat -lb foo.tun]] > 0]
if {${tap_loaded} || ${tun_loaded}} {
ui_msg "**********************************************************************"
ui_msg "* Warning: tuntaposx virtual device kernel extension loaded already. *"
ui_msg "* Maybe you have installed the tuntaposx package already without *"
ui_msg "* using MacPorts, e.g. by installing Tunnelblick openvpn GUI. See *"
ui_msg "* kextstat(8), kextload(8) and kextunload(8) for manual handling. *"
ui_msg "**********************************************************************"