couchdb.spec 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. ##
  2. ## couchdb.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2011 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. # package information
  24. Name: couchdb
  25. Summary: Schema-Less Web Database
  26. URL: http://couchdb.apache.org/
  27. Vendor: Apache Software Foundation
  28. Packager: OpenPKG Foundation e.V.
  29. Distribution: OpenPKG Community
  30. Class: EVAL
  31. Group: Database
  32. License: Apache
  33. Version: 1.1.0
  34. Release: 20110607
  35. # list of sources
  36. Source0: http://www.apache.org/dist/couchdb/%{version}/apache-couchdb-%{version}.tar.gz
  37. Source1: couchdb.ini
  38. Source2: rc.couchdb
  39. Patch0: couchdb.patch
  40. # build information
  41. BuildPreReq: OpenPKG, openpkg >= 20100101
  42. PreReq: OpenPKG, openpkg >= 20100101
  43. BuildPreReq: erlang, js, icu, curl
  44. PreReq: erlang, js, icu, curl
  45. %description
  46. Apache CouchDB is a document-oriented database that can be queried
  47. and indexed in a MapReduce fashion using JavaScript. CouchDB
  48. also offers incremental replication with bi-directional conflict
  49. detection and resolution. CouchDB provides a RESTful JSON API than
  50. can be accessed from any environment that allows HTTP requests.
  51. There are myriad third-party client libraries that make this even
  52. easier from your programming language of choice. CouchDBs built in
  53. Web administration console speaks directly to the database using
  54. HTTP requests issued from your browser.
  55. %track
  56. prog couchdb = {
  57. version = %{version}
  58. url = http://couchdb.apache.org/downloads.html
  59. regex = apache-couchdb-(__VER__)\.tar\.gz
  60. }
  61. %prep
  62. %setup -q -n apache-couchdb-%{version}
  63. %patch -p0
  64. %build
  65. # configure program
  66. CC="%{l_cc}" \
  67. CFLAGS="%{l_cflags -O}" \
  68. CPPFLAGS="%{l_cppflags js icu .} -I%{l_prefix}/lib/erlang/usr/include" \
  69. LDFLAGS="%{l_ldflags erlang/usr/lib}" \
  70. ./configure \
  71. --prefix=%{l_prefix} \
  72. --mandir=%{l_prefix}/man \
  73. --localstatedir=%{l_prefix}/var/couchdb \
  74. --with-erlang=%{l_prefix} \
  75. --with-js-include=%{l_prefix}/include/js \
  76. --with-js-lib=%{l_prefix}/lib \
  77. --with-openssl-bin-dir=%{l_prefix}/bin \
  78. --disable-init \
  79. --disable-launchd
  80. # build program
  81. %{l_make} %{l_mflags}
  82. %install
  83. # install program
  84. %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
  85. # strip down installation
  86. rm -rf $RPM_BUILD_ROOT%{l_prefix}/etc/logrotate.d
  87. rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/doc
  88. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  89. # install default confguration
  90. %{l_shtool} subst \
  91. -e 's;^\(database_dir =\).*;\1 %{l_prefix}/var/couchdb/db;' \
  92. -e 's;^\(view_index_dir =\).*;\1 %{l_prefix}/var/couchdb/db;' \
  93. -e 's;^\(uri_file =\).*;\1 %{l_prefix}/var/couchdb/db/couch.uri;' \
  94. -e 's;^\(file =\).*;\1 %{l_prefix}/var/couchdb/log/couchdb.log;' \
  95. $RPM_BUILD_ROOT%{l_prefix}/etc/couchdb/default.ini
  96. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  97. %{SOURCE couchdb.ini} \
  98. $RPM_BUILD_ROOT%{l_prefix}/etc/couchdb/local.ini
  99. # create runtime directories
  100. rm -rf $RPM_BUILD_ROOT%{l_prefix}/var/couchdb/* >/dev/null 2>&1 || true
  101. %{l_shtool} mkdir -f -p -m 755 \
  102. $RPM_BUILD_ROOT%{l_prefix}/var/couchdb/db \
  103. $RPM_BUILD_ROOT%{l_prefix}/var/couchdb/log \
  104. $RPM_BUILD_ROOT%{l_prefix}/var/couchdb/run
  105. # install run-command script
  106. %{l_shtool} mkdir -f -p -m 755 \
  107. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  108. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  109. %{SOURCE rc.couchdb} \
  110. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  111. # determine installation files
  112. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  113. %{l_files_std} \
  114. '%config %{l_prefix}/etc/couchdb/*.ini' \
  115. '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/couchdb/*'
  116. %files -f files
  117. %clean
  118. %post
  119. if [ $1 -eq 1 ]; then
  120. # initial jo upgrade, restart service
  121. ( echo "Access CouchDB via URL http://127.0.0.1:5984/ and"
  122. echo "interactively via its Futon Web User Interface unter"
  123. echo "the URL http://127.0.0.1:5984/_utils/"
  124. ) | %{l_rpmtool} msg -b -t notice
  125. elif [ $1 -eq 2 ]; then
  126. # after upgrade, restart service
  127. eval `%{l_rc} couchdb status 2>/dev/null`
  128. [ ".$couchdb_active" = .yes ] && %{l_rc} couchdb restart
  129. fi
  130. exit 0
  131. %preun
  132. if [ $1 -eq 0 ]; then
  133. # before erase, stop service and remove log files
  134. %{l_rc} couchdb stop 2>/dev/null
  135. rm -f $RPM_INSTALL_PREFIX/var/couchdb/log/* >/dev/null 2>&1 || true
  136. rm -f $RPM_INSTALL_PREFIX/var/couchdb/run/* >/dev/null 2>&1 || true
  137. rm -rf $RPM_INSTALL_PREFIX/var/couchdb/db/* >/dev/null 2>&1 || true
  138. fi
  139. exit 0