quagga.spec 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. ##
  2. ## quagga.spec -- OpenPKG RPM Specification
  3. ## Copyright (c) 2000-2005 The OpenPKG Project <http://www.openpkg.org/>
  4. ## Copyright (c) 2000-2005 Ralf S. Engelschall <rse@engelschall.com>
  5. ## Copyright (c) 2000-2005 Cable & Wireless <http://www.cw.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: quagga
  27. Summary: Internet Routing Daemon
  28. URL: http://www.quagga.net/
  29. Vendor: Kunihiro Ishiguro
  30. Packager: The OpenPKG Project
  31. Distribution: OpenPKG
  32. Class: PLUS
  33. Group: Network
  34. License: GPL
  35. Version: 0.98.1
  36. Release: 20050201
  37. # list of sources
  38. Source0: http://www.quagga.net/download/quagga-%{version}.tar.gz
  39. Source1: rc.quagga
  40. Source2: bgpd.conf
  41. Source3: ospfd.conf
  42. Source4: ripd.conf
  43. Source5: zebra.conf
  44. Source6: vtysh.conf
  45. # build information
  46. Prefix: %{l_prefix}
  47. BuildRoot: %{l_buildroot}
  48. BuildPreReq: OpenPKG, openpkg >= 20040130, gcc, perl
  49. PreReq: OpenPKG, openpkg >= 20040130
  50. BuildPreReq: readline
  51. PreReq: readline
  52. AutoReq: no
  53. AutoReqProv: no
  54. Conflicts: zebra
  55. %description
  56. Quagga (a fork of GNU Zebra) is free software (distributed under GNU
  57. Generic Public License) that manages TCP/IP based routing protocols.
  58. It supports BGP-4 protocol as described in RFC1771 (A Border Gateway
  59. Protocol 4) as well as RIPv1, RIPv2 and OSPFv2. Unlike traditional,
  60. Gated based, monolithic architectures and even the so-called "new
  61. modular architectures" that remove the burden of processing routing
  62. functions from the CPU and utilize special ASIC chips instead, Zebra
  63. software offers true modularity.
  64. %track
  65. prog quagga = {
  66. version = %{version}
  67. url = http://www.quagga.net/download/
  68. regex = quagga-(__VER__)\.tar\.gz
  69. }
  70. %prep
  71. %setup -q
  72. %{l_shtool} subst \
  73. -e 's;/usr/bin/perl;%{l_prefix}/bin/perl;g' \
  74. vtysh/extract.pl
  75. case "%{l_platform -t}" in
  76. *-freebsd* )
  77. %{l_shtool} subst \
  78. -e 's;UINT32_MAX;UINT_MAX;' \
  79. bgpd/bgp_routemap.c
  80. ;;
  81. esac
  82. %build
  83. # configure package
  84. ISISD=""
  85. case "%{l_platform -t}" in
  86. *-netbsd* )
  87. ISISD="--disable-isisd" ;;
  88. *-sunos* )
  89. ISISD="--disable-isisd" ;;
  90. esac
  91. CC="%{l_cc}" \
  92. CFLAGS="%{l_cflags -O}" \
  93. CPPFLAGS="%{l_cppflags}" \
  94. LDFLAGS="%{l_ldflags}" \
  95. ./configure \
  96. --prefix=%{l_prefix} \
  97. --sysconfdir=%{l_prefix}/etc/quagga \
  98. --localstatedir=%{l_prefix}/var/quagga \
  99. --enable-vtysh \
  100. --disable-ospf6d \
  101. --disable-ripngd \
  102. --disable-ipv6 \
  103. --without-libpam \
  104. --disable-shared \
  105. $ISISD
  106. # build package
  107. %{l_make} %{l_mflags -O}
  108. %install
  109. rm -rf $RPM_BUILD_ROOT
  110. # install package
  111. %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
  112. # strip down package
  113. rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/ospf6d.8
  114. rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/ripngd.8
  115. rm -f $RPM_BUILD_ROOT%{l_prefix}/info/dir
  116. rm -rf $RPM_BUILD_ROOT%{l_prefix}/include
  117. rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib
  118. strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
  119. # replace default configuration
  120. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/quagga/*
  121. %{l_shtool} install -c -m 600 %{l_value -s -a} \
  122. %{SOURCE zebra.conf} %{SOURCE vtysh.conf} \
  123. %{SOURCE ripd.conf} %{SOURCE ospfd.conf} %{SOURCE bgpd.conf} \
  124. $RPM_BUILD_ROOT%{l_prefix}/etc/quagga/
  125. %{l_shtool} install -c -m 600 /dev/null \
  126. $RPM_BUILD_ROOT%{l_prefix}/etc/quagga/zebra.conf.integrate
  127. # install run-command script
  128. %{l_shtool} mkdir -f -p -m 755 \
  129. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  130. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  131. %{SOURCE rc.quagga} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  132. # make sure pid and log directory exists
  133. %{l_shtool} mkdir -f -p -m 755 \
  134. $RPM_BUILD_ROOT%{l_prefix}/var/quagga
  135. # determine package file list
  136. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  137. %{l_files_std} \
  138. '%config %{l_prefix}/etc/quagga/*'
  139. %files -f files
  140. %clean
  141. rm -rf $RPM_BUILD_ROOT
  142. %post
  143. # after upgrade, restart service
  144. [ $1 -eq 2 ] || exit 0
  145. eval `%{l_rc} quagga status 2>/dev/null`
  146. [ ".$quagga_active" = .yes ] && %{l_rc} quagga restart
  147. exit 0
  148. %preun
  149. # before erase, stop service and remove log files
  150. [ $1 -eq 0 ] || exit 0
  151. %{l_rc} quagga stop 2>/dev/null
  152. rm -f $RPM_INSTALL_PREFIX/var/quagga/quagga.log* >/dev/null 2>&1 || true
  153. exit 0