12 Jan 2008, 00:00

Slackware’s Slackbuilds modified for Slamd64

Here’s what I needed to add/modify to the Program.SlackBuild file downloaded from SlackBuilds:

ARCH=${ARCH:-x86_64} # modified
elif [ "$ARCH" = "x86_64"]; then # added
SLKCFLAGS="-O2 -fPIC" # added
LIBDIR=/usr/lib64 # added
fi

A complete example for libgphoto2:

#!/bin/sh

# Slackware build script for libgphoto2

# Written by Frank Caraballo
# No Guarantees. Use this SlackBuild at your own risk.
# Public Domain

# Modified by Michael Wagner
# (change group ownership for udev rules to plugdev, adjust README)
# Do not blame the original author if anything goes wrong with these changes.

# Modified by Robby Workman to fix a bug in
# the way the fdi files are created (the xml header must be the first line,
# so we can't append the autogenerated rules - they must overwrite the file)
# Thanks to amrit for the report.

PRGNAM=libgphoto2
VERSION=2.4.0
ARCH=${ARCH:-x86_64} # changes from i486
BUILD=${BUILD:-2}
TAG=${TAG:-_SBo}

CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}

DOCS="ABOUT-NLS ChangeLog HACKING INSTALL MAINTAINERS README.in TESTERS"

if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
elif [ "$ARCH" = "x86_64"]; then # added
SLKCFLAGS="-O2 -fPIC" # added
LIBDIR=/usr/lib64 # added
fi

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP || exit 1
rm -rf $PRGNAM-$VERSION
tar -xvjf $CWD/$PRGNAM-$VERSION.tar.bz2 || exit 1
cd $PRGNAM-$VERSION || exit 1
chown -R root:root .
chmod -R u+w,go+r-w,a-s .

CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
--prefix=/usr \
--disable-static \
--mandir=/usr/man \
--with-doc-dir=/usr/doc/$PRGNAM-$VERSION \
|| exit 1

make || exit 1

# Make sure udev helper scripts are put in the right place and
# install the other utilities to /usr/bin instead of /usr/lib/libgphoto2/
make \
udevscriptdir=/lib/udev \
utilsdir=/usr/bin \
install-strip DESTDIR=$PKG \
|| exit 1

# Install "dummy" udev rules file so it will be removed later if the package
# is uninstalled; the post-install script will append auto-generated rules
mkdir -p $PKG/etc/udev/rules.d
cat << EOF > $PKG/etc/udev/rules.d/90-libgphoto2.rules
# DO NOT EDIT THIS FILE!
# Any custom changes will be lost if the libgphoto package is upgraded.

EOF

mkdir -p $PKG/usr/share/hal/fdi/information/20thirdparty
touch $PKG/usr/share/hal/fdi/information/20thirdparty/10-camera-libgphoto2.fdi
touch $PKG/usr/share/hal/fdi/information/20thirdparty/10-camera-libgphoto2-device.fdi

# Compress man pages
( cd $PKG/usr/man
find . -type f -exec gzip -9 {} \;
for i in $(find . -type l) ; do ln -s $(readlink $i).gz $i.gz ; rm $i ; done
)

mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a $DOCS $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild

mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh

cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.tgz