Alexander Afanasyev | 20cc34e | 2014-05-07 01:28:34 -0700 | [diff] [blame^] | 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$ |
| 3 | |
| 4 | PortSystem 1.0 |
| 5 | PortGroup github 1.0 |
| 6 | |
| 7 | github.setup named-data NFD b47d53842a6ea8d32800459270a667952d4079bf |
| 8 | checksums rmd160 b4c9d6217791642ee6438172be07356554ab2efd \ |
| 9 | sha256 8c40c6e96266e064455c2ca6b0b87eedd2bfed10511edcba9940facb6131802a |
| 10 | |
| 11 | name nfd |
| 12 | homepage http://named-data.net/doc/NFD/ |
| 13 | license GPL3+ |
| 14 | version 0.1.0-rc1.1 |
| 15 | |
| 16 | categories net |
| 17 | platforms darwin |
| 18 | maintainers ucla.edu:alexander.afanasyev |
| 19 | |
| 20 | description Named Data Networking Forwarding Daemon |
| 21 | |
| 22 | long_description \ |
| 23 | NFD is a network forwarder that implements and evolves together with the \ |
| 24 | Named Data Networking (NDN) protocol. The main design goal of NFD is \ |
| 25 | to support diverse experimentation of NDN technology. \ |
| 26 | The design emphasizes modularity and extensibility to allow easy \ |
| 27 | experiments with new protocol features, algorithms, new \ |
| 28 | applications. We have not fully optimized the code for \ |
| 29 | performance. The intention is that performance optimizations are one \ |
| 30 | type of experiments that developers can conduct by trying out \ |
| 31 | different data structures and different algorithms\; over time, better \ |
| 32 | implementations may emerge within the same design framework. |
| 33 | |
| 34 | depends_lib-append port:ndn-cxx \ |
| 35 | port:libpcap |
| 36 | |
| 37 | depends_build-append port:pkgconfig \ |
| 38 | port:py27-sphinx |
| 39 | |
| 40 | use_configure yes |
| 41 | |
| 42 | configure.env-append SPHINX_BUILD=${prefix}/bin/sphinx-build-2.7 |
| 43 | configure.cmd ./waf configure |
| 44 | |
| 45 | build.cmd ./waf |
| 46 | build.target build |
| 47 | |
| 48 | destroot.cmd ./waf |
| 49 | destroot.target install |
| 50 | destroot.destdir --destdir=${destroot} |
| 51 | |
| 52 | set ndn_user ndn |
| 53 | set ndn_group ndn |
| 54 | |
| 55 | add_users ${ndn_user} shell=/bin/sh group=${ndn_group} \ |
| 56 | realname=NDN\ User |
| 57 | |
| 58 | post-destroot { |
| 59 | # Install plists |
| 60 | xinstall -m 755 -d ${destroot}${prefix}/etc/LaunchDaemons/net.named-data.nfd/ |
| 61 | xinstall -m 755 ${filespath}/net.named-data.nfd.plist \ |
| 62 | ${destroot}${prefix}/etc/LaunchDaemons/net.named-data.nfd/ |
| 63 | xinstall -m 755 ${filespath}/net.named-data.nrd.plist \ |
| 64 | ${destroot}${prefix}/etc/LaunchDaemons/net.named-data.nfd/ |
| 65 | |
| 66 | reinplace "s|/usr/local|${prefix}|g" \ |
| 67 | ${destroot}${prefix}/etc/LaunchDaemons/net.named-data.nfd/net.named-data.nfd.plist |
| 68 | reinplace "s|/usr/local|${prefix}|g" \ |
| 69 | ${destroot}${prefix}/etc/LaunchDaemons/net.named-data.nfd/net.named-data.nrd.plist |
| 70 | |
| 71 | # Install replacement for nfd-start/stop scripts |
| 72 | xinstall -m 755 ${filespath}/nfd-start "${destroot}${prefix}/bin/" |
| 73 | xinstall -m 755 ${filespath}/nfd-stop "${destroot}${prefix}/bin/" |
| 74 | } |
| 75 | |
| 76 | post-activate { |
| 77 | |
| 78 | # Create log dir |
| 79 | xinstall -m 755 -d -o ${ndn_user} -g ${ndn_group} \ |
| 80 | ${prefix}/var/log/ndn |
| 81 | |
| 82 | system "cd /Library/LaunchDaemons && sudo ln -sf \ |
| 83 | ${prefix}/etc/LaunchDaemons/net.named-data.nfd/net.named-data.nfd.plist" |
| 84 | system "cd /Library/LaunchDaemons && sudo ln -sf \ |
| 85 | ${prefix}/etc/LaunchDaemons/net.named-data.nfd/net.named-data.nrd.plist" |
| 86 | |
| 87 | if {![file exists ${prefix}/etc/ndn/nfd.conf]} { |
| 88 | |
| 89 | file copy ${prefix}/etc/ndn/nfd.conf.sample \ |
| 90 | ${prefix}/etc/ndn/nfd.conf |
| 91 | |
| 92 | # Generate self-signed NDN certificate for nfd (owned by root) |
| 93 | xinstall -m 755 -d ${prefix}/var/lib/ndn/nfd/.ndn |
| 94 | system "echo tpm=file > ${prefix}/var/lib/ndn/nfd/.ndn/client.conf" |
| 95 | system "HOME=${prefix}/var/lib/ndn/nfd ndnsec-keygen /localhost/daemons/nfd | \ |
| 96 | HOME=${prefix}/var/lib/ndn/nfd ndnsec-install-cert -" |
| 97 | |
| 98 | # Generate self-signed NDN certificate for nrd (owned by ndn) |
| 99 | xinstall -m 755 -d -o ${ndn_user} -g ${ndn_group} ${prefix}/var/lib/ndn/nrd/.ndn |
| 100 | system "sudo -u ${ndn_user} -g ${ndn_group} sh -c 'echo tpm=file \ |
| 101 | > ${prefix}/var/lib/ndn/nrd/.ndn/client.conf'" |
| 102 | system "sudo -u ${ndn_user} -g ${ndn_group} HOME=${prefix}/var/lib/ndn/nrd \ |
| 103 | ndnsec-keygen /localhost/daemons/nrd | \ |
| 104 | sudo -u ${ndn_user} -g ndn HOME=${prefix}/var/lib/ndn/nrd ndnsec-install-cert -" |
| 105 | |
| 106 | # Dump RIB Management daemon's certificate |
| 107 | xinstall -m 755 -d ${prefix}/etc/ndn/certs |
| 108 | system "sudo sh -c 'sudo -u ${ndn_user} -g ${ndn_group} HOME=${prefix}/var/lib/ndn/nrd \ |
| 109 | ndnsec-dump-certificate -i /localhost/daemons/nrd \ |
| 110 | > ${prefix}/etc/ndn/certs/localhost_daemons_nrd.ndncert'" |
| 111 | |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | pre-deactivate { |
| 116 | system "${prefix}/bin/nfd-stop" |
| 117 | |
| 118 | system "rm ${prefix}/etc/LaunchDaemons/net.named-data.nfd/net.named-data.nfd.plist" |
| 119 | system "rm ${prefix}/etc/LaunchDaemons/net.named-data.nfd/net.named-data.nrd.plist" |
| 120 | } |
| 121 | |
| 122 | notes " |
| 123 | |
| 124 | To start NFD and ensure it is started when system boots: |
| 125 | |
| 126 | nfd-start |
| 127 | |
| 128 | To stop NFD and disable auto-start when system boots: |
| 129 | |
| 130 | nfd-stop |
| 131 | |
| 132 | NFD log files are located in ${prefix}/var/log/ndn/ |
| 133 | |
| 134 | Configuration file is in ${prefix}/var/etc/ndn/ |
| 135 | |
| 136 | " |