From c8805100b4c521efd2909cb3988d0e57e96026e8 Mon Sep 17 00:00:00 2001
From: Cecil Hugh Watson <knoppmyth@gmail.com>
Date: Sat, 4 Sep 2010 17:07:29 -0700
Subject: mysql:Bumped/Updated for LinHES 7.

---
 abs/core-testing/mysql/PKGBUILD               | 153 ++++++++++++++++++--------
 abs/core-testing/mysql/__changelog            |  15 +--
 abs/core-testing/mysql/mysql-no-clients.patch |  65 -----------
 abs/core-testing/mysql/mysql.install          |  20 ++++
 abs/core-testing/mysql/mysqld                 |  67 ++++++-----
 abs/core-testing/mysql/mysqld.conf.d          |   1 -
 abs/core-testing/mysql/skip-abi-check.patch   |  13 +++
 7 files changed, 171 insertions(+), 163 deletions(-)
 delete mode 100644 abs/core-testing/mysql/mysql-no-clients.patch
 create mode 100644 abs/core-testing/mysql/mysql.install
 delete mode 100644 abs/core-testing/mysql/mysqld.conf.d
 create mode 100644 abs/core-testing/mysql/skip-abi-check.patch

diff --git a/abs/core-testing/mysql/PKGBUILD b/abs/core-testing/mysql/PKGBUILD
index c91ac41..ce41dbc 100644
--- a/abs/core-testing/mysql/PKGBUILD
+++ b/abs/core-testing/mysql/PKGBUILD
@@ -1,56 +1,113 @@
-# $Id: PKGBUILD 23595 2009-01-11 13:14:19Z douglas $
-# Maintainer: Alexander Baldeck <alexander@archlinux.org>
+# $Id: PKGBUILD 81345 2010-05-28 20:08:31Z jgc $
+# Maintainer: Andrea Scarpino <andrea@archlinux.org>
+# Contributor: Douglas Soares de Andrade <douglas@archlinux.org>
 # Contributor: judd <jvinet@zeroflux.org>
-pkgname=mysql
-pkgver=5.0.75
-pkgrel=4
-pkgdesc="A fast SQL database server"
-arch=(i686 x86_64)
-backup=(etc/my.cnf etc/conf.d/mysqld)
-depends=("mysql-clients>=${pkgver}" 'tcp_wrappers')
-makedepends=('libtool')
-url=('http://www.mysql.com/')
-options=('!libtool')
-optdepends=('perl-dbi' 'perl-dbd-mysql')
+
+pkgbase=mysql
+pkgname=('libmysqlclient' 'mysql-clients' 'mysql')
+pkgver=5.1.47
+pkgrel=1
+arch=('i686' 'x86_64')
 license=('GPL')
