#!/bin/bash PKGNAM=trinitycore ARCH=${ARCH:-i486} NUMJOBS=${NUMJOBS:-" -j4 "} BUILD=${BUILD:-1} TAG=${TAG:-_micah} CWD=$(pwd) TMP=${TMP:-/tmp} PKG=$TMP/package-$PKGNAM LOCAL_MIRROR=${LOCAL_MIRROR:-${CWD}/trinitycore} REMOTE_MIRROR=https://trinitycore.googlecode.com/hg # and -fPIC on x86_64 results in failure if [ "$ARCH" = "i486" ]; then SLKCFLAGS="-O2 -march=i486 -mtune=i686 -mmmx -msse -msse2" LIBDIRSUFFIX="" elif [ "$ARCH" = "i686" ]; then SLKCFLAGS="-O2" LIBDIRSUFFIX="" elif [ "$ARCH" = "x86_64" ]; then SLKCFLAGS="-O2" # -fPIC LIBDIRSUFFIX="64" fi # Check to see if source is downloaded if [ -d ${LOCAL_MIRROR} ]; then echo "Updating local repository." cd ${LOCAL_MIRROR} hg pull hg update cd ${CWD} else echo "Building local repository." hg clone ${REMOTE_MIRROR} ${LOCAL_MIRROR} cd ${CWD} fi # Get the local version cd ${LOCAL_MIRROR} || exit 1 VERSION=`hg tip | grep changeset | grep -o "\([0-9]\+\):" | grep -o "\([0-9]\+\)"` || exit 1 echo "Current Version: ${VERSION}" cd ${CWD} rm -rf $PKG mkdir -p $TMP $PKG cd $TMP || exit 1 # Normally you would extract the source here... Still thinking on this # Other script to mirror and add to archive then decompress it here rm -rf trinitybuild mkdir -p trinitybuild || exit 1 cd trinitybuild || exit 1 cmake $LOCAL_MIRROR \ -DPREFIX=/opt/trinitycore \ -DCONF_DIR=/opt/trinitycore/etc \ -DDO_RA=1 \ -DDO_MYSQL=1 \ -DDO_SCRIPTS=1 \ -DDO_CLI=1 \ -DDO_SQL=1 \ -DCMAKE_CXX_FLAGS="${SLKCFLAGS}" \ -DCMAKE_C_FLAGS="${SLKCFLAGS}" \ -DCMAKE_EXE_LINKER_FLAGS=-lncurses \ -DCMAKE_SHARED_LINKER_FLAGS=-lncurses make $NUMJOBS || make || exit 1 make install DESTDIR=$PKG || exit 1 # -DACE_LIBRARY=/home/trinity/.sys/lib/libACE.so # -DACE_INCLUDE_DIR=/home/trinity/.sys/include/ # Strip binaries: ( cd $PKG find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | \ xargs strip --strip-unneeded 2> /dev/null || true find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | \ xargs strip --strip-unneeded 2> /dev/null || true ) # Remove old SQL scripts we don't need rm -rf $PKG/opt/trinitycore/share/trinity/sql/updates/*_old/ rm -rf $PKG/opt/trinitycore/share/trinity/sql/updates/2.4.3_updates/ mkdir $PKG/install cat > $PKG/install/slack-desc << EOF # HOW TO EDIT THIS FILE: # The "handy ruler" below makes it easier to edit a package description. Line # up the first '|' above the ':' following the base package name, and the '|' # on the right side marks the last column you can put a character in. You must # make exactly 11 lines for the formatting to be correct. It's also # customary to leave one space after the ':'. |-----handy-ruler------------------------------------------------------| trinitycore: Trinity Core trinitycore: trinitycore: Trinity is a combined MMOG-server core that includes scripting built trinitycore: into the core. Trinity is a fork of MaNGOS. trinitycore: trinitycore: Homepage: http://www.trinitycore.org/ trinitycore: trinitycore: trinitycore: trinitycore: trinitycore: EOF # Build the package cd $PKG /sbin/makepkg -l y -c n $TMP/$PKGNAM-r$VERSION-$ARCH-$BUILD$TAG.txz