Ticket #54566: Portfile

File Portfile, 3.4 KB (added by 1-61803, 7 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
3PortSystem          1.0
4PortGroup           github 1.0
5
6name                ipfs
7github.setup        ipfs go-ipfs 0.4.10 v
8
9categories          www
10platforms           darwin
11license             MIT
12maintainers         nomaintainer
13
14description         IPFS is a peer-to-peer hypermedia protocol. This is the implementation in go
15long_description    IPFS is a global, versioned, peer-to-peer filesystem. It combines \
16                    good ideas from Git, BitTorrent, Kademlia, SFS, and the Web. \
17                    It is like a single bittorrent swarm, exchanging git objects. \
18                    IPFS provides an interface as simple as the HTTP web, but \
19                    with permanence built-in. You can also mount the world at /ipfs.
20
21homepage            https://ipfs.io/
22
23checksums           rmd160  6ed1203cd5243d628739f19419807d2031b15894 \
24                    sha256  d033ed4b8fe05c258294c5bbe3d4d111a000e5afc489f3f935272bcfa49bfcd1
25
26depends_lib-append  port:go
27
28# go's bin, pkg, src relative to workpath
29
30worksrcdir          src/github.com/ipfs/go-ipfs
31extract.mkdir       yes
32extract.post_args-append \
33                    --strip-components=1
34
35use_configure       no
36
37build.env-append    GOPATH=${workpath}
38build.dir           ${workpath}/src/github.com/ipfs/go-ipfs
39build.target-append install
40
41destroot {
42    # binary
43    xinstall -m 755 ${workpath}/bin/${name} ${destroot}${prefix}/bin/${name}
44
45    # startup item
46    file mkdir ${destroot}${prefix}/etc/LaunchDaemons/org.macports.${name}/
47    file mkdir ${destroot}/Library/LaunchDaemons/
48    copy ${worksrcpath}/misc/launchd/io.ipfs.ipfs-daemon.plist \
49        ${destroot}${prefix}/etc/LaunchDaemons/org.macports.${name}/org.macports.${name}.plist
50    ln -sf ${prefix}/etc/LaunchDaemons/org.macports.${name}/org.macports.${name}.plist \
51        ${destroot}/Library/LaunchDaemons/
52    reinplace s|io.ipfs.ipfs-daemon|org.macports.${name}.plist| \
53        ${destroot}${prefix}/etc/LaunchDaemons/org.macports.${name}/org.macports.${name}.plist
54    reinplace s|{{IPFS_BIN}}|${prefix}/bin/${name}| \
55        ${destroot}${prefix}/etc/LaunchDaemons/org.macports.${name}/org.macports.${name}.plist
56    reinplace s|{{IPFS_PATH}}|${user_home}/.ipfs| \
57        ${destroot}${prefix}/etc/LaunchDaemons/org.macports.${name}/org.macports.${name}.plist
58    reinplace -E "1,/<dict>/s|<dict>|<dict>\\\n    <key>Disabled</key>\\\n    <true/>|" \
59        ${destroot}${prefix}/etc/LaunchDaemons/org.macports.${name}/org.macports.${name}.plist
60
61    # documentation
62    set docdir ${prefix}/share/${subport}
63    xinstall -d ${destroot}${docdir}
64    xinstall -m 644 -W ${worksrcpath} CHANGELOG.md ISSUE_TEMPLATE.md LICENSE \
65        README.md contribute.md dev.md roadmap.md ${destroot}${docdir}
66    copy ${worksrcpath}/docs ${destroot}${docdir}
67    copy ${worksrcpath}/misc ${destroot}${docdir}
68}
69
70notes "
71A startup item has been generated that will aid in starting ${name} with launchd.
72It is disabled by default. Execute the following command to start it, and to cause it to launch at startup:
73  sudo port load ${name}
74Beware to have your repo initialized first with the following command:
75  ${name} init
76
77To install the autocompletion, source the complete script from the shell's rc:
78  echo \"source ${prefix}/share/${name}/misc/completion/ipfs-completion.bash\" >> ~/.bashrc
79"