My First SlackBuild

October 8, 2006 at 12:44 am Leave a comment

I put together my first SlackBuild file today. I love making packages for Slackware, but I’ve never made a packaged that wasn’t installed to a temp directory and then tarred.

Hopefully I can build better packages this way. Feel free to comment on the script. I’m still learning and I know I probably forgot something.

# /bin/bash
#
# SlackBuild script for xpad
# HOME: http://xpad.sourceforge.net/
#
# last modified 10/07/06

clear

# main variables
PROG=xpad
VERSION=2.12
ARCH=i686
BUILD=2
NAME=$PROG-$VERSION
SLACKDESC=~/slack-desc.xpad

# build directories
TMP=/tmp
PKGTMP=$TMP/tmp-$NAME
SRC=$PKGTMP/$NAME
PKGROOT=$PKGTMP/build
DOC=$PKGROOT/usr/doc/$NAME

# dowload variables
SOURCEFORGE=http://superb-west.dl.sourceforge.net/sourceforge
TARBALL_URL=$SOURCEFORGE/$PROG/$NAME.tar.bz2

############################################################

# setup build enviorment
if [ -d $PKGTMP ]
then
	rm -rf $PKGTMP
	mkdir -vp $PKGTMP
	mkdir -vp $PKGROOT
else
	mkdir -vp $PKGTMP
	mkdir -vp $PKGROOT
fi


cd $PKGTMP

# download and extract the source
wget $TARBALL_URL
tar jxvf $NAME.tar.bz2

# build from source
cd $SRC

if [ "$ARCH" = "i386" ]; then
  SLKCFLAGS="-O2 -march=i386 -mtune=i686"
elif [ "$ARCH" = "i486" ]; then
  SLKCFLAGS="-O2 -march=i486 -mtune=i686"
elif [ "$ARCH" = "i586" ]; then
  SLKCFLAGS="-O2 -march=i586 -mtune=i686"
elif [ "$ARCH" = "i686" ]; then
  SLKCFLAGS="-O2 -march=i686 -mtune=i686"
fi

CFLAGS="$SLKFLAGS"
CXXFLAGS="$SLKFLAGS"

./configure --prefix=/usr \
            --sysconfdir=/etc \
	    --localstatedir=/var
make -j3
make install DESTDIR=$PKGROOT

# make doc dir
if [ ! -d $DOC ]
then
	mkdir -pv $DOC
fi

cp -av AUTHORS COPYING ChangeLog INSTALL Makefile NEWS README THANKS TODO $DOC

# gzip man pages
for i in $PKGROOT/usr/man/*/*
do
	gzip --best -v $i
done

# populate /install
mkdir -vp $PKGROOT/install
cat $SLACKDESC > $PKGROOT/install/slack-desc

# make the package
cd $PKGROOT
chown -R root:root *
/sbin/makepkg -l y -c n $HOME/$PROG-$VERSION-$ARCH-leh$BUILD.tgz
Advertisements

Entry filed under: Uncategorized. Tags: , , , .

Upgrading to Slackware-Current Hacking Lego StarWars

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Trackback this post  |  Subscribe to the comments via RSS Feed


Feeds


%d bloggers like this: