#!/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=git VERSION=1.5.1.2 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 #Check if RequiredBuilder is installed, if not then exit: if [ ! -e /usr/bin/requiredbuilder ]; then echoc "RequiredBuilder isn't installed, exiting..." red exit fi #The Glibc iconv is necessary to build Git (Slackware - Vector #conflict thing...) mv /usr/include/iconv.h /usr/include/iconv.h.backup cp ${CWD}/iconv.h-glibc-2.3.6 /usr/include/iconv.h #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" #Give root ownership of the files: chown -R root.root ./ 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 #Git doesn't use a configure script for its sources, nor does #passing arguments to make seem to work 100% so a pre-configured #Makefile should be used for packaging purposes rm ./Makefile cp ${CWD}/Makefile ./ make if ( ! make ); then echoc "Make failed!" red exit fi #Checkinstall doesn't seem to work properly with Git either, so #build the package manually: mkdir ${REBUILD_DIR}/install cp ./slack-desc ${REBUILD_DIR}/install make DESTDIR=${REBUILD_DIR} install cd ${REBUILD_DIR} requiredbuilder -v -y ./ makepkg -l y -c n ${PKG_NAME} cp ${PKG_NAME} ${PKG_DEST} #REstore iconv.h to its original state: rm /usr/include/iconv.h mv /usr/include/iconv.h.backup /usr/include/iconv.h #Do some spring-cleaning (or not): if [ $CLEANUP = "Y" ]; then rm -rf $BUILD_DIR fi #EOF