source: trunk/dports/fuse/fuse4x-kext/Portfile @ 90295

Last change on this file since 90295 was 90295, checked in by dports@…, 8 years ago

fuse4x-kext: disable MacFUSE compatibility mode; it doesn't help us.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 5.1 KB
Line 
1# -*- 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
2# $Id: Portfile 90295 2012-03-01 00:55:16Z dports@macports.org $
3
4PortSystem          1.0
5PortGroup           xcode 1.0
6
7name                fuse4x-kext
8version             0.9.0
9revision            1
10set tag             [string map {. _ } $version]
11categories          fuse devel
12platforms           macosx
13maintainers         dports
14description         A kernel extension for Fuse4X
15
16long_description    Fuse4X implements a mechanism that makes it          \
17                    possible to implement a fully functional file        \
18                    system in a user-space program on Mac OS X. It       \
19                    aims to be API-compliant with the FUSE               \
20                    (File-system in USErspace) mechanism that            \
21                    originated on Linux.  Therefore, many existing       \
22                    FUSE file systems become readily usable on Mac OS    \
23                    X. This port provides the dynamically loadable       \
24                    kernel extension at the core of Fuse4X.
25
26homepage            http://fuse4x.org/
27license             BSD
28master_sites        https://github.com/fuse4x/kext/tarball/fuse4x_${tag}
29
30checksums           sha256  8001a515945ab3ea72df788e89ef66ce608e06ba1444163bfbba928056d0fad5 \
31                    rmd160  89578f947aa916e6435e011ea7964673e213ca3f
32
33extract.mkdir       yes
34extract.post_args   "| tar --strip-components=1 -xf -"
35
36# This port installs a kernel module, so it must be built for the same
37# architecture as the kernel. We don't have a way to get that;
38# build_arch is the userland architecture, which may be different
39# (e.g. 64-bit userland with 32-bit kernel). So build a universal
40# binary by default on Intel platforms. On PPC, there's only one
41# kernel, so don't try to build it ppc64 or universal.
42supported_archs     i386 x86_64 ppc
43if {$build_arch == "i386" || $build_arch == "x86_64"} {
44    default_variants    +universal
45}
46
47# kext destination: kext will be installed into ${kextdir}/fuse4x.kext.
48#
49# The kext is autoloaded by the library using load_fuse4x, so it
50# doesn't have to go into /System/Library/Extensions. It doesn't
51# matter where we put it, as long as it's kept in sync with the library.
52#
53# If updating the patchfile or ${kextdir}, must also update the
54# corresponding patch in the fuse4x port!
55patchfiles          patch-common_fuse_param.h.diff
56set kextdir        "${prefix}/Library/Extensions"
57post-patch {
58    reinplace "s|@@KEXTPATH@@|${kextdir}/fuse4x.kext|" ${worksrcpath}/common/fuse_param.h
59}
60
61xcode.configuration Release
62
63# Disable MacFUSE compatibility mode; not needed for the filesystems we build.
64xcode.build.settings GCC_PREPROCESSOR_DEFINITIONS='FUSE4X_DISABLE_MACFUSE_MODE'
65
66destroot.asroot     yes
67
68destroot {
69    xinstall -d ${destroot}${kextdir}
70    file copy ${worksrcpath}/build/${xcode.configuration}/fuse4x.kext ${destroot}${kextdir}
71    file attributes ${destroot}${kextdir}/fuse4x.kext -owner root -group wheel -permissions rwxr-xr-x
72
73    xinstall -d ${destroot}${kextdir}/fuse4x.kext/Support
74    xinstall -o root -m 4755 ${worksrcpath}/build/${xcode.configuration}/load_fuse4x ${destroot}${kextdir}/fuse4x.kext/Support
75}
76
77
78variant trace description {Enable debug logging: logs all filesystem operations} {
79    # Note that this overrides the normal GCC_PREPROCESSOR_DEFINITIONS
80    xcode.build.settings GCC_PREPROCESSOR_DEFINITIONS='FUSE4X_DISABLE_MACFUSE_MODE FUSE4X_DEBUG FUSE4X_TRACE FUSE4X_TRACE_LK FUSE4X_TRACE_MSLEEP FUSE4X_TRACE_OP FUSE4X_TRACE_VNCACHE FUSE4X_SERIALIZE_LOGGING'
81}
82
83# We don't need to load the kext, because the fuse4x library will
84# autoload it when needed. However, if there's an existing version
85# loaded, we'd better unload it because it might be a different
86# version.
87#
88# Thus, check whether the kext is already loaded, and if so attempt to
89# unload it. If that fails, the user probably needs to unmount some
90# running filesystems; print a list.
91#
92# We do this both after deactivating an existing version (because the
93# user might be removing the port) and after activating a new version
94# (because the user might be upgrading from an installation that
95# didn't unload the kext).
96proc try_unload_kext {} {
97    set kextid "org.fuse4x.kext.fuse4x"
98    if {[string length [exec /usr/sbin/kextstat -lb $kextid]] > 0} {
99        ui_msg "The Fuse4X kernel extension is already loaded. Attempting to unload it."
100        if {![catch {exec /sbin/kextunload -b $kextid}]} {
101            ui_msg "Successfully unloaded the previous installation of Fuse4X"
102        } else {
103            set mounted [exec /sbin/mount -t fuse4x]
104            ui_warn "Unable to unload the existing Fuse4X kernel extension."
105            ui_warn "Please unmount the following filesystems, and then run "
106            ui_warn "`sudo kextunload -b $kextid`:"
107            foreach line [split $mounted "\n"] {
108                regexp {on (/.*) \(fuse4x} $line -> mountpoint
109                ui_warn "  * $mountpoint"
110            }
111        }
112    }
113}
114
115post-activate {
116    try_unload_kext
117}
118
119post-deactivate {
120    try_unload_kext
121}
122
123livecheck.type      regex
124livecheck.url       ${homepage}
125livecheck.regex     {Fuse4X-([0-9.]+).dmg}
Note: See TracBrowser for help on using the repository browser.