Some SlackBuild scripts for Slackware.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

168 lines
4.5 KiB

#! /bin/sh
#
# by: H4kTeUr - http://www.slackbuilds.net < h4kteur at slackbuilds dot net >
# Copyright 2007, 2008 H4kTeUr. All rights reserved.
#
# Redistribution and use of this software, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this software must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Latest id3v2 sourcecode is available at http://id3v2.sourceforge.net
# Depends: l/id3lib
set -e
CWD=$(pwd)
TMP=${TMP:-/tmp}
PKG=${PKG:-$TMP/package-id3v2}
OUT=${OUT:-$TMP/build}
# version on the tarball
VERSION=${VERSION:-0.1.11}
# version used in the source directory to cd into
DIRVER=${DIRVER:-0.1.11}
# version used for the Slackware package
PKGVER=${PKGVER:-0.1.11}
# target
ARCH=${ARCH:-i486}
BUILD=${BUILD:-2_SBn}
# set tarball download link
SOURCE=${SOURCE:-http://switch.dl.sourceforge.net/sourceforge/id3v2/id3v2-$VERSION.tar.gz}
ARCHIVE=$(basename $SOURCE)
# sanity checks
if [ "$(id -u)" = "0" ]; then
echo "Do not run this SlackBuild as ROOT !"
exit 1
fi
if [ ! -d $TMP ]; then
mkdir -p $TMP
fi
# download the tarball if it's not found
if [ ! -r $ARCHIVE ]; then
echo "Downloading $ARCHIVE..."
rm -f $ARCHIVE.part
wget -vc $SOURCE -O $ARCHIVE.part
mv $ARCHIVE.part $ARCHIVE
fi
# check SHA1 sums
if [ -r $ARCHIVE.sha1 ]; then
sha1sum -c $ARCHIVE.sha1
else
echo "$ARCHIVE.sha1 SHA1 sums not found !"
exit 1
fi
if [ "$ARCH" = "i386" ]; then
SLKCFLAGS="-O2 -march=i386 -mcpu=i686"
elif [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2"
fi
# cleanup
rm -rf $PKG
mkdir -p $PKG
# extraction
cd $TMP
rm -rf id3v2-$DIRVER
tar -xvf $CWD/id3v2-$VERSION.tar.gz
cd id3v2-$DIRVER
# make sure ownerships and permissions are sane
chmod -R a-s,u+rw,go-w+r .
for patch in fix-gcc-4.2 fix-segfault; do
if [ -r $CWD/patches/id3v2-$VERSION-$patch.patch ]; then
cat $CWD/patches/id3v2-$VERSION-$patch.patch | patch -p1
else
echo "ERROR: No id3v2-$VERSION-$patch.patch found!"
exit 1
fi
done
# build
CXXFLAGS=$SLKCFLAGS \
make PREFIX=/usr -j3
# add the install directories
mkdir -p $PKG/usr/bin
mkdir -p $PKG/usr/man/man1
# install
install -m 755 id3v2 $PKG/usr/bin
nroff -man id3v2.1 > $PKG/usr/man/man1/id3v2.1
# strip binaries
echo "Stripping binaries..."
find $PKG -type f | xargs file | grep "LSB executable" | cut -f 1 -d : | \
xargs strip --strip-unneeded 2> /dev/null || \
echo "No binaries to strip..."
# compress and link manpages, if any
echo "Compressing man pages..."
if [ -d $PKG/usr/man ]; then
find $PKG/usr/man -type f -name "*.?" -exec gzip -9 {} \;
for manpage in $(find $PKG/usr/man -type l) ; do
ln -s $(readlink $manpage).gz $manpage.gz
rm -f $manpage
done
fi
# add a documentation directory
echo "Adding documentation package..."
mkdir -p $PKG/usr/doc/id3v2-$PKGVER
install -p -m 644 \
COPYING INSTALL README \
$PKG/usr/doc/id3v2-$PKGVER
# build the package
mkdir -p $PKG/install
if [ -r $CWD/slack-desc ]; then
install -m 644 $CWD/slack-desc $PKG/install
fi
if [ -r $CWD/doinst.sh ]; then
install -m 755 $CWD/doinst.sh $PKG/install
fi
cd $PKG
PACKAGING="
chown -R root.root .
find . -perm 664 -exec chmod 644 {} \;
find . -perm 777 -exec chmod 755 {} \;
mkdir -p $OUT
rm -f $OUT/id3v2-$PKGVER-$ARCH-$BUILD.tgz
/sbin/makepkg -l y -c n $OUT/id3v2-$PKGVER-$ARCH-$BUILD.tgz
rm -rf $PKG
rm -rf $TMP/id3v2-$DIRVER
"
if [ "$(which fakeroot 2> /dev/null)" ]; then
echo "$PACKAGING" | fakeroot
else
su -c "$PACKAGING"
fi
exit 0