zebra.spec 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. ##
  2. ## zebra.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: zebra
  27. Summary: Internet Routing Daemon
  28. URL: http://www.zebra.org/
  29. Vendor: Kunihiro Ishiguro
  30. Packager: The OpenPKG Project
  31. Distribution: OpenPKG [BASE]
  32. Group: Network
  33. License: GPL
  34. Version: 0.93b
  35. Release: 20030312
  36. # list of sources
  37. Source0: ftp://ftp.zebra.org/pub/zebra/zebra-%{version}.tar.gz
  38. Source1: rc.zebra
  39. Source2: bgpd.conf
  40. Source3: ospfd.conf
  41. Source4: ripd.conf
  42. Source5: zebra.conf
  43. Source6: vtysh.conf
  44. Patch0: zebra.patch
  45. # build information
  46. Prefix: %{l_prefix}
  47. BuildRoot: %{l_buildroot}
  48. BuildPreReq: OpenPKG, openpkg >= 20020206, gcc, readline
  49. PreReq: OpenPKG, openpkg >= 20020206
  50. AutoReq: no
  51. AutoReqProv: no
  52. %description
  53. GNU Zebra is free software (distributed under GNU Generic Public
  54. License) that manages TCP/IP based routing protocols. It supports
  55. BGP-4 protocol as described in RFC1771 (A Border Gateway Protocol
  56. 4) as well as RIPv1, RIPv2 and OSPFv2. Unlike traditional, Gated
  57. based, monolithic architectures and even the so-called "new modular
  58. architectures" that remove the burden of processing routing
  59. functions from the CPU and utilize special ASIC chips instead, Zebra
  60. software offers true modularity.
  61. %prep
  62. %setup -q
  63. %patch -p0
  64. %build
  65. # patch configure script for correct pid directory
  66. %{l_shtool} subst \
  67. -e 's;^ac_piddir=\$ZEBRA_PID_DIR;ac_piddir=%{l_prefix}/var/zebra;' \
  68. configure
  69. # configure package
  70. CC="%{l_cc}" \
  71. CFLAGS="%{l_cflags -O}" \
  72. CPPFLAGS="%{l_cppflags}" \
  73. LDFLAGS="%{l_ldflags}" \
  74. ./configure \
  75. --prefix=%{l_prefix} \
  76. --sysconfdir=%{l_prefix}/etc/zebra \
  77. --enable-vtysh \
  78. --disable-ospf6d \
  79. --disable-ripngd \
  80. --disable-ipv6 \
  81. --without-libpam
  82. # build package
  83. %{l_make} %{l_mflags -O}
  84. %install
  85. rm -rf $RPM_BUILD_ROOT
  86. # install package
  87. %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
  88. # strip down package
  89. rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/ospf6d.8
  90. rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/ripngd.8
  91. rm -f $RPM_BUILD_ROOT%{l_prefix}/info/dir
  92. strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
  93. # replace default configuration
  94. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/zebra/*
  95. %{l_shtool} install -c -m 600 \
  96. -e 's;@l_prefix@;%{l_prefix};g' \
  97. %{SOURCE zebra.conf} %{SOURCE vtysh.conf} \
  98. %{SOURCE ripd.conf} %{SOURCE ospfd.conf} %{SOURCE bgpd.conf} \
  99. $RPM_BUILD_ROOT%{l_prefix}/etc/zebra/
  100. %{l_shtool} install -c -m 600 /dev/null \
  101. $RPM_BUILD_ROOT%{l_prefix}/etc/zebra/zebra.conf.integrate
  102. # install run-command script
  103. %{l_shtool} mkdir -f -p -m 755 \
  104. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  105. %{l_shtool} install -c -m 755 \
  106. -e 's;@l_prefix@;%{l_prefix};g' \
  107. %{SOURCE rc.zebra} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  108. # make sure pid and log directory exists
  109. %{l_shtool} mkdir -f -p -m 755 \
  110. $RPM_BUILD_ROOT%{l_prefix}/var/zebra
  111. # determine package file list
  112. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  113. %{l_files_std} \
  114. '%config %{l_prefix}/etc/zebra/*'
  115. %files -f files
  116. %clean
  117. rm -rf $RPM_BUILD_ROOT
  118. %preun
  119. if [ $1 -eq 0 ]; then
  120. $RPM_INSTALL_PREFIX/etc/rc zebra stop
  121. rm -f $RPM_INSTALL_PREFIX/var/zebra/*.log
  122. rm -f $RPM_INSTALL_PREFIX/var/zebra/*.pid
  123. fi