monotone.spec 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. ##
  2. ## monotone.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
  4. ## Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
  5. ##
  6. ## Permission to use, copy, modify, and distribute this software for
  7. ## any purpose with or without fee is hereby granted, provided that
  8. ## the above copyright notice and this permission notice appear in all
  9. ## copies.
  10. ##
  11. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  12. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  13. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  14. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  15. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  16. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  17. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  18. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  19. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  20. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  21. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  22. ## SUCH DAMAGE.
  23. ##
  24. # package information
  25. Name: monotone
  26. Summary: Distributed Version Control System
  27. URL: http://monotone.ca/
  28. Vendor: Graydon Hoare et al.
  29. Packager: OpenPKG Foundation e.V.
  30. Distribution: OpenPKG Community
  31. Class: EVAL
  32. Group: SCM
  33. License: GPL
  34. Version: 0.37
  35. Release: 20071030
  36. # package options
  37. %option with_rse yes
  38. # list of sources
  39. Source0: http://monotone.ca/downloads/%{version}/monotone-%{version}.tar.gz
  40. Source1: rc.monotone
  41. Source3: monotone-setup.sh
  42. Source4: monotone-colorize.pl
  43. Source5: monotone-colorize.bashrc
  44. Source6: monotone.bashrc
  45. Patch0: monotone.patch
  46. Patch1: monotone.patch.rse
  47. # build information
  48. Prefix: %{l_prefix}
  49. BuildRoot: %{l_buildroot}
  50. BuildPreReq: OpenPKG, openpkg >= 20040130, gcc, gcc::with_cxx = yes
  51. PreReq: OpenPKG, openpkg >= 20040130, apg, diffutils, perl, perl-mail, perl-term, less
  52. BuildPreReq: boost, zlib, pcre
  53. PreReq: boost, zlib, pcre
  54. AutoReq: no
  55. AutoReqProv: no
  56. %description
  57. Monotone is a distributed version control system. It provides
  58. a simple, single-file RDBMS based transactional version store,
  59. with fully disconnected operation and an efficient peer-to-peer
  60. synchronization protocol. It understands history-sensitive merging,
  61. lightweight branches, integrated code review and third-party
  62. testing. It uses cryptographic version naming and client-side RSA
  63. certificates.
  64. %track
  65. prog monotone = {
  66. version = %{version}
  67. url = http://monotone.ca/downloads/
  68. regex = (\d+\.\d+)/
  69. url = http://monotone.ca/downloads/__NEWVER__/
  70. regex = monotone-(__VER__)\.tar\.gz
  71. }
  72. %prep
  73. %setup -q
  74. %patch -p0
  75. %if "%{with_rse}" == "yes"
  76. %patch -p0 -P 1
  77. %endif
  78. %build
  79. # configure program
  80. CC="%{l_cc}" \
  81. CXX="%{l_cxx}" \
  82. CFLAGS="%{l_cflags -O}" \
  83. CXXFLAGS="%{l_cxxflags -O}" \
  84. %if "%{with_rse}" == "yes"
  85. CPPFLAGS="%{l_cppflags} -DRSE" \
  86. %else
  87. CPPFLAGS="%{l_cppflags}" \
  88. %endif
  89. LDFLAGS="%{l_ldflags}" \
  90. ./configure \
  91. --prefix=%{l_prefix} \
  92. --infodir=%{l_prefix}/info \
  93. --mandir=%{l_prefix}/man \
  94. --enable-static-boost=%{l_prefix} \
  95. --with-system-pcre \
  96. --disable-nls
  97. # build program
  98. %{l_make} %{l_mflags -O}
  99. %install
  100. # install program
  101. rm -rf $RPM_BUILD_ROOT
  102. %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
  103. # strip down installation
  104. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  105. mv $RPM_BUILD_ROOT%{l_prefix}/share/doc/monotone \
  106. $RPM_BUILD_ROOT%{l_prefix}/share/monotone
  107. rm -f $RPM_BUILD_ROOT%{l_prefix}/info/dir
  108. rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/locale
  109. rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/doc
  110. # create additional directories for server operation
  111. %{l_shtool} mkdir -f -p -m 755 \
  112. $RPM_BUILD_ROOT%{l_prefix}/etc/monotone \
  113. $RPM_BUILD_ROOT%{l_prefix}/var/monotone
  114. # install contrib tools
  115. %{l_shtool} install -c -m 755 \
  116. -e 's;#! /usr/bin/perl;#!%{l_prefix}/bin/perl;g' \
  117. -e 's;\(monotone-notify\)\.pl;\1;g' \
  118. contrib/monotone-notify.pl \
  119. $RPM_BUILD_ROOT%{l_prefix}/bin/monotone-notify
  120. %{l_shtool} install -c -m 644 \
  121. contrib/monotone.bash_completion \
  122. $RPM_BUILD_ROOT%{l_prefix}/etc/monotone/monotone-complete.bashrc
  123. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  124. %{SOURCE monotone-colorize.bashrc} \
  125. $RPM_BUILD_ROOT%{l_prefix}/etc/monotone/
  126. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  127. %{SOURCE monotone-colorize.pl} \
  128. $RPM_BUILD_ROOT%{l_prefix}/bin/monotone-colorize
  129. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  130. %{SOURCE monotone.bashrc} \
  131. $RPM_BUILD_ROOT%{l_prefix}/etc/monotone/
  132. # install setup script
  133. %{l_shtool} mkdir -f -p -m 755 \
  134. $RPM_BUILD_ROOT%{l_prefix}/sbin
  135. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  136. -e 's;@l_shtool@;%{l_shtool};g' \
  137. %{SOURCE monotone-setup.sh} \
  138. $RPM_BUILD_ROOT%{l_prefix}/sbin/monotone-setup
  139. # install run-command script
  140. %{l_shtool} mkdir -f -p -m 755 \
  141. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  142. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  143. %{SOURCE rc.monotone} \
  144. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  145. # determine installation files
  146. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  147. %{l_files_std} \
  148. '%config %{l_prefix}/etc/monotone/*' \
  149. '%doc %{l_prefix}/share/monotone/*' \
  150. '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/monotone'
  151. %files -f files
  152. %clean
  153. rm -rf $RPM_BUILD_ROOT
  154. %post
  155. if [ $1 -eq 1 ]; then
  156. # display initial hint
  157. ( echo "If you want to use the Monotone daemon for serving"
  158. echo "a central permanently available database, run:"
  159. echo " $RPM_INSTALL_PREFIX/sbin/monotone-setup install \\ "
  160. echo " [<server-mail-address> [<server-password>]]"
  161. echo "and put into your $RPM_INSTALL_PREFIX/etc/rc.conf at least:"
  162. echo " monotone_daemon=\"yes\""
  163. echo " monotone_daemon_host=\"<server-ip-address>\""
  164. ) | %{l_rpmtool} msg -b -t notice
  165. elif [ $1 -eq 2 ]; then
  166. # after upgrade, restart service
  167. eval `%{l_rc} monotone status 2>/dev/null`
  168. [ ".$monotone_active" = .yes ] && %{l_rc} monotone restart
  169. fi
  170. exit 0
  171. %preun
  172. if [ $1 -eq 0 ]; then
  173. # before erase, stop service and remove log files
  174. %{l_rc} monotone stop 2>/dev/null
  175. $RPM_INSTALL_PREFIX/sbin/monotone-setup uninstall >/dev/null 2>&1 || true
  176. rm -f $RPM_INSTALL_PREFIX/var/monotone/monotone.log* >/dev/null 2>&1 || true
  177. fi
  178. exit 0