#!/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=gtk+2 VERSION=2.10.11 ARCH=i586 RELEASE=4vl58 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 #We're going to need requiredbuilder for this package, so #lets check if its installed first: if [ ! -x /usr/bin/requiredbuilder ]; then echoc "You don't have requiredbuilder installed" red echoc "Can't let you make the package boss!" 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" ./configure --prefix=${PREFIX} \ --sysconfdir=${SYSCONF} \ --mandir=${PREFIX}/man \ --with-included-gettext \ --with-x-input=yes cp ${CWD}/slack-desc ./ #Write build information to the end of "description-pak": cat >> slack-desc << 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 -j3 if ( ! make ); then echoc "Make failed!" red exit fi #GTK has to be installed old-school: make DESTDIR=${REBUILD_DIR} install #According to Patrick Volkerding, GTK's shell profiles "might" still #be necessary, so best to include them. #Also, insert VectorLinux 5.8's GTK configuration files just #in case the orignal GTK package decided to nuke them: mkdir ${REBUILD_DIR}/install mv ./slack-desc ${REBUILD_DIR}/install cd ${REBUILD_DIR} mkdir -p ./etc/profile.d/ mkdir ./etc/gtk-2.0/ cp ${CWD}/gtk+2-etc-files-vl58.tar.bz2 ./ tar xvf gtk+2-etc-files-vl58.tar.bz2 cp -a ./gtk+2-etc-files-vl58/profile.d/* ./etc/profile.d/ cp -a ./gtk+2-etc-files-vl58/gtk-2.0/* ./etc/gtk-2.0/ rm -rf gtk+2-etc-files-vl58* #Here are a few extra hacks to be added to doinst.sh #to ensura that all existing GTK based stuff like Xfce #continues to work: cat >> ./install/doinst.sh << EOF #Backup gtk-2.0: cd /usr/lib cp -r ./gtk-2.0 ./gtk-2.0.backup #Copy old engines and loaders to 2.10.0/ cd ./gtk-2.0 cp -a ./2.4.0/engines/* ./2.10.0/engines/ cp -a ./2.4.0/loaders/* ./2.10.0/loaders/ rm -rf ./2.4.0 #Make a symlink for backwards compatability: ln -sf 2.10.0 2.4.0 #Refresh mime-types database: update-mime-database /usr/share/mime EOF #Write package dependencies and build the package: requiredbuilder -v -y ./ makepkg -l y -p -c n ${PKG_NAME} cp ${PKG_NAME} ${PKG_DEST} #Do some spring-cleaning (or not): if [ $CLEANUP = "Y" ]; then rm -rf $BUILD_DIR fi #EOF