-source=(ftp://ftp.pucpr.br/mysql/Downloads/MySQL-5.0/mysql-${pkgver}.tar.gz
-	mysql-no-clients.patch
-	mysqld
-	my.cnf
-	mysqld.conf.d)
+url="http://www.mysql.com/"
+makedepends=('tcp_wrappers' 'zlib' 'perl' 'openssl' 'libtool' 'patch')
+options=('!libtool')
+source=(http://ftp.gwdg.de/pub/misc/mysql/Downloads/MySQL-5.1/${pkgbase}-${pkgver}.tar.gz
+        mysqld
+        my.cnf
+        skip-abi-check.patch)
+md5sums=('02b9964b3966832f3d6bc87524bfd73f'
+         '2234207625baa29b2ff7d7b4f088abce'
+         '0337741fa9afbe57939993636081a827'
+         'a97e574945e19de3908575b956241026')
 
 build() {
-  # PIC
-  cd ${startdir}/src/${pkgname}-${pkgver}
-  patch -Np1 -i ${startdir}/src/mysql-no-clients.patch || return 1
-  ./configure --prefix=/usr --libexecdir=/usr/sbin \
-    --without-debug --without-docs --without-bench --without-readline \
-    --with-innodb --enable-local-infile --with-openssl \
-    --with-charset=latin1 --with-collation=latin1_general_ci \
-    --with-extra-charsets=complex --enable-thread-safe-client \
-    --with-libwrap --with-berkeley-db --with-embedded-server
-
-  # fixes
-  sed -i -e 's/^.*HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE.*$/#define\ HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE/g' include/config.h || return 1
-  sed -i -e 's/size_socket/socklen_t/g' sql/mysqld.cc || return 1
-
-  pushd include || return
-  make || return 1
-  popd
-  pushd libmysql
-  make link_sources get_password.lo || return
-  popd
+  cd "${srcdir}/${pkgbase}-${pkgver}"
+  patch -Np0 -i "${srcdir}/skip-abi-check.patch" || return 1
+  # CFLAGS/CXXFLAGS as suggested upstream
+  CFLAGS="-fPIC ${CFLAGS} -fno-strict-aliasing -DBIG_JOINS=1 -fomit-frame-pointer" \
+  CXXFLAGS="-fPIC ${CXXFLAGS} -fno-strict-aliasing -DBIG_JOINS=1 -felide-constructors -fno-rtti" \
+  ./configure --prefix=/usr \
+    --libexecdir=/usr/sbin \
+    --localstatedir=/var \
+    --sysconfdir=/etc/mysql \
+    --without-docs \
+    --without-readline \
+    --with-ssl \
+    --with-libwrap \
+    --with-charset=utf8 \
+    --with-collation=utf8_general_ci \
+    --with-extra-charsets=complex \
+    --with-embedded-server \
+    --with-unix-socket-path=/var/run/mysqld/mysqld.sock \
+    --enable-local-infile \
+    --with-plugins=partition,ftexample,archive,blackhole,federated,heap,innobase,innodb_plugin,ndbcluster || return 1
   make || return 1
-  make DESTDIR=${startdir}/pkg install
-  rm -rf ${startdir}/pkg/usr/{mysql-test,sql-bench}
-  install -D -m644 ../my.cnf ${startdir}/pkg/etc/my.cnf
-  install -D -m755 ../mysqld ${startdir}/pkg/etc/rc.d/mysqld
-  install -D -m644 ../mysqld.conf.d ${startdir}/pkg/etc/conf.d/mysqld
-  rm -f ${startdir}/pkg/usr/bin/mysql_config
 }
 
