blob: 85d738b79ba168dc176f70aced65122ed1510088 [file] [log] [blame]
Alexander Afanasyev9944ebc2012-08-20 18:40:12 -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
Alexander Afanasyevd9b5aad2012-08-27 14:16:37 -07004PortSystem 1.0
Alexander Afanasyevd600ea92012-09-24 13:39:43 -07005PortGroup github 1.0
Alexander Afanasyevb41f8502013-02-14 14:02:57 -08006
Alexander Afanasyev193d60b2013-05-13 19:42:36 -07007github.setup named-data ccnx ccnx-0.7.2rc1-ndn-1
8checksums rmd160 f5a9f7917946837aa79b55090b695e5c62b63cf4 \
9 sha256 bc3202263cb5e7317897d91de8e3dd3d6a7132d8686ff877a43c59f0a80efbde
Alexander Afanasyevd600ea92012-09-24 13:39:43 -070010
Alexander Afanasyevd9b5aad2012-08-27 14:16:37 -070011name ccnx
12homepage http://www.ccnx.org/
13license GPL-2+ LGPL-2.1+
Alexander Afanasyev193d60b2013-05-13 19:42:36 -070014version 0.7.2rc1.ndn.1
Alexander Afanasyev8e850282012-08-23 10:04:58 -070015
Alexander Afanasyevdcb61ae2013-02-18 09:22:45 -080016categories net
Alexander Afanasyevd9b5aad2012-08-27 14:16:37 -070017platforms darwin
18maintainers ucla.edu:alexander.afanasyev
Alexander Afanasyevb41f8502013-02-14 14:02:57 -080019
Alexander Afanasyevd9b5aad2012-08-27 14:16:37 -070020description ProjectCCNx implementation of Content Centric Networking (CCN) / \
21 Named Data Networking (NDN) architecture
Alexander Afanasyevb41f8502013-02-14 14:02:57 -080022
Alexander Afanasyevd9b5aad2012-08-27 14:16:37 -070023long_description Project CCNx(r) exists to develop, promote, and evaluate a new \
24 approach to communication architecture we call content-centric \
25 networking. We seek to carry out this mission by creating and \
26 publishing open protocol specifications and an open source \
27 software reference implementation of those protocols. We provide \
28 support for a community of people interested in experimentation, \
29 research, and building applications with this technology, all \
Alexander Afanasyevb41f8502013-02-14 14:02:57 -080030 contributing to its evolution.
31
Alexander Afanasyev9291faa2012-08-27 15:00:11 -070032depends_lib-append port:openssl \
Alexander Afanasyevd9b5aad2012-08-27 14:16:37 -070033 port:expat \
34 port:libpcap \
Alexander Afanasyevd600ea92012-09-24 13:39:43 -070035 port:libxml2 \
36 port:asciidoc
Alexander Afanasyevb41f8502013-02-14 14:02:57 -080037
Alexander Afanasyevd9b5aad2012-08-27 14:16:37 -070038set ccnxuser ccnx
39set ccnxgroup ccnx
40set ccnxdir ${prefix}/etc/ccnx
Alexander Afanasyevb41f8502013-02-14 14:02:57 -080041
Alexander Afanasyevd9b5aad2012-08-27 14:16:37 -070042add_users ${ccnxuser} shell=/bin/sh group=${ccnxgroup} \
43 home=${ccnxdir} \
44 realname=CCNx\ Account
Alexander Afanasyevb41f8502013-02-14 14:02:57 -080045
Alexander Afanasyevd9b5aad2012-08-27 14:16:37 -070046default_variants +java +apps
Alexander Afanasyevc1ec69f2012-08-24 18:10:09 -070047
48variant java description {Enable Java API build} {
Alexander Afanasyevd9b5aad2012-08-27 14:16:37 -070049 configure.env-delete BUILD_JAVA=false
Alexander Afanasyevc1ec69f2012-08-24 18:10:09 -070050}
51
52variant apps requires java description {Enable build of reference applications} {
Alexander Afanasyevd9b5aad2012-08-27 14:16:37 -070053 configure.env-delete BUILD_APPS=false
Alexander Afanasyevc1ec69f2012-08-24 18:10:09 -070054}
Alexander Afanasyev9944ebc2012-08-20 18:40:12 -070055
Alexander Afanasyevd9b5aad2012-08-27 14:16:37 -070056post-patch {
Alexander Afanasyevdb1e1b72013-02-19 15:44:33 -080057 reinplace "s|\$HOME/.ccnx/|${ccnxdir}/|g" ${worksrcpath}/csrc/util/ccndstart.sh
Alexander Afanasyev9944ebc2012-08-20 18:40:12 -070058}
59
Alexander Afanasyevd9b5aad2012-08-27 14:16:37 -070060configure.env-append OPENSSL_CFLAGS=-I${prefix}/include \
61 OPENSSL_LIBS=-L${prefix}/lib \
62 INSTALL_BASE=${prefix} \
Alexander Afanasyev4ca899a2013-03-12 10:48:16 -070063 INSTALL_MAN=${prefix}/share/man \
Alexander Afanasyevd9b5aad2012-08-27 14:16:37 -070064 BUILD_JAVA=false \
65 BUILD_APPS=false \
66
Alexander Afanasyevdf59d202013-02-19 16:02:42 -080067configure.cflags -DCCNX_DIR=\\\"${ccnxdir}\\\" \
Alexander Afanasyev654f4d62013-03-17 10:53:29 -070068 -O2 -std=gnu99
Alexander Afanasyevd9b5aad2012-08-27 14:16:37 -070069
70build.env-append OPENSSL_CFLAGS=-I${prefix}/include \
71 OPENSSL_LIBS=-L${prefix}/lib \
Alexander Afanasyevd600ea92012-09-24 13:39:43 -070072 INSTALL_BASE=${prefix} \
Alexander Afanasyevb41f8502013-02-14 14:02:57 -080073
Alexander Afanasyevd9b5aad2012-08-27 14:16:37 -070074
Alexander Afanasyevc1ec69f2012-08-24 18:10:09 -070075post-destroot {
Alexander Afanasyevd9b5aad2012-08-27 14:16:37 -070076 # Create a configuration directory, which also a home directory for ${ccnxuser}
Alexander Afanasyevdb1e1b72013-02-19 15:44:33 -080077 xinstall -d -o ${ccnxuser} -g ${ccnxgroup} "${destroot}${ccnxdir}"
Alexander Afanasyevc1ec69f2012-08-24 18:10:09 -070078
Alexander Afanasyevd9b5aad2012-08-27 14:16:37 -070079 # Copy a sample ccnd.conf file
Alexander Afanasyevc7660be2012-08-27 15:13:36 -070080 xinstall -o ${ccnxuser} -g ${ccnxgroup} \
81 ${worksrcpath}/csrc/libexec/ccnd.conf.sample \
Alexander Afanasyevdb1e1b72013-02-19 15:44:33 -080082 ${destroot}${ccnxdir}/
Alexander Afanasyevc1ec69f2012-08-24 18:10:09 -070083
Alexander Afanasyevd9b5aad2012-08-27 14:16:37 -070084 # Create a sample ccndrc file
Alexander Afanasyevdb1e1b72013-02-19 15:44:33 -080085 system "echo CCNR_GLOBAL_PREFIX=/ndn/keys > \"${destroot}${ccnxdir}/ccndrc.sample\""
86 system "echo CCND_LOG=${prefix}/var/log/ccnd.log >> \"${destroot}${ccnxdir}/ccndrc.sample\""
87 system "echo CCND_DEBUG=16 >> \"${destroot}${ccnxdir}/ccndrc.sample\""
Alexander Afanasyevc1ec69f2012-08-24 18:10:09 -070088}
89
Alexander Afanasyevd9b5aad2012-08-27 14:16:37 -070090post-activate {
91 # log file needs to be owned by ${ccnxuser}, otherwise ccnd will not be able to write to it
Alexander Afanasyevd600ea92012-09-24 13:39:43 -070092 file mkdir "${prefix}/var/log"
Alexander Afanasyevd9b5aad2012-08-27 14:16:37 -070093 touch "${prefix}/var/log/ccnd.log"
94 file attributes "${prefix}/var/log/ccnd.log" -owner ${ccnxuser} -group ${ccnxgroup}
Alexander Afanasyevdc05deb2013-02-19 18:05:24 -080095 file mkdir "${prefix}/var/run/ccnd"
96 file attributes "${prefix}/var/run/ccnd" -owner ${ccnxuser} -group ${ccnxgroup}
Alexander Afanasyevc7660be2012-08-27 15:13:36 -070097
98 # Make sure initial conf files are present and setup correctly
99 foreach f { ccnd.conf ccndrc } {
Alexander Afanasyevdb1e1b72013-02-19 15:44:33 -0800100 if {![file exists ${ccnxdir}/${f}]} {
101 file copy ${ccnxdir}/${f}.sample \
102 ${ccnxdir}/${f}
Alexander Afanasyevc7660be2012-08-27 15:13:36 -0700103 }
104 }
Alexander Afanasyevd9b5aad2012-08-27 14:16:37 -0700105}
Alexander Afanasyev9944ebc2012-08-20 18:40:12 -0700106
107startupitem.pidfile none
Alexander Afanasyevdc05deb2013-02-19 18:05:24 -0800108startupitem.start "su ${ccnxuser} -c \"${prefix}/bin/ccndstart\" && sleep 5 && su ${ccnxuser} -c \"${prefix}/bin/ccnd-autoconfig -d ${prefix}/var/run/ccnd/autoconfig.pid &\""
109startupitem.stop "su ${ccnxuser} -c \"kill `cat ${prefix}/var/run/ccnd/autoconfig.pid`\" ; su ${ccnxuser} -c \"${prefix}/bin/ccndstop\""
Alexander Afanasyevdb1e1b72013-02-19 15:44:33 -0800110startupitem.restart "su ${ccnxuser} -c \"${prefix}/bin/ccndc -f ${ccnxdir}/ccnd.conf\" && su ${ccnxuser} -c \"${prefix}/bin/ccnd-autoconfig\""
Alexander Afanasyev9944ebc2012-08-20 18:40:12 -0700111
Alexander Afanasyevdb1e1b72013-02-19 15:44:33 -0800112variant no_autoconf description {Disable automatic detection of local ccnx hub} {
Alexander Afanasyev186dd3a2012-10-03 18:09:36 -0700113 startupitem.start "su ${ccnxuser} -c \"${prefix}/bin/ccndstart\""
Alexander Afanasyevdb1e1b72013-02-19 15:44:33 -0800114 startupitem.restart "su ${ccnxuser} -c \"${prefix}/bin/ccndc -f ${ccnxdir}/ccnd.conf\""
Alexander Afanasyev186dd3a2012-10-03 18:09:36 -0700115}
116
Alexander Afanasyev9944ebc2012-08-20 18:40:12 -0700117startupitem.create yes
Alexander Afanasyevd9b5aad2012-08-27 14:16:37 -0700118startupitem.name ${name}
Alexander Afanasyev9944ebc2012-08-20 18:40:12 -0700119
120startupitem.netchange yes
121startupitem.logevents yes
122startupitem.logfile ${prefix}/var/log/ccnx.log
123
124notes "
Alexander Afanasyeveae69362012-08-27 09:49:56 -0700125
Alexander Afanasyevdb1e1b72013-02-19 15:44:33 -0800126You can add the following line into \"${ccnxdir}/ccndrc\" in order to automatically
Alexander Afanasyevb41f8502013-02-14 14:02:57 -0800127start ccnx repo for the /ndn/keys prefix:
128
129 CCNR_GLOBAL_PREFIX=/ndn/keys
130
Alexander Afanasyev4ca899a2013-03-12 10:48:16 -0700131For more information and documentation, refer to man pages and http://www.ccnx.org website.
132
133If you have your public key signed by NDN testbed operators and you installed the certificate
134\(using ndn-install-pubcert command\), you can enable automatic configuration of the default
135route using your key. To do so, you need to run the following commands once:
136
137 # extract public key from ccnx user
138 sudo HOME=${ccnxdir} ndn-extract-public-key > /tmp/ccnx.pem
139
140 # sign public key of the ccnx user
141 ndn-sign-key -i \"ccnx-autoconfig\" /tmp/ccnx.pem
142
143 # install certification of the public key
144 sudo HOME=${ccnxdir} ndn-install-pubcert /tmp/ccnx.pubcert
145
Alexander Afanasyev9944ebc2012-08-20 18:40:12 -0700146"