mysql4.spec 7.4 KB

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