mysql3.spec 8.1 KB

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