Ticket #4111: Portfile

File Portfile, 6.4 KB (added by dports@…, 19 years ago)

NRG portfile

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#### End fix paths ####
150}
151
152post-destroot {
153
154# Copy roverpingd.init to contrib
155xinstall -d -m 755 ${destroot}${prefix}/share/doc/${name}/contrib
156xinstall -m 755 ${worksrcpath}/contrib/roverpingd.init ${destroot}${prefix}/share/doc/${name}/contrib
157
158# Install images to ./share/doc and in Apache doc root
159xinstall -d -m 755 ${destroot}${prefix}/share/doc/${name}/images
160eval xinstall -m 755 [glob ${worksrcpath}/images/*.*] ${destroot}${prefix}/share/doc/${name}/images
161
162xinstall -d 755 ${destroot}/Library/WebServer/Documents/${name}/icons
163eval xinstall -m 755 [glob ${worksrcpath}/images/*.*] ${destroot}/Library/WebServer/Documents/${name}/icons
164system "ln -s -f /Library/WebServer/Documents/nrg ${destroot}${prefix}/var/${name}/web"
165
166}
167
168post-activate {
169# Alert user that NRG data directory and symlinks were created and where in case they want to change them
170
171ui_msg "\nThe NRG data directory was created in the Apache document root, NRG icons were copied
172into ../nrg/icons, and the symlink ${prefix}/var/nrg/web -> /Library/WebServer/Documents/nrg
173was created.
174       
175If /Library/WebServer/Documents is not your Apache document root, you must copy
176the contents to the correct document root (or from ${prefix}/share/doc/nrg/images), set a symlink
177${prefix}/var/nrg/web to point to it, and modify the NRG Makefile and Site.mconf settings accordingly.
178
179Don't forget to modify your httpd.conf file for NRG according to the documentation, and be sure
180to check ${prefix}/share/doc/nrg/examples for example meta-configuration statements for
181your Site.mconf file.\n"
182
183}
184