#!/bin/sh
#
# Copyright 2004 Dagmar d'Surreal <rivyqntzne@tznvy.pbz>
# Available under the terms of the GNU GPL.
#

NAME="mysql"
VERSION="4.1.15"
REVISION="1"

PKG_SOURCEURL='http://mysql.mirrors.pair.com/Downloads/MySQL-$VER_MAJ.$VER_MIN/mysql-$VERSION.tar.gz'

. $DLG_ROOT/config
. $DLG_ROOT/SCRIPTS/dropline-functions.sh

PKG_OPTLEVEL=""
cflags
PKG_OPTLEVEL="-felide-constructors -fno-exceptions -fno-rtti"
cxxflags
prepare
analyzesource
# Mostly copied from Slackware's build script
configure \
  --with-mysqld-user=mysql \
  --with-unix-socket-path=/var/run/mysql/mysql.sock \
  --localstatedir=/var/lib/mysql \
  --enable-assembler \
  --without-debug \
  --enable-thread-safe-client \
  --without-bench \
  --with-extra-charsets=complex \
  --with-vio \
  --with-openssl \
  --with-libwrap \
  --with-server-suffix="$DLG_PKGER" \
  --without-readline \
  --with-comment
#  --with-raid # Appears to break compiling this version
make
makeinstall install-strip
tidydocumentation

spewdo "createdir $PKG_STAGEROOT/var/lib/mysql"
spewdo "chown mysql.mysql $PKG_STAGEROOT/var/lib/mysql"
spewdo "chmod 750 $PKG_STAGEROOT/var/lib/mysql"

spewdo "createdir $PKG_STAGEROOT/var/run/mysql"
spewdo "chown mysql.mysql $PKG_STAGEROOT/var/run/mysql"
spewdo "chmod 755 $PKG_STAGEROOT/var/run/mysql"

analyzebinaries
finalizepackage
packagize
cleanup
