#!/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. # ########################################################## #Notice: glib-2.12.11.tar.bz2 was renamed to #glib2-2.12.11.tar.bz2 to suit the needs of this script. TMP=/tmp CWD=`pwd` NAME=glib2 VERSION=2.12.10 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 #Make sure the packages have their own directory: if [ ! -d ${PKG_DEST} ]; then mkdir -p ${PKG_DEST} fi #Here goes a nasty hack to allow Glib2 to build against #Glibc's iconv.h header while leaving libiconv intact: if [ ! -f /usr/include/iconv.h-libiconv ]; then mv /usr/include/iconv.h /usr/include/iconv.h-libiconv cp ${CWD}/iconv.h-glibc-2.3.6 /usr/include/iconv.h 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 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 -j3 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