mysql.spec 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. ##
  2. ## mysql.spec -- OpenPKG RPM Specification
  3. ## Copyright (c) 2000-2002 Cable & Wireless Deutschland GmbH
  4. ## Copyright (c) 2000-2002 The OpenPKG Project <http://www.openpkg.org/>
  5. ## Copyright (c) 2000-2002 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 options
  26. %ifndef with_berkeleydb
  27. %define with_berkeleydb yes
  28. %endif
  29. %ifndef with_innobase
  30. %define with_innobase no
  31. %endif
  32. %ifndef with_gemini
  33. %define with_gemini no
  34. %endif
  35. %if %{with_berkeleydb} == "yes"
  36. %define mysql_bdb_cache_size 8M
  37. %define mysql_bdb_log_buffer_size 32k
  38. %define mysql_bdb_max_lock 10000
  39. %else
  40. %define mysql_bdb_cache_size 0
  41. %define mysql_bdb_log_buffer_size 0
  42. %define mysql_bdb_max_lock 0
  43. %endif
  44. %if %{with_berkeleydb} == "yes" || %{with_innobase} == "yes" || %{with_gemini} == "yes"
  45. %define mysqld mysqld
  46. %else
  47. %define mysqld mysqld-max
  48. %endif
  49. # package information
  50. Name: mysql
  51. Summary: Fast Relational Database Management System
  52. URL: http://www.mysql.com/
  53. Vendor: MySQL AB
  54. Packager: The OpenPKG Project
  55. Distribution: OpenPKG [BASE]
  56. Group: Database
  57. License: GPL
  58. Version: 3.23.54
  59. Release: 20021212
  60. # list of sources
  61. Source0: http://sunsite.informatik.rwth-aachen.de/mysql/Downloads/MySQL-3.23/mysql-%{version}.tar.gz
  62. Source1: my.cnf
  63. Source2: rc.mysql
  64. Patch0: mysql.patch
  65. Patch1: mysql-initdb.patch
  66. # build information
  67. Prefix: %{l_prefix}
  68. BuildRoot: %{l_buildroot}
  69. BuildPreReq: OpenPKG, openpkg >= 20021204, gcc
  70. PreReq: OpenPKG, openpkg >= 20021204
  71. AutoReq: no
  72. AutoReqProv: no
  73. %description
  74. MySQL is a multi-user Relational Database Management System (RDBMS),
  75. which is controlled through Structured Query Language (SQL) operating in
  76. full multi-threading mode. The main goals of MySQL are speed, robustness
  77. and ease of use. MySQL was originally developed because of the need for
  78. a SQL server that could handle very big databases with magnitude higher
  79. speed than what any database vendor could offer.
  80. Options:
  81. --define 'with_berkeleydb %{with_berkeleydb}' \
  82. --define 'with_innobase %{with_innobase}' \
  83. --define 'with_gemini %{with_gemini}'
  84. %prep
  85. %setup -q
  86. %patch0 -p1
  87. %patch1 -p1
  88. %build
  89. # determine additional configure options
  90. case "%{l_target}" in
  91. *-freebsd* ) opt="--with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static" ;;
  92. *-linux* ) opt="--with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static" ;;
  93. *-solaris* ) opt="" ;; # static compiling doesn't work under Solaris because of missing libdl.a
  94. esac
  95. # configure source tree
  96. CC="%{l_cc}" \
  97. CXX="%{l_cxx}" \
  98. CFLAGS="%{l_cflags -O}" \
  99. CXXFLAGS="%{l_cxxflags -O}" \
  100. ./configure \
  101. --prefix=%{l_prefix} \
  102. --sysconfdir=%{l_prefix}/etc/mysql \
  103. --localstatedir=%{l_prefix}/var/mysql \
  104. --with-unix-socket-path=%{l_prefix}/var/mysql/mysql.sock \
  105. --with-mysqld-user=%{l_musr} \
  106. --enable-thread-safe-client \
  107. %if "%{with_berkeleydb}" == "yes"
  108. --with-berkeley-db \
  109. %endif
  110. %if "%{with_innobase}" == "yes"
  111. --with-innodb \
  112. %endif
  113. %if "%{with_gemini}" == "yes"
  114. --with-gemini \
  115. %endif
  116. --with-low-memory \
  117. --disable-shared \
  118. $opt
  119. # build source tree
  120. %{l_make} %{l_mflags -O}
  121. %install
  122. rm -rf $RPM_BUILD_ROOT
  123. # patch init script
  124. %{l_shtool} subst \
  125. -e 's;@l_prefix@;%{l_prefix};g' \
  126. $RPM_BUILD_ROOT%{l_prefix}/scripts/mysql_install_db.sh
  127. # perform standard installation procedure
  128. %{l_make} %{l_mflags} install \
  129. AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT" \
  130. DESTDIR=$RPM_BUILD_ROOT
  131. # KLUDGE: my_dir.h is not installed!
  132. %{l_shtool} install -c -m 644 \
  133. include/my_dir.h $RPM_BUILD_ROOT%{l_prefix}/include/mysql/
  134. # strip installation area
  135. rm -rf $RPM_BUILD_ROOT%{l_prefix}/mysql-test
  136. rm -rf $RPM_BUILD_ROOT%{l_prefix}/sql-bench
  137. rm -f $RPM_BUILD_ROOT%{l_prefix}/info/dir
  138. rm -f $RPM_BUILD_ROOT%{l_prefix}/share/mysql/mysql-%{version}.spec
  139. rm -f $RPM_BUILD_ROOT%{l_prefix}/share/mysql/binary-configure
  140. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* 2> /dev/null || true
  141. strip $RPM_BUILD_ROOT%{l_prefix}/libexec/* 2> /dev/null || true
  142. # install global configuration
  143. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/mysql
  144. %{l_shtool} install -c -m 644 \
  145. -e 's;@l_prefix@;%{l_prefix};g' \
  146. -e 's;@l_rusr@;%{l_rusr};g' \
  147. -e 's;@mysql_bdb_cache_size@;%{mysql_bdb_cache_size};g' \
  148. -e 's;@mysql_bdb_log_buffer_size@;%{mysql_bdb_log_buffer_size};g' \
  149. -e 's;@mysql_bdb_max_lock@;%{mysql_bdb_max_lock};g' \
  150. %{SOURCE my.cnf} \
  151. $RPM_BUILD_ROOT%{l_prefix}/etc/mysql/
  152. %{l_shtool} install -c -m 600 \
  153. %{SOURCE my.pwd} \
  154. $RPM_BUILD_ROOT%{l_prefix}/etc/mysql/
  155. # install run-command script
  156. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  157. %{l_shtool} install -c -m 755 \
  158. -e 's;@l_prefix@;%{l_prefix};g' \
  159. -e 's;@l_rusr@;%{l_rusr};g' \
  160. -e 's;@l_rgrp@;%{l_rgrp};g' \
  161. -e 's;@mysqld@;%{mysqld};g' \
  162. %{SOURCE rc.mysql} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  163. # make sure the database directory exists
  164. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/var/mysql
  165. # determine the package files
  166. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  167. %{l_files_std} \
  168. '%config %{l_prefix}/etc/mysql/my.cnf' \
  169. '%config %{l_prefix}/etc/mysql/my.pwd'
  170. %files -f files
  171. %clean
  172. rm -rf $RPM_BUILD_ROOT
  173. %post
  174. $RPM_INSTALL_PREFIX/bin/mysql_install_db
  175. chown %{l_rusr}:%{l_rgrp} \
  176. $RPM_INSTALL_PREFIX/etc/mysql/my.cnf \
  177. $RPM_INSTALL_PREFIX/etc/mysql/my.pwd
  178. chown -R %{l_rusr}:%{l_rgrp} $RPM_INSTALL_PREFIX/var/mysql/
  179. # display information about next steps
  180. ( echo "The MySQL package includes automated maintenance procedures"
  181. echo "that require administrator access to the database. For this"
  182. echo "to work you must keep a copy (plain text) of the administrator"
  183. echo "account in '$RPM_INSTALL_PREFIX/etc/mysql/my.pwd'."
  184. ) | %{l_rpmtool} msg -b -t notice