source: trunk/dports/net/nrg/Portfile

Last change on this file was 151871, checked in by mojca@…, 13 months ago

nrg: switch to perl5.24 (#52081)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 5.9 KB
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: Portfile 151871 2016-08-23 12:44:26Z ryandesign@macports.org $
3
4PortSystem          1.0
5PortGroup           perl5 1.0
6
7name                nrg
8version             0.99.27
9revision            4
10categories          net
11maintainers         nomaintainer
12platforms           darwin
13
14description         Network Resource Grapher
15
16long_description    NRG is an RRDtool front-end tool to monitor traffic and load \
17                    on network links or any other resource utilization source.  It \
18                    automatically creates and maintains web pages and RRDtool databases, \
19                    while providing short and long-term graph web pages just like MRTG.
20
21# website no longer exists
22homepage            http://ginseng.hep.wisc.edu/NRG/
23master_sites        ftp://noc.hep.wisc.edu/src/nrg/ \
24                    ftp://noc.hep.wisc.edu/pub/src/nrg/
25
26checksums           rmd160  1192ce02d14447abdcff994671693eeb4ca67e28 \
27                    sha256  ef851705f9ebd2bf55892823f258c7cffc079ae0276df4f40860c520262971c2
28
29perl5.branches      5.24
30
31depends_lib         port:perl${perl5.major} \
32                    port:p${perl5.major}-time-hires \
33                    port:rrdtool
34
35patchfiles          patch-nrg-discover-tcp.in.diff \
36                    patch-roverpingd-send.c.diff
37
38configure.perl      ${perl5.bin}
39
40configure.pre_args  --prefix=${prefix}/var/${name}
41
42configure.args      --bindir=${prefix}/bin \
43                    --sysconfdir=${prefix}/etc/${name} \
44                    --datadir=${prefix}/share \
45                    --build=powerpc-unknown-freebsd \
46                    CFLAGS="-D__FreeBSD__"
47
48platform i386 {
49    configure.args-delete   --build=powerpc-unknown-freebsd
50    configure.args-append   --build=i386-unknown-freebsd
51}
52
53variant pingd_server description {pingd daemon to graph network latency with NRG} {
54    startupitem.create      yes
55    startupitem.name        pingd
56    startupitem.executable  "${prefix}/bin/pingd"
57}
58
59build.target                pingd
60destroot.target             install.pingd install
61
62# Maintain empty directories
63destroot.keepdirs ${destroot}${prefix}/var/${name}/archive
64
65post-patch {
66
67### Path fixes ###
68    reinplace "s|@prefix@/bin|@bindir@|g" \
69        ${worksrcpath}/examples/NRG.mconf.in \
70        ${worksrcpath}/src/nrg-spiketrimmer.in
71
72    reinplace "s|@prefix@/bin|@bindir@|g" \
73        {*}[glob ${worksrcpath}/templates/*.in]
74
75#### Make NRG page title the way I want it ####
76    reinplace "s|Somesite's NRG Home Page|NRG Home Page|g" \
77        "${worksrcpath}/examples/Makefile.ops.in"
78
79
80#### Fix paths for proper destrooting ####
81    reinplace "s|exec_prefix = @prefix@|exec_prefix = ${destroot}@prefix@|g" \
82        ${worksrcpath}/Makefile.in
83    reinplace "s|prefix = @prefix@|prefix = ${destroot}@prefix@|g" \
84        ${worksrcpath}/Makefile.in
85    reinplace "s|BIN_DIR = @bindir@|BIN_DIR = ${destroot}@bindir@|g" \
86        ${worksrcpath}/Makefile.in
87    reinplace "s|ETC_DIR = @sysconfdir@|ETC_DIR = ${destroot}@sysconfdir@|g" \
88        ${worksrcpath}/Makefile.in
89    reinplace "s|TEMPLATE_DIR = \${prefix}/templates|TEMPLATE_DIR = ${destroot}@prefix@/templates|g" \
90        ${worksrcpath}/Makefile.in
91    reinplace "s|EXAMPLE_DIR = \${prefix}/examples|EXAMPLE_DIR = ${destroot}@datadir@/doc/nrg/examples|g" \
92        ${worksrcpath}/Makefile.in
93    reinplace "s|HTML_DIR = \${prefix}/html|HTML_DIR = ${destroot}@datadir@/doc/nrg/html|g" \
94        ${worksrcpath}/Makefile.in
95    reinplace "s|ARCHIVE_DIR = \${prefix}/archive|ARCHIVE_DIR = ${destroot}@prefix@/archive|g" \
96        ${worksrcpath}/Makefile.in
97    reinplace "s|CONTRIB_DIR = \${prefix}/contrib|CONTRIB_DIR = ${destroot}@datadir@/doc/nrg/contrib|g" \
98        ${worksrcpath}/Makefile.in
99}
100
101post-destroot {
102# Install images to \${prefix}/var/nrg/web/icons
103    xinstall -d -m 755 ${destroot}${prefix}/var/${name}/web/icons
104    xinstall -m 755 {*}[glob ${worksrcpath}/images/*.*] ${destroot}${prefix}/var/${name}/web/icons
105
106# Rename Site.mconf so graphed devices won't get rewritten on port upgrades
107    move ${destroot}${prefix}/var/${name}/Site.mconf \
108        ${destroot}${prefix}/var/${name}/Site.mconf.sample
109}
110
111notes \
112"#### To complete the NRG installation ####
113
1141) Make an /nrg symlink in your Apache document root pointing to the ../nrg/web NRG data directory:
115
116      sudo ln -s ${prefix}/var/${name}/web /my-Apache-document-root/nrg
117
1182) Modify your httpd.conf file for NRG graph pages:
119
120Uncomment lines:   AddHandler cgi-script .cgi
121           LoadModule expires_module   libexec/httpd/mod_expires.so
122           AddModule mod_expires.c
123
124Add directives:    <Directory /my-Apache-document-root/nrg>
125              Options ExecCGI
126           </Directory>
127
128           <Files \"*.gif\">
129              ExpiresActive On
130              ExpiresDefault M5
131           </Files>
132
133Change the Apache user and group to the NRG user and group so Apache will
134have permissions to create graphs when you click an RRD file link.
135
136           User <nrg-user>
137           Group <nrg-group>
138
1393) Change the web root variables at the top of files Makefile and Site.mconf
140   in directory ${prefix}/var/${name} to your Apache document root location.
141
1424) Make NRG files and data owned by the user you'll use to run NRG
143
144   su  (must be root for this operation)
145   find ${prefix}/var/nrg -print | xargs chown <nrg-user>:<nrg-group>
146
147
148#### To use NRG ####
149
1501) Set meta-configuration definitions in the Site.mconf file for each
151   resource you want to graph by following the example meta-configuration
152   definitions in ${prefix}/share/doc/nrg/examples.
153
1542) Have NRG generate rrd files and html graph pages (and modify them after
155   Site.mconf changes):
156
157      cd ${prefix}/var/${name}
158      make rediscover
159      make notify
160
1613) Schedule the script ${prefix}/var/${name}/run-nrg to run via cron every five
162   minutes to poll your data sources and update the rrd files.
163
164Be sure to read the documentation in ${prefix}/share/doc/${name}/html for
165creating custom graphs or for more information."
Note: See TracBrowser for help on using the repository browser.