#!/usr/bin/bash # This SlackBuild like script is designed for Vector Linux packages by exeterdad. # This script assumes it will be launched within "/NAME/VERSION/src" dir. With all sources in "src" # Your Vector Linux .tlz package, slack-desc, and slack-required will be found in "VERSION" dir. # The extraction and build will be in a temp dir created in "NAME" dir, and then removed on exit. # Comment out last line to keep this dir intact. NAME="compiz-fusion" VERSION=`date +%Y%m%d` ARCH=i586 BUILD=1vl59 VL_PACKAGER=exeterdad CWD=`pwd` cd ../ RELEASEDIR=`pwd` cd $CWD mkdir -p $RELEASEDIR/tmp/git TMP=$RELEASEDIR/tmp PKG=$TMP/package-$NAME if [ $UID != 0 ]; then echo "You need to be root to run this script." exit fi if [ ! -x /usr/bin/requiredbuilder ]; then echo "Requiredbuilder not installed, or not executable." exit fi # Check for git if [ -z "$(which git-clone)" ]; then echo "You must have GIT installed to use this script. Install the git-core package." exit 1; fi if [ -z "$(which git-pull)" ]; then echo "You must have GIT installed to use this script. Install the git-core package." exit 1; fi if [ ! -f /usr/include/libwnck*/libwnck/libwnck.h ]; then echo "Compiz needs libwnck installed to compile. Please install the libwnck package." exit 1; fi if [ ! -f /usr/bin/pyrexc ];then echo "Pyrex is needed to continue, please install pyrex package" exit 1; fi export CFLAGS="-O2 -march=i586 -mtune=i686" export CXXFLAGS="-O2 -march=i586 -mtune=i686" rm -rf $PKG mkdir -p $PKG cd $TMP/git giturl='git://anongit.compiz-fusion.org/' PKGS=' compiz fusion/libraries/bcop fusion/compizconfig/libcompizconfig fusion/compizconfig/compizconfig-python fusion/compizconfig/ccsm fusion/decorators/emerald fusion/plugins-main users/crdlb/fusion-icon fusion/decorators/emerald-themes fusion/plugins-extra fusion/plugins-unsupported' perms () { echo "Setting permissions..." chown -R root:root . find . -perm 664 -exec chmod 644 {} \; find . -perm 777 -exec chmod 755 {} \; find . -perm 2777 -exec chmod 755 {} \; find . -perm 775 -exec chmod 755 {} \; find . -perm 2755 -exec chmod 755 {} \; find . -perm 774 -exec chmod 644 {} \; find . -perm 666 -exec chmod 644 {} \; find . -perm 600 -exec chmod 644 {} \; find . -perm 444 -exec chmod 644 {} \; find . -perm 400 -exec chmod 644 {} \; find . -perm 440 -exec chmod 644 {} \; find . -perm 511 -exec chmod 755 {} \; find . -perm 711 -exec chmod 755 {} \; find . -perm 555 -exec chmod 755 {} \; } mkdocs () { cd $TMP/git/$1 TMPPKG=$2 mkdir -p $TMPPKG/usr/doc/$NAME-$VERSION/$1 for DOC in AUTHORS COPYING* ChangeLog INSTALL NEWS README TODO VERSION; do if [ -e $DOC ]; then cp -a $DOC $TMPPKG/usr/doc/$NAME-$VERSION/$1/$DOC fi done if [ $1 = "emerald" ]; then gzip -9 $TMPPKG/usr/man/*/* fi } installboth () { TMPPKG=$2 cd $TMPPKG echo "Temporary install into build machine complete." echo "Moving files to final package staging area..." tar cf - . | (cd $PKG && tar xvBf -) makepkg -l y -c n $TMP/dummy-$1-$VERSION-$ARCH-$BUILD.tgz installpkg $TMP/dummy-$1-$VERSION-$ARCH-$BUILD.tgz echo "dummy-$1-$VERSION-$ARCH-$BUILD.tgz" >> $TMP/dummypkg.log } cleanhost () { for installed in `cat $TMP/dummypkg.log`; do removepkg $installed done echo "Dummy packages removed from build machine." rm $TMP/dummypkg.log } getgits () { cd $TMP/git for TARGETURL in $PKGS; do echo "Using git to download `basename ${TARGETURL}` files" git clone ${giturl}${TARGETURL} done } build () { echo "Building for $1" echo TMPPKG=$TMP/$1 mkdir -p $TMPPKG cd $TMP/git/$1 || exit 1 perms if [ $1 = "fusion-icon" ] || [ $1 = "ccsm" ]; then python setup.py install --prefix=/usr --root=$TMPPKG || exit 1 else ./autogen.sh \ --prefix=/usr \ --sysconfdir=/etc \ --mandir=/usr/man \ --with-included-gettext \ --enable-librsvg \ --disable-gnome \ --disable-kde \ --disable-metacity \ --build=i486-slackware-linux || exit 1 make || exit 1 make install DESTDIR=$TMPPKG || exit 1 fi mkdocs $1 $TMPPKG installboth $1 $TMPPKG } domods () { # Create launcher cat > $PKG/usr/bin/compiz-fusion.sh << EOF #!/usr/bin/bash unset XLIB_SKIP_ARGB_VISUALS && fusion-icon EOF chmod +x $PKG/usr/bin/compiz-fusion.sh sed -i 's|Exec=fusion-icon|Exec=compiz-fusion.sh|' $PKG/usr/share/applications/fusion-icon.desktop cp $CWD/CAP-1.png $PKG/usr/share/compiz/fusioncap.png cp $CWD/global.xml $PKG/usr/share/compizconfig/global.xml # Category icons in ccm are broken, can't fix, for now disable here. ccmfile=$PKG/usr/lib/python2.5/site-packages/ccm/Window.py sed -i 's|align.add (categoryToggleIcon)|#align.add (categoryToggleIcon)|' $ccmfile sed -i 's|if categoryImg:|#if categoryImg:|' $ccmfile sed -i 's|categoryHeader.pack_start(categoryImg|#categoryHeader.pack_start(categoryImg|' $ccmfile } ######################################################################################### # # Program start # ######################################################################################### getgits for TARGET in $PKGS; do TARGET=`basename $TARGET` build $TARGET done cleanhost domods # Phew! Are we still alive? Back to a normal package. cat $CWD/$NAME.SlackBuild > $PKG/usr/doc/$NAME-$VERSION/$NAME.SlackBuild mkdir -p $PKG/install # This creates the white space in front of "handy-ruler" in slack-desc below. LENGTH=`expr length "$NAME"` SPACES=0 SHIM="" until [ "$SPACES" = "$LENGTH" ]; do SHIM="$SHIM " let SPACES=$SPACES+1 done cat > $RELEASEDIR/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 ':'. $SHIM|-----handy-ruler------------------------------------------------------| $NAME: $NAME (OpenGL window and compositing manager) $NAME: $NAME: Compiz-fusion is an OpenGL compositing manager that is a merge $NAME: between the well-known Beryl composite window manager and Compiz $NAME: extras. It has a flexible plug-in system and it is designed to run $NAME: well on most graphics hardware. This package has everything needed $NAME: for a full install. Main, extra and unsupported plugins are included. $NAME: $NAME: License: GPL LGPL MIT $NAME: Author: David Reveman & others. See docs. $NAME: Website: http://www.compiz-fusion.org/ #---------------------------------------- BUILDDATE: `date` PACKAGER: $VL_PACKAGER HOST: `uname -srm` DISTRO: `cat /etc/vector-version` CFLAGS: $CFLAGS CONFIGURE: --prefix=/usr --sysconfdir=/etc --mandir=/usr/man --with-included-gettext --enable-librsvg --disable-gnome --disable-kde --disable-metacity --build=i486-slackware-linux EOF cat $RELEASEDIR/slack-desc > $PKG/install/slack-desc cd $PKG echo " " echo "Stripping...." echo " " find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null echo "Finding dependancies..." requiredbuilder -v -y -s $RELEASEDIR $PKG echo "Creating package $NAME-$VERSION-$ARCH-$BUILD.tlz" makepkg -l y -c n $RELEASEDIR/$NAME-$VERSION-$ARCH-$BUILD.tlz cd $CWD echo "Cleaning up temp files..." #rm -rf $TMP echo "Done"