Portfile

# $Id: Portfile 22308 2007-02-26 02:56:04Z eridius@macports.org $

PortSystem 1.0

name libfuse
version 2.6.3
revision 2
categories fuse devel
platforms darwin
maintainers eridius@macports.org
description Filesystem in Userspace
long_description See the fusefs port for more information

homepage http://fuse.sourceforge.net/

distname fuse-${version}
master_sites sourceforge:fuse
checksums ${distfiles} md5 3f4f5d07d12dedc0a3fd23472171fe94 \
sha1 d6ecda7341008ac157f55cf901309dda10f58faf

depends_lib bin:pkg-config:pkgconfig

platform darwin {
depends_run port:fusefs
patch_sites http://macfuse.googlecode.com/svn/tags/macfuse-0.2.2/libfuse/
patchfiles fuse-2.6.3-macosx.patch
checksums-append fuse-2.6.3-macosx.patch md5 845d0f7bd9411d50eb41295425570f00 \
sha1 b3e366a238930c3bfb6f1b3a4119c289c54e9146

configure.post_args-append CFLAGS="-D__FreeBSD__=10 -D_POSIX_C_SOURCE=200112L"

# override patch.pre_args since it defaults to -p0
patch.pre_args -p1
}

pre-fetch {
# LibFUSE currently only works on OS X
# so error out if attempting to install elsewhere
if {![variant_isset darwin]} {
return -code error "LibFUSE is only supported for Mac OS X"
}

if {[variant_isset darwin]} {
patch_checksum
}
}

proc patch_checksum {} {
global checksums_array UI_PREFIX
# assume we only have one patchfile, because at the moment that's true
set patchfile [option patchfiles]
# do our own checksumming of an existing $patchfile because URL changes between revisions
# if the checksum fails, delete the patchfile
# a lot of this code is copied from checksum_main
# Eventually this technique should be replaced with a patchfile dist subdir
if {[file exists [option distpath]/$patchfile]} {
ui_info "$UI_PREFIX $patchfile exists, checksumming to detect URL change"
if {[parse_checksums [option checksums]] == "yes"} {
ui_info "$UI_PREFIX [format [msgcat::mc "Checksumming %s"] $patchfile]"
set fullpath [file join [option distpath] $patchfile]
if {[info exists checksums_array($patchfile)]} {
set checksums $checksums_array($patchfile)

foreach {type sum} $checksums {
set calculated_sum [calc_$type $fullpath]
if {![string equal $sum $calculated_sum]} {
ui_debug "Checksum mismatch for $patchfile"
delete $fullpath
break
}
}
}
} else {
return -code error "Unable to parse checksum string"
}
}
}