cdb.spec 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. ##
  2. ## cdb.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2008 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 version
  24. %define V_cdb 0.75
  25. %define V_tinycdb 0.76
  26. %define V_cdb_file 0.96
  27. # package information
  28. Name: cdb
  29. Summary: Constant Database
  30. URL: http://cr.yp.to/cdb.html
  31. Vendor: D. J. Bernstein
  32. Packager: OpenPKG Foundation e.V.
  33. Distribution: OpenPKG Community
  34. Class: EVAL
  35. Group: Database
  36. License: Public Domain
  37. Version: %{V_cdb}
  38. Release: 20080323
  39. # package options
  40. %option with_perl no
  41. # list of sources
  42. Source0: http://cr.yp.to/cdb/cdb-%{version}.tar.gz
  43. Source1: http://www.corpit.ru/mjt/tinycdb/tinycdb_%{V_tinycdb}.tar.gz
  44. Source2: http://www.cpan.org/modules/by-module/CDB_File/CDB_File-%{V_cdb_file}.tar.gz
  45. # build information
  46. Prefix: %{l_prefix}
  47. BuildRoot: %{l_buildroot}
  48. BuildPreReq: OpenPKG, openpkg >= 20040130
  49. PreReq: OpenPKG, openpkg >= 20040130
  50. %if "%{with_perl}" == "yes"
  51. BuildPreReq: perl, perl-openpkg
  52. PreReq: perl
  53. %endif
  54. AutoReq: no
  55. AutoReqProv: no
  56. %description
  57. CDB is a fast, reliable, simple package for creating and reading
  58. constant databases. Its database structure provides fast
  59. lookups, low overhead, no random limits, fast atomic database
  60. replacement, and fast database dumps: CDB is designed to be used
  61. in mission-critical applications like e-mail. Database replacement
  62. is safe against system crashes. Readers don't have to pause during
  63. a rewrite. This package contains both the original CDB, the
  64. improved TinyCDB and optionally the CDB_File Perl API.
  65. %track
  66. prog cdb = {
  67. version = %{V_cdb}
  68. url = http://cr.yp.to/cdb/install.html
  69. regex = cdb-(__VER__)\.tar\.gz
  70. }
  71. prog cdb:tinycdb = {
  72. version = %{V_tinycdb}
  73. url = http://www.corpit.ru/mjt/tinycdb.html
  74. regex = tinycdb_(__VER__)\.tar\.gz
  75. }
  76. prog cdb:CDB_File = {
  77. version = %{V_cdb_file}
  78. url = http://www.cpan.org/modules/by-module/CDB_File/
  79. regex = CDB_File-(__VER__)\.tar\.gz
  80. }
  81. %prep
  82. %setup -q -c
  83. %setup -q -T -D -a 1
  84. %setup -q -T -D -a 2
  85. %build
  86. ( cd cdb-%{V_cdb}
  87. echo "$RPM_BUILD_ROOT%{l_prefix}" >conf-home
  88. echo "%{l_cc} %{l_cflags -O}" >conf-cc
  89. echo "%{l_cc} %{l_ldflags}" >conf-ld
  90. %{l_make} %{l_mflags} it
  91. ) || exit $?
  92. ( cd tinycdb-%{V_tinycdb}
  93. %{l_make} %{l_mflags} \
  94. CC="%{l_cc}" \
  95. CFLAGS="%{l_cflags -O}"
  96. ) || exit $?
  97. %if "%{with_perl}" == "yes"
  98. %{l_prefix}/bin/perl-openpkg prepare
  99. %{l_prefix}/bin/perl-openpkg -d CDB_File-%{V_cdb_file} configure build
  100. %endif
  101. %install
  102. rm -rf $RPM_BUILD_ROOT
  103. %{l_shtool} mkdir -f -p -m 755 \
  104. $RPM_BUILD_ROOT%{l_prefix}/bin \
  105. $RPM_BUILD_ROOT%{l_prefix}/lib \
  106. $RPM_BUILD_ROOT%{l_prefix}/include \
  107. $RPM_BUILD_ROOT%{l_prefix}/man/man1 \
  108. $RPM_BUILD_ROOT%{l_prefix}/man/man3 \
  109. $RPM_BUILD_ROOT%{l_prefix}/man/man5
  110. ( cd cdb-%{V_cdb}
  111. %{l_shtool} install -c -s -m 755 \
  112. cdbdump cdbget cdbmake cdbstats \
  113. $RPM_BUILD_ROOT%{l_prefix}/bin/
  114. %{l_shtool} install -c -m 644 \
  115. cdb.h $RPM_BUILD_ROOT%{l_prefix}/include/
  116. %{l_shtool} install -c -m 644 \
  117. cdb.a $RPM_BUILD_ROOT%{l_prefix}/lib/libcdb.a
  118. ) || exit $?
  119. ( cd tinycdb-%{V_tinycdb}
  120. %{l_shtool} install -c -s -m 755 \
  121. cdb $RPM_BUILD_ROOT%{l_prefix}/bin/tinycdb
  122. %{l_shtool} install -c -m 644 \
  123. cdb.1 $RPM_BUILD_ROOT%{l_prefix}/man/man1/tinycdb.1
  124. %{l_shtool} install -c -m 644 \
  125. cdb.3 $RPM_BUILD_ROOT%{l_prefix}/man/man3/tinycdb.3
  126. %{l_shtool} install -c -m 644 \
  127. cdb.5 $RPM_BUILD_ROOT%{l_prefix}/man/man5/
  128. %{l_shtool} install -c -m 644 \
  129. cdb.h $RPM_BUILD_ROOT%{l_prefix}/include/tinycdb.h
  130. %{l_shtool} install -c -m 644 \
  131. libcdb.a $RPM_BUILD_ROOT%{l_prefix}/lib/libtinycdb.a
  132. ) || exit $?
  133. %if "%{with_perl}" == "yes"
  134. %{l_prefix}/bin/perl-openpkg -d CDB_File-%{V_cdb_file} install
  135. %{l_prefix}/bin/perl-openpkg -F perl-openpkg-files fixate cleanup
  136. %else
  137. >perl-openpkg-files
  138. %endif
  139. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  140. %{l_files_std} `cat perl-openpkg-files`
  141. %files -f files
  142. %clean
  143. rm -rf $RPM_BUILD_ROOT