Ticket #46526: Portfile

File Portfile, 7.4 KB (added by fhgwright (Fred Wright), 9 years ago)

Portfile for osxfuse 2.7.4_0

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 129588 2014-12-16 08:02:58Z dports@macports.org $
3
4PortSystem          1.0
5
6name                osxfuse
7version             2.7.4
8set branch          [join [lrange [split ${version} .] 0 1] .]
9categories          fuse devel
10platforms           macosx
11license             BSD APSL
12maintainers         dports openmaintainer
13
14description         A FUSE-Compliant File System Implementation Mechanism \
15                    for Mac OS X
16long_description    FUSE for OS X implements a mechanism that makes it possible to implement \
17                    a fully functional file system in a user-space program on Mac OS X. It \
18                    aims to be API-compliant with the FUSE (File-system in USErspace) \
19                    mechanism that originated on Linux.  Therefore, many existing FUSE file \
20                    systems become readily usable on Mac OS X. This port provides the \
21                    user-space library and header files for building filesystems.
22
23homepage            http://osxfuse.github.io/
24
25livecheck.type      regex
26livecheck.url       ${homepage}
27livecheck.regex     "[quotemeta [string toupper ${name}]] (\\d+(?:\\.\\d+)*)"
28
29# Use the published signed kext for OS 10.9 (Darwin 13) and later.
30# Don't even fetch and extract the dmg unnecessarily, since the commands don't
31# work on some earlier OS versions.
32if {${os.major} >= 13} {
33    set use_signed_kext    yes
34} else {
35    set use_signed_kext    no
36}
37
38# We will build user-space components for the specified arch, and
39# kernel modules for the kernel arch.
40set kernel_arch [exec uname -m]
41# If building for different kernel arch than our buildslaves use, force a build
42# from source. The binary package IDs don't encode the kernel arch.
43if {${kernel_arch} ne "x86_64"} {
44    archive_sites
45}
46
47distfiles
48set mp.dist {
49    osxfuse     76b3a54
50    kext        c30faa5
51    framework   2ab904a
52    prefpane    f43c235
53    fuse        98b9960
54    support     4868d64
55}
56
57depends_build       port:autoconf \
58                    port:automake \
59                    port:libtool
60
61set mp.osxfuse_rev  [lindex ${mp.dist} [expr [lsearch ${mp.dist} osxfuse] + 1]]
62worksrcdir          osxfuse-osxfuse-${mp.osxfuse_rev}
63
64foreach { mp.comp mp.rev } ${mp.dist} {
65    set f ${mp.comp}-${mp.rev}.tar.gz
66    master_sites-append https://github.com/osxfuse/${mp.comp}/tarball/${mp.rev}/:${mp.comp}
67    distfiles-append    ${f}:${mp.comp}
68}
69
70if { $use_signed_kext } {
71    master_sites-append sourceforge
72    distfiles-append ${name}-${version}.dmg
73}
74
75checksums           osxfuse-76b3a54.tar.gz \
76                    rmd160  54fd7353b7cd03ed025fd178ff5b56bb5d39003d \
77                    sha256  43d6319498e978636e792a92451f28773549dcaf0b50213dcebea2d5fa728ef2 \
78                    kext-c30faa5.tar.gz \
79                    rmd160  082bc07e158b2d0737f0dabe7ffc9fbf924f16ed \
80                    sha256  4605609208824c297bb5e04cf61f5402204f6bc2d74d1b4b13b90a589cbc4c13 \
81                    framework-2ab904a.tar.gz \
82                    rmd160  af79296880d18d8f8a27803e348ff6429280f0e7 \
83                    sha256  1591c26d0d01311007105ab3789d43abc6e824aaee681aef8b601413dafea65e \
84                    prefpane-f43c235.tar.gz \
85                    rmd160  94178a3c1fde34ee6be8f5516a640bb3d2f6a29a \
86                    sha256  1de3f51eb0497a1b298427a96562beb89c55d38fdf298a69823fcf98d0c70b49 \
87                    fuse-98b9960.tar.gz \
88                    rmd160  589cbe0c819caded56dc4be64727580e1400fd9e \
89                    sha256  f60205e19c2971228b78d180dc65cda2a6271a567229acdeb19567fcbcebb641 \
90                    support-4868d64.tar.gz \
91                    rmd160  d321d49bc3040a3227143204b57d6361eb67a9ed \
92                    sha256  d6cd13707f0f202b2c2391b5410decf1776d1306180da8164c02e5fcf6ba8b43 \
93                    osxfuse-2.7.4.dmg \
94                    rmd160  4ea200bac47cff694aae60b14147ae94dfb5412f \
95                    sha256  e5f43f673062725d76b6c10d379d576f6148f32fab42f6d18455b11f41e92969
96
97# extract phase will just extract the dmg; post-extract will expand
98# the tarballs
99if { $use_signed_kext } {
100    use_dmg yes
101    extract.only ${name}-${version}.dmg
102}
103
104post-extract {
105    # Extract the pkg and the appropriate payload from the binary dmg
106    if { $use_signed_kext } {
107        system -W ${workpath}/${name}-${version} "pkgutil --expand 'Install OSXFUSE ${branch}.pkg' ${workpath}/pkg"
108        system -W ${workpath}/pkg/10.9/OSXFUSECore.pkg "gzip -dc Payload | cpio -id"
109    }
110
111    # Extract the source tarballs
112    foreach { mp.comp mp.rev } ${mp.dist} {
113        if { $use_signed_kext } {
114            system -W ${workpath} "tar -xvf ${distpath}/${mp.comp}-${mp.rev}.tar.gz"
115        }
116        if {${mp.comp} ne "osxfuse"} {
117            # Replace existing empty directory if it exists
118            file delete ${workpath}/${worksrcdir}/${mp.comp}
119            move ${workpath}/osxfuse-${mp.comp}-${mp.rev} ${workpath}/${worksrcdir}/${mp.comp}
120        }
121    }
122}
123
124patchfiles          patch-buildsystem.diff \
125                    patch-kext-location.diff
126
127post-patch {
128    # Perhaps the ports sandbox does not let us write to /tmp.
129    # For a quick and temporary fix use this reinplace.
130    file mkdir ${workpath}/tmp
131    reinplace "s,@@TMP@@,${workpath}/tmp,g" ${worksrcpath}/build.sh
132
133    # Only build the archs we want, not the hardcoded universal archs
134    reinplace -E "s,@@ARCHS@@,[get_canonical_archs],g" ${worksrcpath}/build.sh
135
136    # Inject the destroot path as the buildsystem tries to write to the prefix directly
137    reinplace -E "s,@@DESTROOT@@,${destroot},g" ${worksrcpath}/build.sh
138
139    # Correct the location of the kext
140    reinplace -E "s,@@PREFIX@@,${prefix},g" ${worksrcpath}/kext/common/fuse_param.h
141}
142
143use_configure   no
144
145build.cmd       ./build.sh
146# Yes, they really named this target homebrew
147build.target    -t homebrew
148build.args      -f ${prefix}
149
150# The build step already does everything
151destroot {}
152
153# Move filesystem bundle into place
154post-destroot {
155    # Set proper permissions
156    fs-traverse f ${destroot}${prefix}/Library {
157        file attributes $f -owner root -group wheel
158    }
159    # Enable setuid on helper binary
160    file attributes ${destroot}${prefix}/Library/Filesystems/osxfusefs.fs/Support/load_osxfusefs -permissions 04755
161}
162
163
164# On Mavericks and Yosemite, replace the kext we just built with the
165# one from the binary distribution. This works around OS X's
166# unwillingness to load an unsigned kext (and our inability to sign
167# kexts). See #45521.
168#
169# Unlike newer versions, Mavericks does not require the kext to be
170# signed, but will display a warning if it's unsigned -- so use the
171# signed binary instead here too.
172if { $use_signed_kext } {
173    post-destroot {
174        delete ${destroot}${prefix}/Library/Filesystems/osxfusefs.fs/Support/osxfusefs.kext \
175            ${destroot}${prefix}/Library/Filesystems/osxfusefs.fs/Support/osxfusefs.kext.dSYM
176       
177        file copy ${workpath}/pkg/10.9/OSXFUSECore.pkg/Library/Filesystems/osxfusefs.fs/Support/osxfusefs.kext \
178            ${destroot}${prefix}/Library/Filesystems/osxfusefs.fs/Support
179    }
180}
181
182destroot.violate_mtree yes
183
184notes {
185    When upgrading, unmount all FUSE filesystems and then unload the kernel extension.
186    Unloading can be done via: sudo kextunload -b com.github.osxfuse.filesystems.osxfusefs
187    Alternatively (or if this fails), just reboot your computer now.
188}
189
190# Could probably be supported by setting ARCHS correctly above
191universal_variant no