Ticket #44189: Portfile

File Portfile, 4.9 KB (added by ch1p@…, 10 years ago)
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 123208 2014-08-07 01:18:29Z dports@macports.org $
3
4PortSystem          1.0
5
6name                osxfuse
7version             2.7.0
8revision            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
25# We will build user-space components for the specified arch, and
26# kernel modules for the kernel arch.
27set kernel_arch [exec uname -m]
28# If building for different kernel arch than our buildslaves use, force a build
29# from source. The binary package IDs don't encode the kernel arch.
30if {${kernel_arch} ne "x86_64"} {
31    archive_sites
32}
33
34distfiles
35set mp.dist { 
36    osxfuse     8eb90a2   {rmd160 563f74f3e17caa644be3f01290f4587aea164a56 sha256 82ad7fe7c2b1c31ef522186f0761fb3ab2817027e5dd5cbe85be690f70e846b1}
37    kext        122937c   {rmd160 b912555b99c832a1a6d2cad9d0b6c667e906c8b5 sha256 723b89ac3c52eea2ed3eeb02fc838886e6d4bce29c605761413d89085a03778e}
38    framework   9fdde8a   {rmd160 4124b3e9c396ee41dfce35d480caff41936b8000 sha256 9dd705e05de0b346000853c08c143a15d73673684afcc9bbcf55e6c71b33fb87}
39    prefpane    99d92a5   {rmd160 04706b6e84b8a2ac2a430b53c66c38f34af92b3f sha256 9d8d2990c0f72e1953f1506f9d84bc18299f4b8b9f691c3ecdc4a98b5a81d20b}
40    fuse        98b9960   {rmd160 589cbe0c819caded56dc4be64727580e1400fd9e sha256 f60205e19c2971228b78d180dc65cda2a6271a567229acdeb19567fcbcebb641}
41    support     4b8cfd3   {rmd160 1c03c561c6c8a0650421393857fb356330ea1926 sha256 b30899548a573968b62c109d3394f12f8ef9f79ab981f8e559ba7ab7be77e58a}
42}
43
44depends_build       port:autoconf \
45                    port:automake \
46                    port:libtool
47
48set mp.osxfuse_rev  [lindex ${mp.dist} [expr [lsearch ${mp.dist} osxfuse] + 1]]
49worksrcdir          osxfuse-osxfuse-${mp.osxfuse_rev}
50
51foreach { mp.comp mp.rev mp.chksum } ${mp.dist} {
52    set f ${mp.comp}-${mp.rev}.tar.gz
53    master_sites-append https://github.com/osxfuse/${mp.comp}/tarball/${mp.rev}/:${mp.comp}
54    distfiles-append    ${f}:${mp.comp}
55    checksums-append    ${f}
56    foreach {type chksum} ${mp.chksum} {
57        checksums-append ${type} ${chksum}
58    }
59}
60
61post-extract {
62    foreach { mp.comp mp.rev mp.chksum } ${mp.dist} {
63        if {${mp.comp} ne "osxfuse"} {
64            # Replace existing empty directory if it exists
65            file delete ${workpath}/${worksrcdir}/${mp.comp}
66            move ${workpath}/osxfuse-${mp.comp}-${mp.rev} ${workpath}/${worksrcdir}/${mp.comp}
67        }
68    }
69}
70
71patchfiles          patch-buildsystem.diff \
72                    patch-kext-location.diff
73
74post-patch {
75    # Perhaps the ports sandbox does not let us write to /tmp.
76    # For a quick and temporary fix use this reinplace.
77    file mkdir ${workpath}/tmp
78    reinplace "s,@@TMP@@,${workpath}/tmp,g" ${worksrcpath}/build.sh
79
80    # Only build the archs we want, not the hardcoded universal archs
81    reinplace -E "s,@@ARCHS@@,[get_canonical_archs],g" ${worksrcpath}/build.sh
82    reinplace -E "s,@@KERNELARCHS@@,${kernel_arch},g" ${worksrcpath}/build.sh
83
84    # Inject the destroot path as the buildsystem tries to write to the prefix directly
85    reinplace -E "s,@@DESTROOT@@,${destroot},g" ${worksrcpath}/build.sh
86
87    # Correct the location of the kext
88    reinplace -E "s,@@PREFIX@@,${prefix},g" ${worksrcpath}/kext/common/fuse_param.h
89}
90
91use_configure   no
92
93build.cmd       ./build.sh
94# Yes, they really named this target homebrew
95build.target    -t homebrew
96build.args      -f ${prefix}
97
98# The build step already does everything
99destroot {}
100
101# Move filesystem bundle into place
102post-destroot {
103    # Set proper permissions
104    fs-traverse f ${destroot}${prefix}/Library {
105        file attributes $f -owner root -group wheel
106    }
107    # Enable setuid on helper binary
108    file attributes ${destroot}${prefix}/Library/Filesystems/osxfusefs.fs/Support/load_osxfusefs -permissions 04755
109}
110destroot.violate_mtree yes
111
112notes {
113    When upgrading, unmount all FUSE filesystems and then unload the kernel extension.
114    Unloading can be done via: sudo kextunload -b com.github.osxfuse.filesystems.osxfusefs
115    Alternativley (or if this fails), just reboot your computer now.
116}
117
118# Could probably be supported by setting ARCHS correctly above
119universal_variant no
120
121