#!/bin/sh # Heavily based on the Slackware 11.0 SlackBuild # http://www.mysql.com/ # packager: mauro.sacchetto@alice.it CWD=`pwd` TMP=${TMP:-/tmp/tgz} PKG=$TMP/package-mysql NAME=mysql VERSION=5.0.41 TARGET=i486 ARCH=${ARCH:-i486} BUILD=1ms if [ ! -d $TMP ]; then mkdir -p $TMP fi if [ ! -d $PKG ]; then mkdir -p $PKG fi if [ "$ARCH" = "i386" ]; then SLKCFLAGS="-O2 -march=i386 -mcpu=i686" elif [ "$ARCH" = "i486" ]; then SLKCFLAGS="-O2 -march=i486 -mtune=i686" elif [ "$ARCH" = "s390" ]; then SLKCFLAGS="-O2" elif [ "$ARCH" = "x86_64" ]; then SLKCFLAGS="-O2" fi cd $TMP tar xzvf $CWD/$NAME-$VERSION.tar.gz cd $NAME-$VERSION #Patch for Linux kernel 2.6.x #zcat $CWD/atomic_h.diff.gz | patch -p1 -E --backup --verbose chown -R root.root . find . -perm 777 -exec chmod 755 {} \; find . -perm 775 -exec chmod 755 {} \; find . -perm 666 -exec chmod 644 {} \; find . -perm 664 -exec chmod 644 {} \; find . -perm 444 -exec chmod 644 {} \; CFLAGS="$SLKCFLAGS" CXX=gcc CXXFLAGS="$SLKCFLAGS -felide-constructors -fno-exceptions -fno-rtti" \ ./configure \ --prefix=/usr \ --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-openssl \ --with-raid \ --program-prefix="" \ --program-suffix="" \ --build=$TARGET-slackware-linux make -j3 make install DESTDIR=$PKG ( cd $PKG find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null find . | xargs file | grep "current ar archive" | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null ) mkdir -p $PKG/etc ( cd support-files cp my-huge.cnf my-large.cnf my-medium.cnf my-small.cnf $PKG/etc ) # install docs mkdir -p $PKG/usr/doc/$NAME-$VERSION/Docs cp -a ChangeLog COPYING EXCEPTIONS-CLIENT INSTALL-SOURCE README $PKG/usr/doc/mysql-$VERSION ( cd Docs cp -a INSTALL-BINARY \ $PKG/usr/doc/$NAME-$VERSION/Docs ) find $PKG/usr/doc/$NAME-$VERSION -type f -exec chmod 644 {} \; # this is the directory where databases are stored mkdir -p $PKG/var/lib/mysql chown mysql.mysql $PKG/var/lib/mysql chmod 750 $PKG/var/lib/mysql # this is where the socket is stored mkdir -p $PKG/var/run/mysql chown mysql.mysql $PKG/var/run/mysql chmod 755 $PKG/var/run/mysql # Do not include the test suite: rm -r $PKG/usr/mysql-test # Add init script: mkdir -p $PKG/etc/rc.d # This is intentionally chmod 644. zcat $CWD/rc.mysqld.gz > $PKG/etc/rc.d/rc.mysqld.new # Install script: mkdir -p $PKG/install zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh cat $CWD/slack-desc > $PKG/install/slack-desc # Add some handy library symlinks: if [ -r $PKG/usr/lib/mysql/libmysqlclient.so.15 ]; then ( cd $PKG/usr/lib rm -f libmysqlclient.so libmysqlclient.so.15 ln -sf mysql/libmysqlclient.so . ln -sf mysql/libmysqlclient.so.15 . ) fi if [ -r $PKG/usr/lib/mysql/libmysqlclient_r.so.15 ]; then ( cd $PKG/usr/lib rm -f libmysqlclient_r.so libmysqlclient_r.so.15 ln -sf mysql/libmysqlclient_r.so . ln -sf mysql/libmysqlclient_r.so.15 . ) fi # Packaging standards: rm -f $PKG/usr/info/dir gzip -9 $PKG/usr/info/* gzip -9 $PKG/usr/man/man?/*.? cat $CWD/slack-desc > $PKG/usr/doc/$NAME-$VERSION/slack-desc cat $CWD/$NAME.SlackBuild > $PKG/usr/doc/$NAME-$VERSION/$NAME.SlackBuild cd $PKG requiredbuilder -v -y -s $CWD $PKG makepkg -l y -c n $CWD/$NAME-$VERSION-$ARCH-$BUILD.tgz if [ "$1" = "--cleanup" ]; then rm -rf $TMP fi