Ticket #35852: Portfile.3

File Portfile.3, 5.4 KB (added by cawka (Alex Afanasyev), 12 years ago)

one more correction of he Portfile

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# $Id$
3
4PortSystem              1.0
5PortGroup               github 1.0
6
7github.setup            named-data ccnx ccnx-0.7.1-ucla-1
8checksums               rmd160  0835f02b8ff649bc3b435b3f03c4c747566bd34a \
9                        sha256  1c2ee8a065fd162881a20a359c00f2b4a7185c1e69d2b3f1b5815c623b7ab62b
10
11name                    ccnx
12homepage                http://www.ccnx.org/
13license                 GPL-2+ LGPL-2.1+
14version                 0.7.1.ucla.1
15
16categories              net
17platforms               darwin
18maintainers             ucla.edu:alexander.afanasyev
19
20description             ProjectCCNx implementation of Content Centric Networking (CCN) / \
21                        Named Data Networking (NDN) architecture
22
23long_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 \
30                        contributing to its evolution.
31
32use_parallel_build      no
33
34depends_lib-append      port:openssl \
35                        port:expat \
36                        port:libpcap \
37                        port:libxml2 \
38                        port:asciidoc
39
40set ccnxuser            ccnx
41set ccnxgroup           ccnx
42set ccnxdir             ${prefix}/etc/ccnx
43
44add_users               ${ccnxuser} shell=/bin/sh group=${ccnxgroup} \
45                        home=${ccnxdir} \
46                        realname=CCNx\ Account
47
48default_variants        +java +apps
49
50variant java description {Enable Java API build} {
51    configure.env-delete   BUILD_JAVA=false
52}
53
54variant apps requires java description {Enable build of reference applications} {
55    configure.env-delete   BUILD_APPS=false
56}
57
58post-patch {
59    reinplace   "s|\$HOME/.ccnx/|${ccnxdir}/|g" ${worksrcpath}/csrc/util/ccndstart.sh
60}
61
62configure.env-append    OPENSSL_CFLAGS=-I${prefix}/include \
63                        OPENSSL_LIBS=-L${prefix}/lib \
64                        INSTALL_BASE=${prefix} \
65                        BUILD_JAVA=false \
66                        BUILD_APPS=false \
67
68configure.cflags        -DCCNX_DIR=\\\"${ccnxdir}\\\" \
69                        -O2
70
71build.env-append        OPENSSL_CFLAGS=-I${prefix}/include \
72                        OPENSSL_LIBS=-L${prefix}/lib \
73                        INSTALL_BASE=${prefix} \
74
75
76post-destroot {
77    # Create a configuration directory, which also a home directory for ${ccnxuser}
78    xinstall -d -o ${ccnxuser} -g ${ccnxgroup} "${destroot}${ccnxdir}"
79
80    # Copy a sample ccnd.conf file
81    xinstall -o ${ccnxuser} -g ${ccnxgroup} \
82        ${worksrcpath}/csrc/libexec/ccnd.conf.sample \
83        ${destroot}${ccnxdir}/
84
85    # Create a sample ccndrc file
86    system "echo CCNR_GLOBAL_PREFIX=/ndn/keys > \"${destroot}${ccnxdir}/ccndrc.sample\""
87    system "echo CCND_LOG=${prefix}/var/log/ccnd.log >> \"${destroot}${ccnxdir}/ccndrc.sample\""
88    system "echo CCND_DEBUG=16 >> \"${destroot}${ccnxdir}/ccndrc.sample\""
89}
90
91post-activate {
92    # log file needs to be owned by ${ccnxuser}, otherwise ccnd will not be able to write to it
93    file mkdir "${prefix}/var/log"
94    touch "${prefix}/var/log/ccnd.log"
95    file attributes "${prefix}/var/log/ccnd.log" -owner ${ccnxuser} -group ${ccnxgroup}
96    file mkdir "${prefix}/var/run/ccnd"
97    file attributes "${prefix}/var/run/ccnd" -owner ${ccnxuser} -group ${ccnxgroup}
98
99    # Make sure initial conf files are present and setup correctly
100    foreach f { ccnd.conf ccndrc } {
101        if {![file exists ${ccnxdir}/${f}]} {
102            file copy ${ccnxdir}/${f}.sample \
103                ${ccnxdir}/${f}
104        }
105    }
106}
107
108startupitem.pidfile     none
109startupitem.start       "su ${ccnxuser} -c \"${prefix}/bin/ccndstart\" && sleep 5 && su ${ccnxuser} -c \"${prefix}/bin/ccnd-autoconfig -d ${prefix}/var/run/ccnd/autoconfig.pid &\""
110startupitem.stop        "su ${ccnxuser} -c \"kill `cat ${prefix}/var/run/ccnd/autoconfig.pid`\" ; su ${ccnxuser} -c \"${prefix}/bin/ccndstop\""
111startupitem.restart     "su ${ccnxuser} -c \"${prefix}/bin/ccndc -f ${ccnxdir}/ccnd.conf\" && su ${ccnxuser} -c \"${prefix}/bin/ccnd-autoconfig\""
112
113variant no_autoconf description {Disable automatic detection of local ccnx hub} {
114    startupitem.start       "su ${ccnxuser} -c \"${prefix}/bin/ccndstart\""
115    startupitem.restart     "su ${ccnxuser} -c \"${prefix}/bin/ccndc -f ${ccnxdir}/ccnd.conf\""
116}
117
118startupitem.create      yes
119startupitem.name        ${name}
120
121startupitem.netchange   yes
122startupitem.logevents   yes
123startupitem.logfile     ${prefix}/var/log/ccnx.log
124
125notes "
126If you want to run repo, please install and load a separate ccnx-repo package:
127
128    # port install ccnx-repo
129    # port load ccnx-repo
130
131You can add the following line into \"${ccnxdir}/ccndrc\" in order to automatically
132start ccnx repo for the /ndn/keys prefix:
133
134    CCNR_GLOBAL_PREFIX=/ndn/keys
135
136For more information and documentation, refer to man pages and
137http://www.ccnx.org website.
138"