mysql41.spec 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. ##
  2. ## mysql41.spec -- OpenPKG RPM Specification
  3. ## Copyright (c) 2000-2003 The OpenPKG Project <http://www.openpkg.org/>
  4. ## Copyright (c) 2000-2003 Ralf S. Engelschall <rse@engelschall.com>
  5. ## Copyright (c) 2000-2003 Cable & Wireless <http://www.cw.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 version
  26. %define V_major 4.1
  27. %define V_minor 1
  28. %define V_mysql %{V_major}.%{V_minor}-alpha
  29. %define V_opkg %{V_major}.%{V_minor}
  30. # package information
  31. Name: mysql41
  32. Summary: Fast Relational Database Management System
  33. URL: http://www.mysql.com/
  34. Vendor: MySQL AB
  35. Packager: The OpenPKG Project
  36. Distribution: OpenPKG [BASE]
  37. Group: Database
  38. License: GPL
  39. Version: %{V_opkg}
  40. Release: 20040105
  41. # package options
  42. %option with_berkeleydb yes
  43. %option with_innobase no
  44. # list of sources
  45. Source0: http://sunsite.informatik.rwth-aachen.de/mysql/Downloads/MySQL-%{V_major}/mysql-%{V_mysql}.tar.gz
  46. Source1: my.cnf
  47. Source2: my.pwd
  48. Source3: rc.mysql
  49. Patch0: mysql41.patch
  50. # build information
  51. Prefix: %{l_prefix}
  52. BuildRoot: %{l_buildroot}
  53. BuildPreReq: OpenPKG, openpkg >= 20030909, perl, gcc
  54. PreReq: OpenPKG, openpkg >= 20030909, perl
  55. BuildPreReq: zlib
  56. PreReq: zlib
  57. AutoReq: no
  58. AutoReqProv: no
  59. Provides: mysql = %{version}-%{release}
  60. %description
  61. MySQL is a multi-user Relational Database Management System (RDBMS),
  62. which is controlled through Structured Query Language (SQL) operating in
  63. full multi-threading mode. The main goals of MySQL are speed, robustness
  64. and ease of use. MySQL was originally developed because of the need for
  65. a SQL server that could handle very big databases with magnitude higher
  66. speed than what any database vendor could offer.
  67. NOTICE: This package contains the new and forthcoming MySQL 4.1
  68. version. Please use the "mysql" package, containing the current
  69. stable MySQL 4.0 version.
  70. %prep
  71. %setup -q -n mysql-%{V_mysql}
  72. exit 0
  73. %patch -p0
  74. %build
  75. # patch file search path
  76. %{l_shtool} subst %{l_value -s -a} \
  77. mysys/default.c
  78. # determine additional configure options
  79. case "%{l_platform -t}" in
  80. *-freebsd* ) opt="--with-client-ldflags=-static --with-mysqld-ldflags=-static" ;;
  81. *-linux* ) opt="--with-client-ldflags=-static --with-mysqld-ldflags=-static" ;;
  82. *-sunos* ) opt="--with-client-ldflags=-static --with-mysqld-ldflags=-static" ;;
  83. esac
  84. # configure source tree
  85. CC="%{l_cc}" \
  86. CXX="%{l_cxx}" \
  87. CFLAGS="%{l_cflags -O}" \
  88. CXXFLAGS="%{l_cxxflags -O}" \
  89. ./configure \
  90. --prefix=%{l_prefix} \
  91. --sysconfdir=%{l_prefix}/etc/mysql \
  92. --localstatedir=%{l_prefix}/var/mysql \
  93. --libexecdir=%{l_prefix}/libexec/mysql \
  94. --with-unix-socket-path=%{l_prefix}/var/mysql/mysql.sock \
  95. --with-mysqld-user=%{l_musr} \
  96. --enable-thread-safe-client \
  97. %if "%{with_berkeleydb}" == "yes"
  98. --with-berkeley-db \
  99. %endif
  100. %if "%{with_innobase}" == "no"
  101. --without-innodb \
  102. %endif
  103. --with-named-z-libs=no \
  104. --with-low-memory \
  105. --disable-shared \
  106. $opt
  107. # build source tree
  108. %{l_make} %{l_mflags}
  109. %install
  110. rm -rf $RPM_BUILD_ROOT
  111. # patch init script
  112. %{l_shtool} subst %{l_value -s -a} \
  113. scripts/mysql_install_db.sh
  114. # perform standard installation procedure
  115. %{l_make} %{l_mflags} install \
  116. AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT" \
  117. DESTDIR=$RPM_BUILD_ROOT
  118. # move utility 'replace', msql2mysql is patched for new path
  119. mv $RPM_BUILD_ROOT%{l_prefix}/bin/replace \
  120. $RPM_BUILD_ROOT%{l_prefix}/libexec/mysql/
  121. # strip installation area
  122. rm -rf $RPM_BUILD_ROOT%{l_prefix}/mysql-test
  123. rm -rf $RPM_BUILD_ROOT%{l_prefix}/sql-bench
  124. rm -f $RPM_BUILD_ROOT%{l_prefix}/info/dir
  125. rm -f $RPM_BUILD_ROOT%{l_prefix}/share/mysql/mysql*.spec
  126. rm -f $RPM_BUILD_ROOT%{l_prefix}/share/mysql/binary-configure
  127. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* 2>/dev/null || true
  128. strip $RPM_BUILD_ROOT%{l_prefix}/libexec/mysql/* 2>/dev/null || true
  129. # determine default parameters
  130. %if "%{with_berkeleydb}" == "yes"
  131. l_mysql_bdb_cache_size=8M
  132. l_mysql_bdb_log_buffer_size=32k
  133. l_mysql_bdb_max_lock=10000
  134. %else
  135. l_mysql_bdb_cache_size=0
  136. l_mysql_bdb_log_buffer_size=0
  137. l_mysql_bdb_max_lock=0
  138. %endif
  139. %if "%{with_berkeleydb}" == "yes" || "%{with_innobase}" == "yes"
  140. l_mysqld=mysqld
  141. %else
  142. l_mysqld=mysqld-max
  143. %endif
  144. # install global configuration
  145. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/mysql
  146. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  147. -e "s;@l_mysql_bdb_cache_size@;${l_mysql_bdb_cache_size};g" \
  148. -e "s;@l_mysql_bdb_log_buffer_size@;${l_mysql_bdb_log_buffer_size};g" \
  149. -e "s;@l_mysql_bdb_max_lock@;${l_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 %{l_value -s -a} \
  158. -e "s;@l_mysqld@;${l_mysqld};g" \
  159. %{SOURCE rc.mysql} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  160. # make sure the database directory exists
  161. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/var/mysql
  162. # determine the package files
  163. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  164. %{l_files_std} \
  165. '%config %{l_prefix}/etc/mysql/my.cnf' \
  166. '%config %{l_prefix}/etc/mysql/my.pwd' \
  167. '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/mysql'
  168. %files -f files
  169. %clean
  170. rm -rf $RPM_BUILD_ROOT
  171. %pre
  172. # before upgrade, save status and stop service
  173. [ $1 -eq 2 ] || exit 0
  174. eval `%{l_rc} mysql status 2>/dev/null | tee %{l_tmpfile}`
  175. %{l_rc} mysql stop 2>/dev/null
  176. exit 0
  177. %post
  178. if [ $1 -eq 1 ]; then
  179. # after install, create initial database
  180. $RPM_INSTALL_PREFIX/bin/mysql_install_db \
  181. --defaults-file=$RPM_INSTALL_PREFIX/etc/mysql/my.cnf
  182. chown %{l_rusr}:%{l_rgrp} \
  183. $RPM_INSTALL_PREFIX/etc/mysql/my.cnf \
  184. $RPM_INSTALL_PREFIX/etc/mysql/my.pwd
  185. chown -R %{l_rusr}:%{l_rgrp} $RPM_INSTALL_PREFIX/var/mysql/*
  186. ( echo "The MySQL package includes automated maintenance procedures"
  187. echo "that require administrator access to the database. For this"
  188. echo "to work you must keep a copy (plain text) of the administrator"
  189. echo "account in '$RPM_INSTALL_PREFIX/etc/mysql/my.pwd'."
  190. ) | %{l_rpmtool} msg -b -t notice
  191. fi
  192. if [ $1 -eq 2 ]; then
  193. # after upgrade, restore status
  194. { eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile}; true; } >/dev/null 2>&1
  195. [ ".$mysql_active" = .yes ] && %{l_rc} mysql start
  196. fi
  197. exit 0
  198. %preun
  199. # before erase, stop service and remove log files
  200. [ $1 -eq 0 ] || exit 0
  201. %{l_rc} mysql stop 2>/dev/null
  202. rm -f $RPM_INSTALL_PREFIX/var/mysql/*.log* >/dev/null 2>&1 || true
  203. rm -f $RPM_INSTALL_PREFIX/var/mysql/*.err* >/dev/null 2>&1 || true
  204. exit 0