-md5sums=('a234f0a60a7f8c290d9875cba3a2c5a2'
-         'e892aac36cbeb57f0e003ec0936afb3b'
-         'cfff3585dd70cde3ac1ce69e64008733'
+package_libmysqlclient(){
+  pkgdesc="MySQL client libraries"
+  depends=('openssl' 'zlib' 'gcc-libs' 'tcp_wrappers')
+  
+  cd "${srcdir}/${pkgbase}-${pkgver}"
+  for dir in include libmysql libmysql_r libmysqld; do
+    make -C ${dir} DESTDIR="${pkgdir}" install || return 1
+  done
+  install -m644 include/*.h "${pkgdir}/usr/include/mysql/" || return 1
+
+  install -d "${pkgdir}/usr/bin"
+  install -m755 scripts/mysql_config "${pkgdir}/usr/bin/" || return 1
+  
+  # create library symlinks in /usr/lib
+  ln -sf mysql/libmysqlclient.so.16 ${pkgdir}/usr/lib/libmysqlclient.so.16
+  ln -sf libmysqlclient.so.16 ${pkgdir}/usr/lib/libmysqlclient.so
+  ln -sf libmysqlclient.so.16 ${pkgdir}/usr/lib/libmysqlclient.so.1
+  ln -sf mysql/libmysqlclient_r.so.16  ${pkgdir}/usr/lib/libmysqlclient_r.so.16
+  ln -sf libmysqlclient_r.so.16 ${pkgdir}/usr/lib/libmysqlclient_r.so
+  ln -sf libmysqlclient_r.so.16 ${pkgdir}/usr/lib/libmysqlclient_r.so.1
+}
+
+package_mysql-clients(){
+  pkgdesc="MySQL client tools"
+  depends=('libmysqlclient')
+  
+  cd "${srcdir}/${pkgbase}-${pkgver}/client"
+  make DESTDIR="${pkgdir}" install || return 1
+
+  # provided by libmysqlclient
+  rm -rf "${pkgdir}/usr/lib/"
+
+  # provided by mysql
+  rm -f "${pkgdir}"/usr/bin/{mysql_upgrade,mysqlbinlog,mysqltest}
+}
+
+package_mysql(){
+  pkgdesc="A fast SQL database server"
+  backup=('etc/my.cnf' 'etc/mysql/my.cnf')
+  install=mysql.install
+  depends=('mysql-clients')
+  optdepends=('perl-dbi' 'perl-dbd-mysql')
+
+  cd "${srcdir}/${pkgbase}-${pkgver}"
+  make DESTDIR=${pkgdir} install || return 1
+
+  install -Dm644 ${srcdir}/my.cnf ${pkgdir}/etc/mysql/my.cnf || return 1
+  install -Dm755 ${srcdir}/mysqld ${pkgdir}/etc/rc.d/mysqld || return 1
+
+  # provided by libmysqlclient
+  rm -f ${pkgdir}/usr/bin/{mysql_config,mysql_client_test_embedded,mysqltest_embedded}
+  rm -f ${pkgdir}/usr/lib/mysql/libmysqlclient*
+  rm -f ${pkgdir}/usr/lib/mysql/libmysqld.a
+  rm -f ${pkgdir}/usr/include/mysql/*.h
+  
+  # provided by mysql-clients
+  rm -f ${pkgdir}/usr/bin/{mysql,mysqladmin,mysqlcheck,mysqldump,mysqlimport,mysqlshow,mysqlslap}
+
+  # not needed
+  rm -rf ${pkgdir}/usr/{mysql-test,sql-bench}
+  rm -f ${pkgdir}/usr/lib/mysql/plugin/*.a
+}
+md5sums=('02b9964b3966832f3d6bc87524bfd73f'
+         '040148932c625794c4db81ab9139eb68'
          '078f6e824d6097d558bcf7c16d508d92'
-         'd81d1f51e9ee6941425a63456d07cb21')
+         'a97e574945e19de3908575b956241026')
diff --git a/abs/core-testing/mysql/__changelog b/abs/core-testing/mysql/__changelog
index aa066aa..5466afc 100644
--- a/abs/core-testing/mysql/__changelog
+++ b/abs/core-testing/mysql/__changelog
@@ -1,13 +1,2 @@
-my.cnf
--enable networking
--datadir /data/srv/mysql
--query_cache_size
--tmp_table_size
--max_heap_table_size
--thread_cache_size
--table_cache
-
-mysqld
-	-redirect output to /dev/null
-	--skip-name-resolve 
-    replace mkdir with mkdir -p
+6/13/10 - chw - LinHES specific my.cnf
+	- chw - mysqld, added --skip-name-resolve to mysqld_safe line and output to /dev/null
diff --git a/abs/core-testing/mysql/mysql-no-clients.patch b/abs/core-testing/mysql/mysql-no-clients.patch
deleted file mode 100644
index e1fb5e0..0000000
--- a/abs/core-testing/mysql/mysql-no-clients.patch
+++ /dev/null
@@ -1,65 +0,0 @@
-diff -ruN mysql-5.0.51.orig/Makefile.in mysql-5.0.51/Makefile.in
---- mysql-5.0.51.orig/Makefile.in	2007-12-07 12:59:21.000000000 +0000
-+++ mysql-5.0.51/Makefile.in	2007-12-07 13:03:21.000000000 +0000
-@@ -376,7 +376,7 @@
- SUBDIRS = . include @docs_dirs@ @zlib_dir@ @yassl_dir@ \
- 			@readline_topdir@ sql-common scripts \
- 			@thread_dirs@ pstack \
--			@sql_union_dirs@ @man_dirs@ tests \
-+			strings mysys dbug extra regex bdb innobase myisam myisammrg heap vio sql @man_dirs@ tests \
- 			netware @libmysqld_dirs@ \
- 			@bench_dirs@ support-files @tools_dirs@
- 
-diff -ruN mysql-5.0.51.orig/include/Makefile.in mysql-5.0.51/include/Makefile.in
---- mysql-5.0.51.orig/include/Makefile.in	2007-12-07 12:59:20.000000000 +0000
-+++ mysql-5.0.51/include/Makefile.in	2007-12-07 13:00:12.000000000 +0000
-@@ -557,7 +557,6 @@
- 	  test -z "$$dir" || $(mkdir_p) "$$dir"; \
- 	done
- install: $(BUILT_SOURCES)
--	$(MAKE) $(AM_MAKEFLAGS) install-am
- install-exec: install-exec-am
- install-data: install-data-am
- uninstall: uninstall-am
-diff -ruN mysql-5.0.51.orig/tests/Makefile.in mysql-5.0.51/tests/Makefile.in
---- mysql-5.0.51.orig/tests/Makefile.in	2007-12-07 12:59:20.000000000 +0000
-+++ mysql-5.0.51/tests/Makefile.in	2007-12-07 13:01:51.000000000 +0000
-@@ -96,7 +96,7 @@
- am_mysql_client_test_OBJECTS = mysql_client_test.$(OBJEXT) \
- 	my_memmem.$(OBJEXT)
- mysql_client_test_OBJECTS = $(am_mysql_client_test_OBJECTS)
--am__DEPENDENCIES_1 = $(top_builddir)/libmysql/libmysqlclient.la
-+am__DEPENDENCIES_1 = /usr/lib/mysql/libmysqlclient.so
- am__DEPENDENCIES_2 =
- mysql_client_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \
- 	$(am__DEPENDENCIES_2)
-@@ -106,7 +106,7 @@
- thread_test_SOURCES = thread_test.c
- thread_test_OBJECTS = thread_test.$(OBJEXT)
- thread_test_LDADD = $(LDADD)
--thread_test_DEPENDENCIES = $(top_builddir)/libmysql/libmysqlclient.la
-+thread_test_DEPENDENCIES = /usr/lib/mysql/libmysqlclient.so
- DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
- depcomp = $(SHELL) $(top_srcdir)/depcomp
- am__depfiles_maybe = depfiles
-@@ -405,7 +405,7 @@
- 			$(openssl_includes)
- 
- LDADD = @CLIENT_EXTRA_LDFLAGS@ \
--                        $(top_builddir)/libmysql/libmysqlclient.la
-+                        /usr/lib/mysql/libmysqlclient.so
- 
- mysql_client_test_LDADD = $(LDADD) $(CXXLDFLAGS)
- mysql_client_test_SOURCES = mysql_client_test.c\
-diff -ruN mysql-5.0.51.orig/tools/Makefile.in mysql-5.0.51/tools/Makefile.in
---- mysql-5.0.51.orig/tools/Makefile.in	2007-12-07 12:59:19.000000000 +0000
-+++ mysql-5.0.51/tools/Makefile.in	2007-12-07 13:02:32.000000000 +0000
-@@ -369,7 +369,7 @@
- 		$(openssl_includes)
- 
- LDADD = @CLIENT_EXTRA_LDFLAGS@ \
--		$(top_builddir)/libmysql_r/libmysqlclient_r.la \
-+		/usr/lib/mysql/libmysqlclient_r.so \
- 		@openssl_libs@ @yassl_libs@ @ZLIB_LIBS@
- 
- mysqltestmanager_SOURCES = mysqlmanager.c
diff --git a/abs/core-testing/mysql/mysql.install b/abs/core-testing/mysql/mysql.install
new file mode 100644
index 0000000..9e9011d
--- /dev/null
+++ b/abs/core-testing/mysql/mysql.install
@@ -0,0 +1,20 @@
+post_install(){
+  groupadd -g 89 mysql &>/dev/null
+  useradd -u 89 -g mysql -d /var/lib/mysql -s /bin/false mysql &>/dev/null
+  usr/bin/mysql_install_db --user=mysql
+  chown -R mysql:mysql var/lib/mysql &>/dev/null
+}
+
+post_upgrade(){
+  getent group mysql >/dev/null 2>&1 || groupadd -g 89 mysql &>/dev/null
+  getent passwd mysql >/dev/null 2>&1 || useradd -u 89 -g mysql -d /var/lib/mysql -s /bin/false mysql &>/dev/null
+}
+
+post_remove(){
+  if getent passwd mysql >/dev/null 2>&1; then
+    userdel mysql
+  fi
+  if getent group mysql >/dev/null 2>&1; then
+    groupdel mysql
+  fi
+}
diff --git a/abs/core-testing/mysql/mysqld b/abs/core-testing/mysql/mysqld
index 5857df8..882e6dd 100755
--- a/abs/core-testing/mysql/mysqld
+++ b/abs/core-testing/mysql/mysqld
@@ -1,48 +1,35 @@
 #!/bin/bash
 
-MYSQLD_ROOT="/var/lib/mysql"
-# source application-specific settings
-[ -f /etc/conf.d/mysqld ] && . /etc/conf.d/mysqld
-
 # general config
 . /etc/rc.conf
 . /etc/rc.d/functions
 
-PID=`pidof -o %PPID /usr/sbin/mysqld`
-if [ ! `egrep '^mysql:' /etc/group` ]; then
-  stat_busy "Adding mysql group"
-  groupadd -g 89 mysql
-  stat_done
-fi
-if [ ! `egrep '^mysql:' /etc/passwd` ]; then
-  stat_busy "Adding mysql user"
-  useradd -u 89 -g mysql -d $MYSQLD_ROOT -s /bin/false mysql
-  [ -d $MYSQLD_ROOT ] && chown -R mysql.mysql $MYSQLD_ROOT
-  stat_done
-fi
-
-if [ ! -d $MYSQLD_ROOT ]; then
-  mkdir -p $MYSQLD_ROOT
-  /usr/bin/mysql_install_db --datadir=$MYSQLD_ROOT --user=mysql 2>/dev/null 1>/dev/null
-  chown -R mysql.mysql $MYSQLD_ROOT
-fi
+getPID() {
+   echo $(pgrep -u mysql mysqld 2>/dev/null);
+}
 
 case "$1" in
   start)
-    stat_busy "Starting MySQL"
-    if [ -z "$PID" ]; then
-       /usr/bin/mysqld_safe --skip-name-resolve --datadir=$MYSQLD_ROOT >/dev/null 2>/dev/null &
+    stat_busy "Starting MySQL Server"
+    [ ! -d /var/run/mysqld ] && install -d -g mysql -o mysql /var/run/mysqld &>/dev/null
+    if [ -z "$(getPID)" ]; then
+       /usr/bin/mysqld_safe --skip-name-resolve --user=mysql >/devl/null &>/dev/null &
       if [ $? -gt 0 ]; then
         stat_fail
         exit 1
       else
-        sleep 1 # wait on children
-        PID=`pidof -o %PPID /usr/sbin/mysqld`
-        if [ -z "$PID" ]; then
+        timeo=30
+        while [ $timeo -gt 0 ]; do
+          response=`/usr/bin/mysqladmin -uUNKNOWN_USER ping 2>&1` && break
+          echo "$response" | grep -q "mysqld is alive" && break
+          sleep 1
+          let timeo=${timeo}-1
+        done
+        if [ $timeo -eq 0 ]; then
           stat_fail
           exit 1
         else
-          echo $PID >/var/run/mysqld.pid
+          echo $(getPID) > /var/run/mysqld/mysqld.pid
           add_daemon mysqld
           stat_done
         fi
@@ -54,16 +41,25 @@ case "$1" in
     ;;
 
   stop)
-    stat_busy "Stopping MySQL"
-    if [ ! -z "$PID" ]; then
-      kill $PID &> /dev/null      
+    stat_busy "Stopping MySQL Server"
+    if [ ! -z "$(getPID)" ]; then
+      timeo=30
+      kill $(getPID) &> /dev/null
       if [ $? -gt 0 ]; then
         stat_fail
         exit 1
-      else
-        rm -f /var/run/mysqld.pid &>/dev/null
+      fi
+      while [ ! -z "$(getPID)" -a $timeo -gt 0 ]; do
+        sleep 1
+        let timeo=${timeo}-1
+      done
+      if [ -z "$(getPID)" ]; then
+        rm -f /var/run/mysqld/mysqld.pid &>/dev/null
         rm_daemon mysqld
         stat_done
+      else
+        stat_fail
+        exit 1
       fi
     else
       stat_fail
@@ -73,10 +69,9 @@ case "$1" in
 
   restart)
     $0 stop
-    sleep 3
     $0 start
     ;;
   *)
-    echo "usage: $0 {start|stop|restart}"  
+    echo "usage: $0 {start|stop|restart}"
 esac
 exit 0
diff --git a/abs/core-testing/mysql/mysqld.conf.d b/abs/core-testing/mysql/mysqld.conf.d
deleted file mode 100644
index 10b7098..0000000
--- a/abs/core-testing/mysql/mysqld.conf.d
+++ /dev/null
@@ -1 +0,0 @@
-MYSQLD_ROOT="/data/srv/mysql"
diff --git a/abs/core-testing/mysql/skip-abi-check.patch b/abs/core-testing/mysql/skip-abi-check.patch
new file mode 100644
index 0000000..6791deb
--- /dev/null
+++ b/abs/core-testing/mysql/skip-abi-check.patch
@@ -0,0 +1,13 @@
+--- Makefile.in.orig	2010-05-28 20:03:46.507224494 +0200
++++ Makefile.in	2010-05-28 20:04:05.737221909 +0200
+@@ -1126,10 +1126,8 @@
+ #
+ 
+ abi_check:	$(API_PREPROCESSOR_HEADER)
+-	$(MAKE) abi_headers="$^" do_abi_check
+ 
+ abi_check_all:	$(TEST_PREPROCESSOR_HEADER)
+-	$(MAKE) abi_headers="$^" do_abi_check
+ 
+ do_abi_check:
+ 	set -ex; \
-- 
cgit v0.12