avahi.spec 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. ##
  2. ## avahi.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2010 OpenPKG Foundation e.V. <http://openpkg.net/>
  4. ##
  5. ## Permission to use, copy, modify, and distribute this software for
  6. ## any purpose with or without fee is hereby granted, provided that
  7. ## the above copyright notice and this permission notice appear in all
  8. ## copies.
  9. ##
  10. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  11. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  12. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  13. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  14. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  15. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  16. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  17. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  18. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  19. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  20. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  21. ## SUCH DAMAGE.
  22. ##
  23. # FIXME: rse: package still fully untested
  24. # package information
  25. Name: avahi
  26. Summary: Zeroconf/DNS-SD/mDNS Toolkit
  27. URL: http://avahi.org/
  28. Vendor: Lennart Poettering, Trent Lloyd, Sjoerd Simons
  29. Packager: OpenPKG Foundation e.V.
  30. Distribution: OpenPKG Community
  31. Class: EVAL
  32. Group: Networking
  33. License: GPL
  34. Version: 0.6.27
  35. Release: 20100813
  36. # package options
  37. %option with_dbus yes
  38. # list of sources
  39. Source0: http://avahi.org/download/avahi-%{version}.tar.gz
  40. Source1: rc.avahi
  41. Source2: avahi-daemon.conf
  42. Patch0: avahi.patch
  43. # build information
  44. BuildPreReq: OpenPKG, openpkg >= 20100101
  45. PreReq: OpenPKG, openpkg >= 20100101
  46. BuildPreReq: libdaemon, expat, libpcap, getopt, gdbm
  47. PreReq: libdaemon, expat, libpcap, getopt, gdbm
  48. %if "%{with_dbus}" == "yes"
  49. BuildPreReq: dbus
  50. PreReq: dbus
  51. %endif
  52. %description
  53. Avahi is a system which facilitates service discovery on a local
  54. network via the mDNS/DNS-SD protocol suite. This enables you to plug
  55. your laptop or computer into a network and instantly be able to view
  56. other people who you can chat with, find printers to print to or
  57. find files being shared. Compatible technology is found in Apple
  58. MacOS X (branded Bonjour and sometimes ZeroConf).
  59. %track
  60. prog avahi = {
  61. version = %{version}
  62. url = http://avahi.org/download/
  63. regex = avahi-(__VER__)\.tar\.gz
  64. }
  65. %prep
  66. %setup -q
  67. %patch -p0
  68. %build
  69. # configure program
  70. CC="%{l_cc}" \
  71. CFLAGS="%{l_cflags -O}" \
  72. CPPFLAGS="%{l_cppflags}" \
  73. LDFLAGS="%{l_ldflags}" \
  74. ./configure \
  75. --prefix=%{l_prefix} \
  76. --mandir=%{l_prefix}/man \
  77. --with-xml=expat \
  78. --with-avahi-user=%{l_nusr} \
  79. --with-avahi-group=%{l_ngrp} \
  80. --with-autoipd-user=%{l_nusr} \
  81. --with-autoipd-group=%{l_ngrp} \
  82. --with-avahi-priv-access-group=%{l_mgrp} \
  83. --disable-glib \
  84. --disable-gobject \
  85. %if "%{with_dbus}" == "yes"
  86. --enable-dbus \
  87. %else
  88. --disable-dbus \
  89. %endif
  90. --disable-python \
  91. --disable-qt3 \
  92. --disable-qt4 \
  93. --disable-gtk \
  94. --disable-gtk3 \
  95. --disable-mono \
  96. --disable-monodoc \
  97. --disable-shared \
  98. --disable-nls
  99. # build program
  100. %{l_make} %{l_mflags -O}
  101. %install
  102. # install program
  103. %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
  104. # strip down installation
  105. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/avahi*
  106. rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/locale
  107. %if "%{with_dbus}" != "yes"
  108. rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/dbus-1
  109. %endif
  110. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  111. strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
  112. # install default configuration
  113. %{l_shtool} mkdir -f -p -m 755 \
  114. $RPM_BUILD_ROOT%{l_prefix}/etc/avahi
  115. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  116. %{SOURCE avahi-daemon.conf} \
  117. $RPM_BUILD_ROOT%{l_prefix}/etc/avahi/
  118. # install run-command script
  119. %{l_shtool} mkdir -f -p -m 755 \
  120. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  121. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  122. %{SOURCE rc.avahi} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  123. # make sure the database directory exists
  124. %{l_shtool} mkdir -f -p -m 755 \
  125. $RPM_BUILD_ROOT%{l_prefix}/var/avahi/run \
  126. $RPM_BUILD_ROOT%{l_prefix}/var/avahi/log
  127. # determine the package files
  128. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  129. %{l_files_std} \
  130. '%config %{l_prefix}/etc/avahi/*' \
  131. '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/avahi' \
  132. '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/avahi/*'
  133. %files -f files
  134. %clean
  135. %pre
  136. # before upgrade, save status and stop service
  137. [ $1 -eq 2 ] || exit 0
  138. eval `%{l_rc} avahi status 2>/dev/null | tee %{l_tmpfile}`
  139. %{l_rc} avahi stop 2>/dev/null
  140. exit 0
  141. %post
  142. if [ $1 -eq 2 ]; then
  143. # after upgrade, restore status
  144. { eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile}; true; } >/dev/null 2>&1
  145. [ ".$avahi_active" = .yes ] && %{l_rc} avahi start
  146. fi
  147. exit 0
  148. %preun
  149. # before erase, stop service and remove log files
  150. [ $1 -eq 0 ] || exit 0
  151. %{l_rc} avahi stop 2>/dev/null
  152. rm -f $RPM_INSTALL_PREFIX/var/avahi/run/* >/dev/null 2>&1 || true
  153. rm -f $RPM_INSTALL_PREFIX/var/avahi/log/* >/dev/null 2>&1 || true
  154. exit 0