#!/bin/bash ########################################################## #VBuild - Package build script for use on VectorLinux 5.8# ########################################################## #Eugene Suter # #You are free to modify this scrip under the terms of the# #GNU General Public License. # ########################################################## TMP=/tmp CWD=`pwd` NAME=glitz VERSION=0.5.6 ARCH=i586 RELEASE=5vl58 SYSCONF=/etc PREFIX=/usr BUILD_DIR=${TMP}/${NAME}-package REBUILD_DIR=${BUILD_DIR}/rebuild TARBALL_NAME=${NAME}-${VERSION}.tar.* #Chose between tgz, tlz org tbz package formats here. PKG_FORMAT=.tlz PKG_DEST=${TMP}/finished-packages PKG_NAME=${NAME}-${VERSION}-${ARCH}-${RELEASE}${PKG_FORMAT} CLEANUP=Y VL_PACKAGER=easuter #Check if user has super user privilages: if [ ${UID} != 0 ]; then echoc "You need to be root to run this script." red exit fi #Make sure the packages have their own directory: if [ ! -d ${PKG_DEST} ]; then mkdir -p ${PKG_DEST} fi #Clean out the build space first and then make the #necessary directories, extract the sources and enter the #package source tree: rm -rf ${BUILD_DIR} mkdir -p ${BUILD_DIR} mkdir -p ${REBUILD_DIR} cd ${BUILD_DIR} cp ${CWD}/${TARBALL_NAME} ./ tar xvf ${BUILD_DIR}/${TARBALL_NAME} cd ${NAME}-${VERSION} if [ $ARCH = "i586" ]; then export CFLAGS="-O2 -mtune=i686 -march=i586" fi if [ $ARCH = "i486" ]; then export CFLAGS="-O2 -mtune=i686 -march=i486" fi if [ $ARCH = "i386" ]; then export CFLAGS="-O2 -mtune=i686 -march=i386" fi export CXXFLAGS="$CFLAGS" chown -R root.root ./ ./configure --prefix=${PREFIX} \ --sysconfdir=${SYSCONF} \ --mandir=${PREFIX}/man \ --with-included-gettext \ --enable-agl \ --enable-wgl cp ${CWD}/slack-desc ./description-pak #Write build information to the end of "description-pak": cat >> description-pak << EOF #---------------------------------------- BUILDDATE: `date` PACKAGER: $VL_PACKAGER HOST: `uname -srm` DISTRO: `cat /etc/vector-version` CFLAGS: $CFLAGS CONFIGURE: `awk "/\.\/configure\ /" config.log` EOF #Build the sources and exit if it fails. make if ( ! make ); then echoc "Make failed!" red exit fi #For convenience, use checkinstall to make the package, find dependencies #and strip binaries and libraries: if [ ${PKG_FORMAT} = ".tlz" ]; then CHKINST_TYPE="-L" elif [ ${PKG_FORMAT} = ".tgz" ]; then CHKINST_TYPE="-G" else CHKINST_TYPE="-B" fi checkinstall ${CHKINST_TYPE} -y --pkgarch=${ARCH} --pkgversion=${VERSION} --pkgrelease=${RELEASE} --pkgname=${NAME} if [ ! -f ${PKG_NAME} ]; then echoc "No package seems to have been made." red echoc "Exiting :(" red exit fi cp ${PKG_NAME} ${PKG_DEST} #Any package rebuilding (to include things like extra symlinks, etc) is #done here: #Do some spring-cleaning (or not): if [ $CLEANUP = "Y" ]; then rm -rf $BUILD_DIR fi #EOF