mysql3.spec 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. ##
  2. ## mysql3.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 3.23
  27. %define V_minor 57
  28. # package information
  29. Name: mysql3
  30. Summary: Fast Relational Database Management System
  31. URL: http://www.mysql.com/
  32. Vendor: MySQL AB
  33. Packager: The OpenPKG Project
  34. Distribution: OpenPKG [PLUS]
  35. Group: Database
  36. License: GPL
  37. Version: %{V_major}.%{V_minor}
  38. Release: 20030721
  39. # package options
  40. %option with_berkeleydb yes
  41. %option with_innobase no
  42. %option with_gemini no
  43. # list of sources
  44. Source0: http://sunsite.informatik.rwth-aachen.de/mysql/Downloads/MySQL-%{V_major}/mysql-%{version}.tar.gz
  45. Source1: my.cnf
  46. Source2: my.pwd
  47. Source3: rc.mysql3
  48. Patch0: mysql3.patch
  49. # build information
  50. Prefix: %{l_prefix}
  51. BuildRoot: %{l_buildroot}
  52. BuildPreReq: OpenPKG, openpkg >= 20030718, gcc, zlib
  53. PreReq: OpenPKG, openpkg >= 20030718, zlib
  54. AutoReq: no
  55. AutoReqProv: no
  56. Provides: mysql = %{version}-%{release}
  57. %description
  58. MySQL is a multi-user Relational Database Management System (RDBMS),
  59. which is controlled through Structured Query Language (SQL) operating in
  60. full multi-threading mode. The main goals of MySQL are speed, robustness
  61. and ease of use. MySQL was originally developed because of the need for
  62. a SQL server that could handle very big databases with magnitude higher
  63. speed than what any database vendor could offer.
  64. NOTICE: This package contains the old and already deprecated MySQL
  65. 3.x version. Please use the "mysql" package, containing the current
  66. stable MySQL 4.x version.
  67. %prep
  68. %setup -q -n mysql-%{version}
  69. %patch -p0
  70. # fix broken conftest
  71. %{l_shtool} subst \
  72. -e 's; close(file); fclose(file);g' \
  73. configure
  74. %build
  75. # patch file search path
  76. %{l_shtool} subst %{l_value -s -a} \
  77. mysys/default.c
  78. # patch socklen_t for Sol6
  79. case "%{l_target}" in
  80. *-solaris2.6* )
  81. %{l_shtool} subst \
  82. -e 's;socklen_t;size_t;g' \
  83. acinclude.m4 \
  84. aclocal.m4 \
  85. configure \
  86. include/global.h \
  87. include/my_global.h \
  88. libmysql/acinclude.m4
  89. %{l_shtool} subst \
  90. -e 's;socklen_t;size_socket;g' \
  91. sql/mini_client.cc \
  92. sql/mysqld.cc
  93. ;;
  94. esac
  95. # determine additional configure options
  96. case "%{l_target}" in
  97. *-freebsd* ) opt="--with-client-ldflags=-static --with-mysqld-ldflags=-static" ;;
  98. *-linux* ) opt="--with-client-ldflags=-static --with-mysqld-ldflags=-static" ;;
  99. *-solaris* ) opt="--with-client-ldflags=-static --with-mysqld-ldflags=-static" ;;
  100. esac
  101. # only use system default path
  102. unset LD_LIBRARY_PATH || true
  103. # configure source tree
  104. CC="%{l_cc}" \
  105. CXX="%{l_cxx}" \
  106. CFLAGS="%{l_cflags -O}" \
  107. CXXFLAGS="%{l_cxxflags -O}" \
  108. ./configure \
  109. --prefix=%{l_prefix} \
  110. --sysconfdir=%{l_prefix}/etc/mysql \
  111. --localstatedir=%{l_prefix}/var/mysql \
  112. --libexecdir=%{l_prefix}/libexec/mysql \
  113. --with-unix-socket-path=%{l_prefix}/var/mysql/mysql.sock \
  114. --with-mysqld-user=%{l_musr} \
  115. --enable-thread-safe-client \
  116. %if "%{with_berkeleydb}" == "yes"
  117. --with-berkeley-db \
  118. %endif
  119. %if "%{with_innobase}" == "yes"
  120. --with-innodb \
  121. %endif
  122. %if "%{with_gemini}" == "yes"
  123. --with-gemini \
  124. %endif
  125. --with-low-memory \
  126. --disable-shared \
  127. $opt
  128. # build source tree
  129. %{l_make} %{l_mflags -O}
  130. %install
  131. rm -rf $RPM_BUILD_ROOT
  132. # patch init script
  133. %{l_shtool} subst %{l_value -s -a} \
  134. scripts/mysql_install_db.sh
  135. # perform standard installation procedure
  136. %{l_make} %{l_mflags} install \
  137. AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT" \
  138. DESTDIR=$RPM_BUILD_ROOT
  139. # KLUDGE: my_dir.h is not installed!
  140. %{l_shtool} install -c -m 644 \
  141. include/my_dir.h $RPM_BUILD_ROOT%{l_prefix}/include/mysql/
  142. # strip installation area
  143. rm -rf $RPM_BUILD_ROOT%{l_prefix}/mysql-test
  144. rm -rf $RPM_BUILD_ROOT%{l_prefix}/sql-bench
  145. rm -f $RPM_BUILD_ROOT%{l_prefix}/info/dir
  146. rm -f $RPM_BUILD_ROOT%{l_prefix}/share/mysql/mysql-%{version}.spec
  147. rm -f $RPM_BUILD_ROOT%{l_prefix}/share/mysql/binary-configure
  148. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* 2>/dev/null || true
  149. strip $RPM_BUILD_ROOT%{l_prefix}/libexec/mysql/* 2>/dev/null || true
  150. # determine default parameters
  151. %if "%{with_berkeleydb}" == "yes"
  152. l_mysql_bdb_cache_size=8M
  153. l_mysql_bdb_log_buffer_size=32k
  154. l_mysql_bdb_max_lock=10000
  155. %else
  156. l_mysql_bdb_cache_size=0
  157. l_mysql_bdb_log_buffer_size=0
  158. l_mysql_bdb_max_lock=0
  159. %endif
  160. %if "%{with_berkeleydb}" == "yes" || "%{with_innobase}" == "yes" || "%{with_gemini}" == "yes"
  161. l_mysqld=mysqld
  162. %else
  163. l_mysqld=mysqld-max
  164. %endif
  165. # install global configuration
  166. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/mysql
  167. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  168. -e "s;@l_mysql_bdb_cache_size@;${l_mysql_bdb_cache_size};g" \
  169. -e "s;@l_mysql_bdb_log_buffer_size@;${l_mysql_bdb_log_buffer_size};g" \
  170. -e "s;@l_mysql_bdb_max_lock@;${l_mysql_bdb_max_lock};g" \
  171. %{SOURCE my.cnf} \
  172. $RPM_BUILD_ROOT%{l_prefix}/etc/mysql/
  173. %{l_shtool} install -c -m 600 \
  174. %{SOURCE my.pwd} \
  175. $RPM_BUILD_ROOT%{l_prefix}/etc/mysql/
  176. # install run-command script
  177. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  178. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  179. -e "s;@l_mysqld@;${l_mysqld};g" \
  180. %{SOURCE rc.mysql3} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  181. # make sure the database directory exists
  182. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/var/mysql
  183. # determine the package files
  184. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  185. %{l_files_std} \
  186. '%config %{l_prefix}/etc/mysql/my.cnf' \
  187. '%config %{l_prefix}/etc/mysql/my.pwd'
  188. %files -f files
  189. %clean
  190. rm -rf $RPM_BUILD_ROOT
  191. %post
  192. # create initial database
  193. $RPM_INSTALL_PREFIX/bin/mysql_install_db \
  194. --defaults-file=$RPM_INSTALL_PREFIX/etc/mysql/my.cnf
  195. chown %{l_rusr}:%{l_rgrp} \
  196. $RPM_INSTALL_PREFIX/etc/mysql/my.cnf \
  197. $RPM_INSTALL_PREFIX/etc/mysql/my.pwd
  198. chown -R %{l_rusr}:%{l_rgrp} $RPM_INSTALL_PREFIX/var/mysql/
  199. ( echo "The MySQL package includes automated maintenance procedures"
  200. echo "that require administrator access to the database. For this"
  201. echo "to work you must keep a copy (plain text) of the administrator"
  202. echo "account in '$RPM_INSTALL_PREFIX/etc/mysql/my.pwd'."
  203. ) | %{l_rpmtool} msg -b -t notice