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