mysql.spec 7.1 KB

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