mysql4.spec 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  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_mysql %{V_major}.9-gamma
  28. %define V_opkg %{V_major}.9gamma
  29. # package information
  30. Name: mysql4
  31. Summary: Fast Relational Database Management System
  32. URL: http://www.mysql.com/
  33. Vendor: MySQL AB
  34. Packager: The OpenPKG Project
  35. Distribution: OpenPKG [EVAL]
  36. Group: Database
  37. License: GPL
  38. Version: %{V_opkg}
  39. Release: 20030116
  40. # package options
  41. %option with_berkeleydb yes
  42. %option with_innobase 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"
  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-%{V_mysql}.tar.gz
  60. Source1: my.cnf
  61. Source2: my.pwd
  62. Source3: rc.mysql4
  63. Patch0: mysql4.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 -n mysql-%{V_mysql}
  80. %patch -p0
  81. %build
  82. # patch file search path
  83. %{l_shtool} subst \
  84. -e 's;@l_prefix@;%{l_prefix};g' \
  85. mysys/default.c
  86. # determine additional configure options
  87. case "%{l_target}" in
  88. *-freebsd* ) opt="--with-client-ldflags=-static --with-mysqld-ldflags=-static" ;;
  89. *-linux* ) opt="--with-client-ldflags=-static --with-mysqld-ldflags=-static" ;;
  90. *-solaris* ) opt="--with-client-ldflags=-static --with-mysqld-ldflags=-static" ;;
  91. esac
  92. # configure source tree
  93. CC="%{l_cc}" \
  94. CXX="%{l_cxx}" \
  95. CFLAGS="%{l_cflags -O}" \
  96. CXXFLAGS="%{l_cxxflags -O}" \
  97. ./configure \
  98. --prefix=%{l_prefix} \
  99. --sysconfdir=%{l_prefix}/etc/mysql4 \
  100. --localstatedir=%{l_prefix}/var/mysql \
  101. --with-unix-socket-path=%{l_prefix}/var/mysql/mysql.sock \
  102. --with-mysqld-user=%{l_musr} \
  103. --enable-thread-safe-client \
  104. %if "%{with_berkeleydb}" == "yes"
  105. --with-berkeley-db \
  106. %endif
  107. %if "%{with_innobase}" == "no"
  108. --without-innodb \
  109. %endif
  110. --with-low-memory \
  111. --disable-shared \
  112. $opt
  113. # build source tree
  114. %{l_make} %{l_mflags}
  115. %install
  116. rm -rf $RPM_BUILD_ROOT
  117. # patch init script
  118. %{l_shtool} subst \
  119. -e 's;@l_prefix@;%{l_prefix};g' \
  120. scripts/mysql_install_db.sh
  121. # perform standard installation procedure
  122. %{l_make} %{l_mflags} install \
  123. AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT" \
  124. DESTDIR=$RPM_BUILD_ROOT
  125. # install global configuration
  126. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/mysql4
  127. %{l_shtool} install -c -m 644 \
  128. -e 's;@l_prefix@;%{l_prefix};g' \
  129. -e 's;@l_rusr@;%{l_rusr};g' \
  130. -e 's;@mysql_bdb_cache_size@;%{mysql_bdb_cache_size};g' \
  131. -e 's;@mysql_bdb_log_buffer_size@;%{mysql_bdb_log_buffer_size};g' \
  132. -e 's;@mysql_bdb_max_lock@;%{mysql_bdb_max_lock};g' \
  133. %{SOURCE my.cnf} \
  134. $RPM_BUILD_ROOT%{l_prefix}/etc/mysql4/
  135. %{l_shtool} install -c -m 600 \
  136. %{SOURCE my.pwd} \
  137. $RPM_BUILD_ROOT%{l_prefix}/etc/mysql4/
  138. # install run-command script
  139. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  140. %{l_shtool} install -c -m 755 \
  141. -e 's;@l_prefix@;%{l_prefix};g' \
  142. -e 's;@l_rusr@;%{l_rusr};g' \
  143. -e 's;@l_rgrp@;%{l_rgrp};g' \
  144. -e 's;@mysqld@;%{mysqld};g' \
  145. %{SOURCE rc.mysql4} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  146. # make sure the database directory exists
  147. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/var/mysql
  148. # determine the package files
  149. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  150. %{l_files_std} \
  151. '%config %{l_prefix}/etc/mysql4/my.cnf' \
  152. '%config %{l_prefix}/etc/mysql4/my.pwd'
  153. %files -f files
  154. %clean
  155. rm -rf $RPM_BUILD_ROOT
  156. %post
  157. # create initial database
  158. $RPM_INSTALL_PREFIX/bin/mysql_install_db \
  159. --defaults-file=$RPM_INSTALL_PREFIX/etc/mysql4/my.cnf
  160. chown %{l_rusr}:%{l_rgrp} \
  161. $RPM_INSTALL_PREFIX/etc/mysql4/my.cnf \
  162. $RPM_INSTALL_PREFIX/etc/mysql4/my.pwd
  163. chown -R %{l_rusr}:%{l_rgrp} $RPM_INSTALL_PREFIX/var/mysql/
  164. ( echo "The MySQL package includes automated maintenance procedures"
  165. echo "that require administrator access to the database. For this"
  166. echo "to work you must keep a copy (plain text) of the administrator"
  167. echo "account in '$RPM_INSTALL_PREFIX/etc/mysql4/my.pwd'."
  168. ) | %{l_rpmtool} msg -b -t notice