#!/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="libgphoto2" VERSION=2.4.0 ARCH=i586 BUILD=2vl59 VL_PACKAGER=exeterdad CWD=`pwd` cd ../ RELEASEDIR=`pwd` cd $CWD mkdir $RELEASEDIR/tmp 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 export CFLAGS="-O2 -march=i586 -mtune=i686" export CXXFLAGS="-O2 -march=i586 -mtune=i686" rm -rf $PKG mkdir -p $PKG cd $TMP rm -rf $NAME-$VERSION tar xjvf $CWD/$NAME-$VERSION.tar.bz2 || exit 1 #tar zxvf $CWD/$NAME-$VERSION.tar.gz || exit 1 cd $TMP/$NAME-$VERSION 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 {} \; echo "Here we go!" ./configure --prefix=/usr \ --sysconfdir=/etc \ --disable-static \ --localstatedir=/var/lib \ --mandir=/usr/man \ --with-drivers=all \ --with-included-gettext || exit 1 make || exit 1 make install DESTDIR=$PKG mkdir -p $PKG/usr/doc/$NAME-$VERSION mkdir -p $PKG/usr/doc mv $PKG/usr/share/doc/libgphoto2 $PKG/usr/doc/$NAME-$VERSION mv $PKG/usr/share/doc/libgphoto2_port $PKG/usr/doc/libgphoto2_port-$VERSION rm -rf $PKG/usr/share/doc cat $CWD/$NAME.SlackBuild > $PKG/usr/doc/$NAME-$VERSION/$NAME.SlackBuild find $PKG/usr/man -type f -exec gzip -9 {} \; 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 (Software for accessing digital cameras) $NAME: $NAME: The gPhoto2 project is a universal, free application and library $NAME: framework that lets you download images from several different $NAME: digital camera models, including the newer models with USB $NAME: connections. $NAME: $NAME: $NAME: License: LGPL $NAME: Author: Scott Fritzinger Many others. $NAME: Website: http://www.gphoto.org/ #---------------------------------------- BUILDDATE: `date` PACKAGER: $VL_PACKAGER HOST: `uname -srm` DISTRO: `cat /etc/vector-version` CFLAGS: $CFLAGS CONFIGURE: `awk "/\.\/configure\ /" $TMP/$NAME-$VERSION/config.log` 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 # Now this is where my script get's weird. We need to generate a set of udev rules so the users system will # know what to do with the usb camera when the kernel detects that it's been plugged in. We shouldn't send # along a generic set of rules as they need to match all the camera's these new drivers support. We can use a # doinst.sh to generate the rules and place them, but then we can't have a clean uninstall. So we're going # to make a temporary package, install it on our build machine, generate a set of rules to include them into # the "real" package. Then remove the temp package from our machine, and package up a "real" package containing # the udev rules. I've tried using the uninstalled files to generate, but naturally nothing runs because of # the paths aren't correct. If you come up with a better solution... go for it. # Create temp package as tgz since it's faster than tlz for now. echo "Creating temporary package $NAME-$VERSION-$ARCH-$BUILD.tgz" makepkg -l y -c n $RELEASEDIR/$NAME-$VERSION-$ARCH-$BUILD.tgz echo "Temporary install of new package..." installpkg $RELEASEDIR/$NAME-$VERSION-$ARCH-$BUILD.tgz echo "Creating dirs and generating new udev rules..." mkdir -p $PKG/etc/udev/rules.d # Create 30-libgphoto2.rules and head it with some useful info's cat > $PKG/etc/udev/rules.d/30-libgphoto2.rules << EOF # These libgphoto2.rules belong to VectorLinux package $NAME-$VERSION-$ARCH-$BUILD.tlz # if you have a different package installed, these rules may not match the camera drivers that # you have installed. To generate rules that match the drivers in your system. Simply run code below # in a console as root (make sure not to inclued the "#"). # # /usr/lib/libgphoto2/print-camera-list \\ # udev-rules version 0.98 group users mode 0660 \\ # > /etc/udev/rules.d/30-libgphoto2.rules # #____________________________________________________________________________________________________ EOF # This command generates rules and writes the file into $PKG/etc/udev/rules.d /usr/lib/libgphoto2/print-camera-list \ udev-rules version 0.98 group users mode 0660 \ >> $PKG/etc/udev/rules.d/30-libgphoto2.rules echo "Okay, rules generated, and written into package, now removing temp package from your system..." removepkg $RELEASEDIR/$NAME-$VERSION-$ARCH-$BUILD.tgz echo "$NAME-$VERSION-$ARCH-$BUILD.tgz is gone from your system now. Deleting..." rm $RELEASEDIR/$NAME-$VERSION-$ARCH-$BUILD.tgz echo "Now back to creating the real package..." 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"