#!/bin/bash # mysql.SlackBuild # Build and install MySQL on Slackware # Author....................: David Cantrell # Currently maintained by...: Patrick Volkerding # Modified for Slackware ARM: Stuart Winter # 19-Sep-2004 # Record toolchain & other info for the build log: slackbuildinfo # Paths to skeleton port's source & real Slackware source tree: export CWD=$SLACKSOURCE/$PKGSERIES/$PKGNAM export PORTCWD=$PWD # Temporary build locations: export TMPBUILD=$TMP/build-$PKGNAM export PKG=$TMP/package-$PKGNAM mkpkgdirs # Delete & re-create temporary directories then cd into $TMPBUILD # Determine the CFLAGS for the known architectures: case $ARCH in arm) export SLKCFLAGS="-O2 -march=armv5te" export LIBDIRSUFFIX="" ;; *) export SLKCFLAGS="-O2" ;; esac # Extract source: tar xvvf $CWD/$PKGNAM-$VERSION.tar.* cd $PKGNAM-$VERSION || exit 1 slackhousekeeping if ls $CWD/*.diff.gz 1> /dev/null 2> /dev/null ; then for patch in $CWD/*.diff.gz ; do zcat $patch | patch -p1 --verbose || exit 1 done fi # FTBFS on ARM - taken from Debian's patch set: auto_apply_patch $PORTCWD/sources/70_mysql_va_list.patch.xz || exit 1 # Configure: mkdir build cd build CFLAGS="$SLKCFLAGS" \ CXXFLAGS="$SLKCFLAGS -felide-constructors -fno-exceptions -fno-rtti" \ CXX=gcc \ cmake \ -DBUILD_CONFIG=mysql_release \ -DFEATURE_SET="community" \ -DINSTALL_LAYOUT="RPM" \ -DCMAKE_INSTALL_PREFIX=/usr \ -DINSTALL_LIBDIR="lib${LIBDIRSUFFIX}" \ -DINSTALL_SBINDIR=libexec \ -DINSTALL_INCLUDEDIR=include/mysql \ -DINSTALL_MYSQLSHAREDIR=share/mysql \ -DINSTALL_SQLBENCHDIR= \ -DINSTALL_MYSQLTESTDIR=mysql-test \ -DINSTALL_INFODIR=info \ -DINSTALL_MANDIR=man \ -DINSTALL_PLUGINDIR="lib${LIBDIRSUFFIX}/mysql/plugin" \ -DINSTALL_SCRIPTDIR=bin \ -DINSTALL_SUPPORTFILESDIR=share/mysql \ -DINSTALL_MYSQLDATADIR="/var/lib/mysql" \ -DMYSQL_DATADIR="/var/lib/mysql" \ -DMYSQL_UNIX_ADDR="/var/run/mysql/mysql.sock" \ -DWITH_EXTRA_CHARSETS=complex \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DENABLED_LOCAL_INFILE=ON \ -DWITH_EMBEDDED_SERVER=OFF \ -DWITH_READLINE=ON \ -DWITH_SSL=system \ -DWITH_ZLIB=system \ .. || exit 1 # Build: make $NUMJOBS || make || exit 1 # Install into package: make install DESTDIR=$PKG || exit 1 # Install sample configuration files: mkdir -vpm755 $PKG/etc/mysql install -vpm644 support-files/my-*.cnf $PKG/etc/mysql # Move mysqlaccess.conf to a more proper place mv -fv $PKG/usr/bin/mysqlaccess.conf $PKG/etc/mysqlaccess.conf.new chmod 644 $PKG/etc/mysqlaccess.conf.new # Leave build directory: cd .. # Install additional headers needed for building external engine plugins: mkdir -p $PKG/usr/include/mysql/private/atomic install -m 644 regex/my_regex.h $PKG/usr/include/mysql/private/ for i in sql include; do for j in $i/*.h; do install -m 644 $j $PKG/usr/include/mysql/private/ done done for i in include/atomic/*.h; do install -m 644 $i $PKG/usr/include/mysql/private/atomic/ done # Install docs: mkdir -p $PKG/usr/doc/mysql-$VERSION/Docs cp -a \ BUILD* COPYING* EXCEPTIONS* INSTALL-SOURCE README* VERSION \ $PKG/usr/doc/mysql-$VERSION changelogliposuction ChangeLog $PKGNAM $VERSION ( cd Docs # Seems most of the Docs/* are gone, but we'll leave the cp stuff # in case it returns. cp -a INFO_SRC INSTALL-BINARY *.html *.txt Flags \ $PKG/usr/doc/mysql-$VERSION/Docs ) # This is the directory where databases are stored: mkdir -vpm755 $PKG/var/lib/mysql chown mysql:mysql $PKG/var/lib/mysql # This is where the socket is stored: mkdir -vpm755 $PKG/var/run/mysql chown mysql:mysql $PKG/var/run/mysql # Do not package the test suite: rm -rf $PKG/usr/mysql-test # More unpackaged things: rm -f $PKG/usr/info/dir rm -f $PKG/usr/lib${LIBDIRSUFFIX}/libmysqlclient.a rm -f $PKG/usr/lib${LIBDIRSUFFIX}/libmysqlclient_r.* ( cd $PKG/usr/lib${LIBDIRSUFFIX} ; ln -sf libmysqlclient.so libmysqlclient_r.so ) # Add init script: mkdir -vpm755 $PKG/etc/rc.d # This is intentionally chmod 644. zcat $CWD/rc.mysqld.gz > $PKG/etc/rc.d/rc.mysqld.new # If necessary, start the fakeroot server so we can set file/dir ownerships: start_fakeroot # Apply generic Slackware packaging policies: cd $PKG slackstripall # strip all .a archives and all ELFs slackgzpages -i # compress man & info pages and delete usr/info/dir slackslack # chown -R root:root, chmod -R og-w, slackchown, slack644docs slackdesc # install slack-desc and doinst.sh slackmp # run makepkg -l y -c n # Perform any final checks on the package: cd $PKG slackhlinks # search for any hard links ########################################################################## # Build MySQL embedded, for use with amarok. # The static library is saved in this $CWD and copied onto the system # by the amarok build script. # The code here is taken from mysql-embedded.build ########################################################################## echo "******************************************************************" echo "* Building embedded MySQL library *" echo "******************************************************************" # Wipe the stuff from the normal build: rm -rf $PKG mkdir -vpm755 $PKG cd $TMPBUILD rm -rf mysql-embedded mkdir -vpm755 mysql-embedded cd mysql-embedded tar xf $CWD/$PKGNAM-$VERSION.tar.* cd $PKGNAM-$VERSION || exit 1 slackhousekeeping if ls $CWD/*.diff.gz 1> /dev/null 2> /dev/null ; then for patch in $CWD/*.diff.gz ; do zcat $patch | patch -p1 --verbose || exit 1 done fi # FTBFS on ARM - taken from Debian's patch set: auto_apply_patch $PORTCWD/sources/70_mysql_va_list.patch.xz || exit 1 # Configure: mkdir build cd build CFLAGS="$SLKCFLAGS" \ CXXFLAGS="$SLKCFLAGS -felide-constructors -fno-exceptions -fno-rtti" \ CXX=gcc \ cmake \ -DBUILD_CONFIG=mysql_release \ -DFEATURE_SET="community" \ -DINSTALL_LAYOUT="RPM" \ -DCMAKE_INSTALL_PREFIX=/usr \ -DINSTALL_LIBDIR="lib${LIBDIRSUFFIX}" \ -DINSTALL_SBINDIR=libexec \ -DINSTALL_INCLUDEDIR=include/mysql \ -DINSTALL_MYSQLSHAREDIR=share/mysql \ -DINSTALL_SQLBENCHDIR= \ -DINSTALL_MYSQLTESTDIR=mysql-test \ -DINSTALL_INFODIR=info \ -DINSTALL_MANDIR=man \ -DINSTALL_PLUGINDIR="lib${LIBDIRSUFFIX}/mysql/plugin" \ -DINSTALL_SCRIPTDIR=bin \ -DINSTALL_MYSQLDATADIR="/var/lib/mysql" \ -DINSTALL_SUPPORTFILESDIR=share/mysql \ -DMYSQL_DATADIR="/var/lib/mysql" \ -DMYSQL_UNIX_ADDR="/var/run/mysql/mysql.sock" \ -DWITH_EXTRA_CHARSETS=complex \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DENABLED_LOCAL_INFILE=ON \ -DWITH_EMBEDDED_SERVER=ON \ -DWITH_READLINE=ON \ -DWITH_SSL=system \ -DWITH_ZLIB=system \ .. || exit 1 # Build: make $NUMJOBS || make || exit 1 # Install into a temp dir: make install DESTDIR=$PKG || exit 1 # Install sample configuration files: mkdir -vpm755 $PKG/etc/mysql install -vpm644 support-files/my-*.cnf $PKG/etc/mysql # Move mysqlaccess.conf to a more proper place mv -fv $PKG/usr/bin/mysqlaccess.conf $PKG/etc/mysqlaccess.conf.new chmod 644 $PKG/etc/mysqlaccess.conf.new # Leave build directory: cd .. # Install additional headers needed for building external engine plugins: mkdir -p $PKG/usr/include/mysql/private/atomic install -m 644 regex/my_regex.h $PKG/usr/include/mysql/private/ for i in sql include; do for j in $i/*.h; do install -m 644 $j $PKG/usr/include/mysql/private/ done done for i in include/atomic/*.h; do install -m 644 $i $PKG/usr/include/mysql/private/atomic/ done # Install docs: mkdir -p $PKG/usr/doc/mysql-$VERSION/Docs cp -a \ BUILD* COPYING* EXCEPTIONS* INSTALL-SOURCE README* VERSION \ $PKG/usr/doc/mysql-$VERSION changelogliposuction ChangeLog $PKGNAM $VERSION ( cd Docs # Seems most of the Docs/* are gone, but we'll leave the cp stuff # in case it returns. cp -a INFO_SRC INSTALL-BINARY *.html *.txt Flags \ $PKG/usr/doc/mysql-$VERSION/Docs ) # This is the directory where databases are stored: mkdir -vpm755 $PKG/var/lib/mysql chown mysql:mysql $PKG/var/lib/mysql # This is where the socket is stored: mkdir -vpm755 $PKG/var/run/mysql chown mysql:mysql $PKG/var/run/mysql # Do not package the test suite: rm -rf $PKG/usr/mysql-test # More unpackaged things: rm -f $PKG/usr/info/dir rm -f $PKG/usr/lib${LIBDIRSUFFIX}/libmysqlclient.a rm -f $PKG/usr/lib${LIBDIRSUFFIX}/libmysqlclient_r.* ( cd $PKG/usr/lib${LIBDIRSUFFIX} ; ln -sf libmysqlclient.so libmysqlclient_r.so ) # Add init script: mkdir -vpm755 $PKG/etc/rc.d # This is intentionally chmod 644. zcat $CWD/rc.mysqld.gz > $PKG/etc/rc.d/rc.mysqld.new # Copy these bits: #( cd $TMPBUILD/package-mysql-embedded # rm -f usr/lib/libmysqlservices.a ## this one is in the main mysql package so we don't need to copy this # cd usr/lib # tar vvcf $PORTCWD/mysql-embedded.tar lib*.a # xz -vze9 $PORTCWD/mysql-embedded.tar ) # Save the staic library. It's 11MB uncompressed, 1.5M compressed. # This is from the old mysql version but we'll keep the cruft around for a while for reference. #if [ ! -f libmysqld/libmysqld.a ]; then # echo "****** FAILED TO FIND STATIC LIBRARY *******" # exit 1 # else # echo "Found static library; compressing ...." # xz -czf < libmysqld/libmysqld.a > $PORTCWD/libmysqld.a.xz || exit 1 #fi # Make a package of this stuff: cd $PKG makepkg -l y -c n $PORTCWD/mysql-${VERSION}_embedded-arm-1.txz ##########################################################################