Alexander Afanasyev | ede8c80 | 2013-08-14 01:34:48 -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 | |
Alexander Afanasyev | 3a55435 | 2013-10-24 16:45:22 -0700 | [diff] [blame] | 7 | github.setup named-data ndnx 25ad5ea4a2b445ce2f98809dd77ba9a5ce46ea84 |
| 8 | checksums rmd160 2029a4e57625c372fac9ba50574c5d1fd72c709c \ |
| 9 | sha256 351605a6b4e7a25ddce052f20e16fa9607ec8208d8af570cf8c7eab65f6bee04 |
Alexander Afanasyev | ede8c80 | 2013-08-14 01:34:48 -0700 | [diff] [blame] | 10 | |
| 11 | name ndnx |
| 12 | homepage http://www.named-data.net |
| 13 | license GPL-2+ LGPL-2.1+ |
Alexander Afanasyev | 3a55435 | 2013-10-24 16:45:22 -0700 | [diff] [blame] | 14 | version 0.2-git-25ad5 |
| 15 | revision 0 |
Alexander Afanasyev | ede8c80 | 2013-08-14 01:34:48 -0700 | [diff] [blame] | 16 | |
| 17 | categories net |
| 18 | platforms darwin |
| 19 | maintainers ucla.edu:alexander.afanasyev |
| 20 | |
| 21 | description NDNx library and ndnd forwarding daemon |
| 22 | |
| 23 | long_description NDNx library and ndnd forwarding daemon |
| 24 | |
| 25 | depends_lib-append port:openssl \ |
| 26 | port:expat \ |
| 27 | port:libpcap \ |
| 28 | port:libxml2 \ |
| 29 | port:asciidoc |
| 30 | |
| 31 | set ndnxuser ndnx |
| 32 | set ndnxgroup ndnx |
| 33 | set ndnxdir ${prefix}/etc/ndnx |
| 34 | |
| 35 | add_users ${ndnxuser} shell=/bin/sh group=${ndnxgroup} \ |
| 36 | home=${ndnxdir} \ |
| 37 | realname=NDNx\ Account |
| 38 | |
| 39 | default_variants +java +apps |
| 40 | |
| 41 | variant java description {Enable Java API build} { |
| 42 | configure.env-delete BUILD_JAVA=false |
| 43 | } |
| 44 | |
| 45 | variant apps requires java description {Enable build of reference applications} { |
| 46 | configure.env-delete BUILD_APPS=false |
| 47 | } |
| 48 | |
| 49 | post-patch { |
| 50 | reinplace "s|\$HOME/.ndnx/|${ndnxdir}/|g" ${worksrcpath}/csrc/util/ndndstart.sh |
| 51 | } |
| 52 | |
| 53 | configure.env-append OPENSSL_CFLAGS=-I${prefix}/include \ |
| 54 | OPENSSL_LIBS=-L${prefix}/lib \ |
| 55 | INSTALL_BASE=${prefix} \ |
| 56 | INSTALL_MAN=${prefix}/share/man \ |
| 57 | BUILD_JAVA=false \ |
| 58 | BUILD_APPS=false \ |
| 59 | |
| 60 | configure.cflags -DNDNX_DIR=\\\"${ndnxdir}\\\" \ |
| 61 | -O2 -std=gnu99 |
| 62 | |
| 63 | build.env-append OPENSSL_CFLAGS=-I${prefix}/include \ |
| 64 | OPENSSL_LIBS=-L${prefix}/lib \ |
| 65 | INSTALL_BASE=${prefix} \ |
| 66 | |
| 67 | |
| 68 | post-destroot { |
| 69 | # Create a configuration directory, which also a home directory for ${ndnxuser} |
| 70 | xinstall -d -o ${ndnxuser} -g ${ndnxgroup} "${destroot}${ndnxdir}" |
| 71 | |
| 72 | # Copy a sample ndnd.conf file |
| 73 | xinstall -o ${ndnxuser} -g ${ndnxgroup} \ |
| 74 | ${worksrcpath}/csrc/libexec/ndnd.conf.sample \ |
| 75 | ${destroot}${ndnxdir}/ |
| 76 | |
| 77 | # Create a sample ndndrc file |
| 78 | system "echo NDNR_GLOBAL_PREFIX=/ndn/keys > \"${destroot}${ndnxdir}/ndndrc.sample\"" |
| 79 | system "echo NDND_LOG=${prefix}/var/log/ndnd.log >> \"${destroot}${ndnxdir}/ndndrc.sample\"" |
| 80 | system "echo NDND_DEBUG=16 >> \"${destroot}${ndnxdir}/ndndrc.sample\"" |
| 81 | } |
| 82 | |
| 83 | post-activate { |
| 84 | # log file needs to be owned by ${ndnxuser}, otherwise ndnd will not be able to write to it |
| 85 | file mkdir "${prefix}/var/log" |
| 86 | touch "${prefix}/var/log/ndnd.log" |
| 87 | file attributes "${prefix}/var/log/ndnd.log" -owner ${ndnxuser} -group ${ndnxgroup} |
| 88 | file mkdir "${prefix}/var/run/ndnd" |
| 89 | file attributes "${prefix}/var/run/ndnd" -owner ${ndnxuser} -group ${ndnxgroup} |
| 90 | |
| 91 | # Make sure initial conf files are present and setup correctly |
| 92 | foreach f { ndnd.conf ndndrc } { |
| 93 | if {![file exists ${ndnxdir}/${f}]} { |
| 94 | file copy ${ndnxdir}/${f}.sample \ |
| 95 | ${ndnxdir}/${f} |
| 96 | } |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | startupitem.pidfile none |
| 101 | startupitem.start "su ${ndnxuser} -c \"${prefix}/bin/ndndstart\" && sleep 5 && su ${ndnxuser} -c \"${prefix}/bin/ndnd-autoconfig -d ${prefix}/var/run/ndnd/autoconfig.pid &\"" |
| 102 | startupitem.stop "su ${ndnxuser} -c \"kill `cat ${prefix}/var/run/ndnd/autoconfig.pid`\" ; su ${ndnxuser} -c \"${prefix}/bin/ndndstop\"" |
| 103 | startupitem.restart "su ${ndnxuser} -c \"${prefix}/bin/ndndc -f ${ndnxdir}/ndnd.conf\" && su ${ndnxuser} -c \"${prefix}/bin/ndnd-autoconfig\"" |
| 104 | |
| 105 | variant no_autoconf description {Disable automatic detection of local ndnx hub} { |
| 106 | startupitem.start "su ${ndnxuser} -c \"${prefix}/bin/ndndstart\"" |
| 107 | startupitem.restart "su ${ndnxuser} -c \"${prefix}/bin/ndndc -f ${ndnxdir}/ndnd.conf\"" |
| 108 | } |
| 109 | |
| 110 | startupitem.create yes |
| 111 | startupitem.name ${name} |
| 112 | |
| 113 | startupitem.netchange yes |
| 114 | startupitem.logevents yes |
| 115 | startupitem.logfile ${prefix}/var/log/ndnx.log |
| 116 | |
| 117 | notes " |
| 118 | |
| 119 | You can add the following line into \"${ndnxdir}/ndndrc\" in order to automatically |
| 120 | start ndnx repo for the /ndn/keys prefix: |
| 121 | |
| 122 | NDNR_GLOBAL_PREFIX=/ndn/keys |
| 123 | |
| 124 | For more information and documentation, refer to man pages and http://www.ndnx.org website. |
| 125 | |
| 126 | If you have your public key signed by NDN testbed operators and you installed the certificate |
| 127 | \(using ndn-install-pubcert command\), you can enable automatic configuration of the default |
| 128 | route using your key. To do so, you need to run the following commands once: |
| 129 | |
| 130 | # extract public key from ndnx user |
| 131 | sudo HOME=${ndnxdir} ndn-extract-public-key > /tmp/ndnx.pem |
| 132 | |
| 133 | # sign public key of the ndnx user |
| 134 | ndn-sign-key -i \"ndnx-autoconfig\" /tmp/ndnx.pem |
| 135 | |
| 136 | # install certification of the public key |
| 137 | sudo HOME=${ndnxdir} ndn-install-pubcert /tmp/ndnx.pubcert |
| 138 | |
| 139 | " |