snmp.spec 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. ##
  2. ## snmp.spec -- OpenPKG RPM Specification
  3. ## Copyright (c) 2000-2003 Cable & Wireless Deutschland GmbH
  4. ## Copyright (c) 2000-2003 The OpenPKG Project <http://www.openpkg.org/>
  5. ## Copyright (c) 2000-2003 Ralf S. Engelschall <rse@engelschall.com>
  6. ##
  7. ## Permission to use, copy, modify, and distribute this software for
  8. ## any purpose with or without fee is hereby granted, provided that
  9. ## the above copyright notice and this permission notice appear in all
  10. ## copies.
  11. ##
  12. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  13. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  14. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  15. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  16. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  17. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  18. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  19. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  20. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  21. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  22. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  23. ## SUCH DAMAGE.
  24. ##
  25. # package information
  26. Name: snmp
  27. Summary: Simple Network Management Protocol (SNMP) Toolkit
  28. URL: http://www.net-snmp.org/
  29. Vendor: University of California Davis
  30. Packager: The OpenPKG Project
  31. Distribution: OpenPKG [PLUS]
  32. Group: Network
  33. License: BSD
  34. Version: 5.0.8
  35. Release: 20030708
  36. # package options
  37. %option with_fsl yes
  38. %option with_host_mib no
  39. # list of sources
  40. Source0: http://osdn.dl.sourceforge.net/net-snmp/net-snmp-%{version}.tar.gz
  41. Source1: rc.snmp
  42. Source2: snmpd.conf
  43. Source3: fsl.snmp
  44. # build information
  45. Prefix: %{l_prefix}
  46. BuildRoot: %{l_buildroot}
  47. BuildPreReq: OpenPKG, openpkg >= 20030428
  48. PreReq: OpenPKG, openpkg >= 20030428
  49. BuildPreReq: openssl
  50. PreReq: openssl
  51. %if "%{with_fsl}" == "yes"
  52. BuildPreReq: fsl
  53. PreReq: fsl
  54. %endif
  55. AutoReq: no
  56. AutoReqProv: no
  57. %description
  58. This is a toolkit relating to the Simple Network Management Protocol
  59. (SNMP), including: an extensible agent; an SNMP library; tools to
  60. request or set information from SNMP agents; tools to generate and
  61. handle SNMP traps; a version of the unix 'netstat' command using
  62. SNMP; etc.
  63. %prep
  64. # unpack and patch package
  65. %setup -q -n net-snmp-%{version}
  66. %{l_shtool} subst \
  67. -e 's;/usr/include/rpm;%{l_prefix}/include/rpm;g' \
  68. -e 's;-lpopt\([^a-z]\);-lrpmpopt\1;g' \
  69. -e 's;-ldb\([^a-z]\);-lrpmdb\1;g' \
  70. -e 's;-lz\([^a-z]\);-lrpz\1;g' \
  71. -e 's;-lrpm\([^a-z]\);-lrpm -lrpmio\1;g' \
  72. -e 's;-lrpmio\([^a-z]\);-lrpmio -lrpmpopt -lrpmbz2 -lrpmz\1;g' \
  73. configure
  74. %build
  75. # configure package
  76. ./configure \
  77. --with-cc="%{l_cc}" \
  78. --with-cflags="%{l_cflags -O}" \
  79. --with-ldflags="%{l_ldflags} %{l_fsl_ldflags}" \
  80. --with-libs="%{l_fsl_libs}" \
  81. --prefix=%{l_prefix} \
  82. --with-persistent-directory=%{l_prefix}/var/snmp \
  83. --with-openssl=%{l_prefix} \
  84. --enable-silent-libtool \
  85. --disable-shared \
  86. %if "%{with_host_mib}" == "yes"
  87. --with-mib-modules="host" \
  88. %endif
  89. --with-defaults
  90. # build package
  91. %{l_make} %{l_mflags} touchit
  92. %{l_make} %{l_mflags}
  93. %install
  94. rm -rf $RPM_BUILD_ROOT
  95. # install package
  96. %{l_shtool} subst -v \
  97. -e "s;^\\(prefix.*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix};g" \
  98. -e "s;^\\(exec_prefix.*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix};g" \
  99. -e "s;^\\(persistentdir.*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix}/var/snmp;g" \
  100. `find . -type f -name Makefile -print`
  101. %{l_make} %{l_mflags} install
  102. # create additional directories
  103. %{l_shtool} mkdir -f -p -m 755 \
  104. $RPM_BUILD_ROOT%{l_prefix}/var/snmp \
  105. $RPM_BUILD_ROOT%{l_prefix}/var/snmp \
  106. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
  107. $RPM_BUILD_ROOT%{l_prefix}/etc/snmp
  108. # install default configuration
  109. %{l_shtool} install -c -m 644 \
  110. %{SOURCE snmpd.conf} \
  111. $RPM_BUILD_ROOT%{l_prefix}/etc/snmp/
  112. # strip down installation
  113. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/snmpinform
  114. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/ipf-mod.pl
  115. ln $RPM_BUILD_ROOT%{l_prefix}/bin/snmptrap \
  116. $RPM_BUILD_ROOT%{l_prefix}/bin/snmpinform
  117. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  118. strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
  119. # install run-command script
  120. %{l_shtool} mkdir -f -p -m 755 \
  121. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  122. %{l_shtool} install -c -m 755 \
  123. -e 's;@l_prefix@;%{l_prefix};g' \
  124. -e 's;@l_susr@;%{l_susr};g' \
  125. -e 's;@l_rusr@;%{l_rusr};g' \
  126. -e 's;@l_rgrp@;%{l_rgrp};g' \
  127. %{SOURCE rc.snmp} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  128. # install OSSP fsl configuration
  129. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
  130. %{l_shtool} install -c -m 644 \
  131. -e 's;@l_prefix@;%{l_prefix};g' \
  132. %{SOURCE fsl.snmp} \
  133. $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
  134. # determine installation files
  135. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  136. %{l_files_std} \
  137. '%not %dir %{l_prefix}/etc/fsl' \
  138. '%config %{l_prefix}/etc/fsl/fsl.snmp' \
  139. '%config %{l_prefix}/etc/snmp/*.conf'
  140. %files -f files
  141. %clean
  142. rm -rf $RPM_BUILD_ROOT