Ticket #4111: Portfile.4

File Portfile.4, 7.1 KB (added by dports@…, 19 years ago)

Repeated portile revisions were only for grammatical changes to ui_msg

Line 
1# $Id: Portfile,v 1.4 2004/12/03 19:41:51 jberry Exp $
2
3PortSystem      1.0
4
5name                            nrg   
6version                         0.99.24
7
8categories                      net
9maintainers                     dports@mac.com
10platforms                       darwin
11
12description                     Network Resource Grapher
13
14long_description                NRG is an RRDtool front-end tool to monitor traffic and load \
15                                on network links or any other resource utilization source.  It \
16                                automatically creates and maintains web pages and RRDtool databases, \
17                                while providing short and long-term graph web pages just like MRTG.
18
19homepage                        http://nrg.hep.wisc.edu/
20                                       
21master_sites                    ftp://nrg.hep.wisc.edu/pub/src/nrg/ \
22                                ftp://nrg.hep.wisc.edu/pub/src/nrg/old-versions
23
24checksums                       md5 09a1125c7b9430c260f902ce20bd9d3e
25
26depends_lib                     port:rrdtool
27
28patchfiles                      patch-nrg-discover-netdev.in.diff \
29                                patch-nrg-discover-tcp.in.diff \
30                                patch-roverpingd-receive.c.diff
31
32configure.args                  --build=powerpc-unknown-freebsd \
33                                --prefix=${prefix}/var/${name} \
34                                --bindir=${prefix}/bin \
35                                --sysconfdir=${prefix}/etc/${name} \
36                                --datadir=${prefix}/share \
37                                CFLAGS="-D__FreeBSD__"
38
39build.target                    pingd
40destroot.target                 install.pingd install
41
42# Maintain empty directories
43destroot.keepdirs ${destroot}${prefix}/var/${name}/archive
44
45post-patch {
46
47### NET-SNMP Bugs ###
48
49        reinplace "s|@SNMPWALK@|@SNMPWALK@ -v1|g" \
50                "${worksrcpath}/discoverers/nrg-discover-errors.in"
51
52        reinplace "s|@SNMPGET@|@SNMPGET@ -v1|g" \
53                ${worksrcpath}/discoverers/nrg-discover-errors.in \
54                ${worksrcpath}/discoverers/nrg-discover-netdev.in
55
56        reinplace "s|\$args \$host \$comm_str|\$args -c \$comm_str \$host|g" \
57                ${worksrcpath}/discoverers/nrg-discover-errors.in \
58                ${worksrcpath}/discoverers/nrg-discover-snmpd.in \
59                ${worksrcpath}/discoverers/nrg-discover-netdev.in
60
61        reinplace "s|/usr/bin/snmpget|/usr/bin/snmpget -v1|g" \
62                ${worksrcpath}/discoverers/nrg-discover-netdev.in \
63                ${worksrcpath}/discoverers/nrg-discover-snmpd.in
64
65        reinplace "s|/usr/bin/snmpwalk|/usr/bin/snmpwalk -v1|g" \
66                ${worksrcpath}/discoverers/nrg-discover-snmpd.in
67
68        reinplace "s|\$snmp_args \$system -c \$passwd|\$snmp_args -c \$passwd \$system|g" \
69                "${worksrcpath}/etc/run-star-tail.pl.in"
70
71### Misc bugs ###
72
73        reinplace "s|-idx||g" \
74                "${worksrcpath}/examples/Site.mconf"
75
76        reinplace "s|/usr/local/nrg-test|@prefix@|g" \
77                "${worksrcpath}/examples/Default.conf.in"
78
79        reinplace "s|*ping-data|*ping-latency|g" \
80                "${worksrcpath}/examples/Default.conf.in"
81
82        reinplace "s|\$target-\$host-ping-data|\$target-\$host-ping-latency|g" \
83                "${worksrcpath}/templates/discover-pingd.tm"
84
85### roverpingd fix ###
86
87        reinplace "s|<malloc.h>|<stdlib.h>|g" \
88                ${worksrcpath}/roverpingd/send.c \
89                ${worksrcpath}/roverpingd/pingd.c \
90                ${worksrcpath}/roverpingd/read_list.c
91
92        reinplace "s|<values.h>|<limits.h>|g" \
93                "${worksrcpath}/roverpingd/write_stats.c"
94
95        reinplace "s|MAXINT|INT_MAX|g" \
96                "${worksrcpath}/roverpingd/write_stats.c"
97       
98#### Fix paths ####
99
100        reinplace "s|@bindir@/rrdtool|${prefix}/bin/rrdtool|g" \
101                "${worksrcpath}/etc/run-star-head.pl.in"
102
103        eval reinplace "s|@prefix@|${prefix}|g" [glob ${worksrcpath}/templates/*.in]
104
105        reinplace "s|@prefix@/bin|@bindir@|g" ${worksrcpath}/examples/NRG.mconf.in
106
107        reinplace "s|/usr/local/web/html|/Library/WebServer/Documents|g" \
108                ${worksrcpath}/examples/Makefile.ops.in ${worksrcpath}/examples/Site.mconf
109
110        reinplace "s|Somesite's NRG Home Page|NRG Home Page|g" \
111                "${worksrcpath}/examples/Makefile.ops.in"
112
113        reinplace "s|@prefix@/etc|@sysconfdir@|g" \
114                ${worksrcpath}/discoverers/nrg-discover-pingd.in \
115                ${worksrcpath}/collectors/nrg-pingdstat.in \
116                ${worksrcpath}/roverpingd/pingd.h.in
117
118        eval reinplace "s|@prefix@/bin|@bindir@|g" \
119                [glob ${worksrcpath}/discoverers/*.in]
120
121        reinplace "s|exec_prefix = @prefix@|exec_prefix = ${destroot}@prefix@|g" \
122                ${worksrcpath}/Makefile.in
123
124        reinplace "s|prefix = @prefix@|prefix = ${destroot}@prefix@|g" \
125                ${worksrcpath}/Makefile.in
126
127        reinplace "s|BIN_DIR = @bindir@|BIN_DIR = ${destroot}@bindir@|g" \
128                ${worksrcpath}/Makefile.in
129
130        reinplace "s|ETC_DIR = \${prefix}/etc|ETC_DIR = ${destroot}@sysconfdir@|g" \
131                ${worksrcpath}/Makefile.in
132
133        reinplace "s|TEMPLATE_DIR = \${prefix}/templates|TEMPLATE_DIR = ${destroot}@prefix@/templates|g" \
134                ${worksrcpath}/Makefile.in
135
136        reinplace "s|EXAMPLE_DIR = \${prefix}/examples|EXAMPLE_DIR = ${destroot}@datadir@/doc/nrg/examples|g" \
137                ${worksrcpath}/Makefile.in
138
139        reinplace "s|HTML_DIR = \${prefix}/html|HTML_DIR = ${destroot}@datadir@/doc/nrg/html|g" \
140                ${worksrcpath}/Makefile.in
141
142        reinplace "s|ARCHIVE_DIR = \${prefix}/archive|ARCHIVE_DIR = ${destroot}@prefix@/archive|g" \
143                ${worksrcpath}/Makefile.in
144
145        reinplace "s|CONTRIB_DIR = \${prefix}/contrib|CONTRIB_DIR = ${destroot}@datadir@/doc/nrg/contrib|g" \
146                ${worksrcpath}/Makefile.in
147
148}
149
150post-destroot {
151
152# Copy roverpingd.init to contrib
153xinstall -d -m 755 ${destroot}${prefix}/share/doc/${name}/contrib
154xinstall -m 755 ${worksrcpath}/contrib/roverpingd.init ${destroot}${prefix}/share/doc/${name}/contrib
155
156# Install images to ./share/doc and in Apache doc root
157xinstall -d -m 755 ${destroot}${prefix}/share/doc/${name}/images
158eval xinstall -m 755 [glob ${worksrcpath}/images/*.*] ${destroot}${prefix}/share/doc/${name}/images
159
160xinstall -d 755 ${destroot}/Library/WebServer/Documents/${name}/icons
161eval xinstall -m 755 [glob ${worksrcpath}/images/*.*] ${destroot}/Library/WebServer/Documents/${name}/icons
162system "ln -s -f /Library/WebServer/Documents/nrg ${destroot}${prefix}/var/${name}/web"
163
164}
165
166post-activate {
167# Alert user that NRG data directory and symlinks were created and where in case they want to
168# change them, and give a few operating instructions
169
170ui_msg "\nThe NRG data directory was created in the Apache document root, NRG icons
171copied into ../nrg/icons, and symlink ${prefix}/var/${name}/web ->
172/Library/WebServer/Documents/nrg created.  Now modify your httpd.conf file
173for NRG:
174
175Uncomment lines:   AddHandler cgi-script .cgi
176                   LoadModule expires_module   libexec/httpd/mod_expires.so
177                   AddModule mod_expires.c
178
179Add directives:    <Directory /Library/WebServer/Documents/nrg>
180                      Options ExecCGI
181                   </Directory>
182                       
183                   <Files \"*.gif\">
184                      ExpiresActive On
185                      ExpiresDefault M5
186                   </Files>
187
188NOTE: If /Library/WebServer/Documents is not your Apache document root, create
189an nrg directory in the correct path, copy the icons to nrg/icons from
190${prefix}/share/doc/nrg/images, set symlink ${prefix}/var/nrg/web to point
191to it, and modify the NRG Makefile and Site.mconf files in
192${prefix}/var/${name} accordingly.
193
194
195To use NRG:
196
1971) Set meta-configuration strings in the Site.mconf file according to the
198   example meta-configuration strings in ${prefix}/share/doc/nrg/examples.
199
2002) Have NRG generate rrdfiles and html graph pages (or update them after
201   Site.mconf changes) with these commands:
202
203        cd ${prefix}/var/${name}
204        make rediscover
205        make notify
206
2073) Set ${prefix}/var/${name}/run-nrg in cron to set NRG to poll your devices
208   every 5 minutes.
209
210Be sure to read the documentation in ${prefix}/share/doc/${name}/html for
211creating custom graphs or for more information.\n"
212}
213