]> git.ipfire.org Git - people/stevee/ipfire-3.x.git/blob - net-snmp/net-snmp.nm
net-snmp: Switch to patchelf to remove the RPATH
[people/stevee/ipfire-3.x.git] / net-snmp / net-snmp.nm
1 ###############################################################################
2 # IPFire.org - An Open Source Firewall Solution #
3 # Copyright (C) - IPFire Development Team <info@ipfire.org> #
4 ###############################################################################
5
6 name = net-snmp
7 version = 5.9.3
8 release = 4
9
10 groups = Networking/Daemons
11 url = http://net-snmp.sourceforge.net
12 license = BSD
13 summary = Simple Network Management Protocol Daemon.
14
15 description
16 Simple Network Management Protocol (SNMP) is a widely used protocol
17 for monitoring the health and welfare of network equipment (eg. routers),
18 computer equipment and even devices like UPSs.
19 end
20
21 source_dl = https://sourceforge.net/projects/net-snmp/files/net-snmp/%{version}/
22
23 build
24 requires
25 autoconf
26 automake
27 bzip2-devel
28 elfutils-devel
29 lm-sensors-devel >= 3
30 openssl-devel
31 patchelf
32 procps
33 python3-devel
34 python3-setuptools
35 systemd-devel
36 end
37
38 prepare_cmds
39 autoreconf -vfi
40 end
41
42 MIBS = host agentx smux \
43 ucd-snmp/diskio tcp-mib udp-mib mibII/mta_sendmail \
44 ip-mib/ipv4InterfaceTable ip-mib/ipv6InterfaceTable \
45 ip-mib/ipAddressPrefixTable/ipAddressPrefixTable \
46 ip-mib/ipDefaultRouterTable/ipDefaultRouterTable \
47 ip-mib/ipv6ScopeZoneIndexTable ip-mib/ipIfStatsTable \
48 sctp-mib rmon-mib etherlike-mib ucd-snmp/lmsensorsMib
49
50 configure_options += \
51 --with-cflags="%{CFLAGS} -Wformat" \
52 --with-ldflags="%{LDFLAGS}" \
53 --with-sys-contact="root@localhost" \
54 --with-sys-location="Unknown" \
55 --with-logfile=/var/log/snmpd.log \
56 --with-persistent-directory=/var/lib/net-snmp \
57 --with-mib-modules="%{MIBS}" \
58 --sysconfdir=%{sysconfdir} \
59 --enable-ipv6 \
60 --enable-ucd-snmp-compatibility \
61 --with-openssl \
62 --with-pic \
63 --enable-as-needed \
64 --enable-mfd-rewrites \
65 --enable-local-smux \
66 --with-temp-file-pattern=/var/run/net-snmp/snmp-tmp-XXXXXX \
67 --with-transports="DTLSUDP TLSTCP" \
68 --with-security-modules=tsm \
69 --with-systemd \
70 --with-default-snmp-version="3" \
71 --without-perl-modules \
72 --disable-embedded-perl \
73 --with-python-modules
74
75 install_cmds
76 # Remove stuff we don't want to distribute.
77 rm -vf %{BUILDROOT}%{bindir}/snmpinform
78 ln -svf snmptrap %{BUILDROOT}%{bindir}/snmpinform
79 rm -vf %{BUILDROOT}%{bindir}/snmpcheck
80 rm -vf %{BUILDROOT}{%{bindir}/fixproc,%{mandir}/man1/fixproc*}
81 rm -vf %{BUILDROOT}%{bindir}/ipf-mod.pl
82
83 # Copy missing mib2c.conf files.
84 install -v -m 644 local/mib2c.*.conf %{BUILDROOT}%{datadir}/snmp
85
86 # Make libs executable.
87 find %{BUILDROOT} -name "*.so" | xargs chmod -v 755
88
89 # Install configuration files.
90 mkdir -pv %{BUILDROOT}%{sysconfdir}/snmp
91 install -v -m644 %{DIR_SOURCE}/snmpd.conf \
92 %{BUILDROOT}%{sysconfdir}/snmp/snmpd.conf
93 install -v -m644 %{DIR_SOURCE}/snmptrapd.conf \
94 %{BUILDROOT}%{sysconfdir}/snmp/snmptrapd.conf
95
96 # Prepare runtime directory
97 mkdir -pv %{BUILDROOT}%{sharedstatedir}/net-snmp
98
99 # Remove scripts in /bin which requires the SNMP
100 # perl bindings.
101 rm -rvf %{BUILDROOT}%{bindir}/net-snmp-cert
102 rm -rvf %{BUILDROOT}%{bindir}/tkmib
103 rm -rvf %{BUILDROOT}%{bindir}/mib2c
104 rm -rvf %{BUILDROOT}%{bindir}/snmp-bridge-mib
105
106 # Remove checkbandwidth script
107 # This uses a deprecated perl module (Mail::Sender)
108 rm -rvf %{BUILDROOT}%{bindir}/checkbandwidth
109
110 # Remove more RPATHs.
111 find %{BUILDROOT}%{bindir} -type f -print \
112 -exec patchelf --remove-rpath {} \;
113 end
114 end
115
116 packages
117 package %{name}
118 configfiles
119 %{sysconfdir}/snmp
120 end
121
122 datafiles
123 %{localstatedir}/lib/net-snmp
124 end
125
126 script postin
127 systemctl daemon-reload >/dev/null 2>&1 || :
128 end
129
130 script preun
131 systemctl --no-reload disable snmpd.service > /dev/null 2>&1 || :
132 systemctl stop snmpd.service > /dev/null 2>&1 || :
133
134 systemctl --no-reload disable snmptrapd.service > /dev/null 2>&1 || :
135 systemctl stop snmptrapd.service > /dev/null 2>&1 || :
136 end
137
138 script postun
139 systemctl daemon-reload >/dev/null 2>&1 || :
140 end
141
142 script postup
143 systemctl daemon-reload 2>&1 || :
144 systemctl reload-or-try-restart snmpd.service >/dev/null 2>&1 || :
145 systemctl reload-or-try-restart snmptrapd.service >/dev/null 2>&1 || :
146 end
147 end
148
149 package %{name}-libs
150 template LIBS
151 end
152
153 package python3-%{name}
154 template PYTHON3
155 end
156
157 package %{name}-devel
158 template DEVEL
159
160 requires
161 lm-sensors-devel
162 end
163 end
164
165 package %{name}-debuginfo
166 template DEBUGINFO
167 end
168 end