# $Id: Portfile 57375 2009-09-10 08:16:41Z ryandesign@macports.org $

PortSystem 1.0

name                ntfs-3g
version             1.5130
categories          fuse
platforms           darwin
maintainers         eridius openmaintainer
description         Safe read/write NTFS driver for FUSE
long_description    The NTFS-3G driver is an open source, freely available \
                    NTFS driver for FUSE with read and write support. It \
                    provides safe and fast handling of the Windows XP, Windows \
                    Server 2003, Windows 2000 and Windows Vista file systems. \
                    Most POSIX file system operations are supported, with the \
                    exception of full file ownership and access right support.

homepage            http://www.ntfs-3g.org/
extract.suffix      .tgz

master_sites        $homepage
checksums           md5 ad3c40bba398d162f97c2936293eae1f \
                    sha1 02b7a874b02827665c97123c6335e1d856054c42

livecheck.type      regex
livecheck.regex     {<a href="ntfs-3g-(.+?)\.tgz">Stable}

depends_lib         port:pkgconfig port:macfuse

configure.args      --exec-prefix=${prefix}

platform darwin {
    configure.ldflags-append    -framework CoreFoundation
}

#destroot.violate_mtree yes

pre-destroot {
    file mkdir ${destroot}/sbin
}

post-destroot {
    # ntfs-3g symlinks /sbin/mount.ntfs-3g to ${prefix}/bin/ntfs-3g
    # but on darwin mount wants mount_* instead of mount.*

    # /sbin/mount.ntfs-3g is no longer installed with recent versions of ntfs-3g
    # but let's add a check here to verify this, so an update doesn't miss it if it's turned back on
    if {[file exists ${destroot}/sbin/mount.ntfs-3g]} {
        error "${destroot}/sbin/mount.ntfs-3g is present"
    }
    #file rename -- ${destroot}/sbin/mount.ntfs-3g ${destroot}/sbin/mount_ntfs-3g
    file rename -- ${destroot}${prefix}/share/man/man8/mount.ntfs-3g.8 \
                   ${destroot}${prefix}/share/man/man8/mount_ntfs-3g.8
}
