slackbuilds_ponce/audio/mp3val/mp3val.SlackBuild
2016-08-20 07:50:03 +07:00

116 lines
3.1 KiB
Bash

#!/bin/sh
# Written by Benjamin Trigona-Harany <slackbuilds@jaxartes.net>
# Modified by B. Watson <yalhcru@gmail.com>
# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
# 20140921 bkw: bump BUILD to 2
# - took over maintenance
# - add man page
# - add mp3valgui and GUI=no to disable it
# - make SLKCFLAGS actually get used
# - patch to fix -Wwrite-strings warnings, future-proofing since this may
# become an error someday.
# - minor script cleanups
PRGNAM=mp3val
VERSION=${VERSION:-0.1.8}
BUILD=${BUILD:-2}
TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) export ARCH=i586 ;;
arm*) export ARCH=arm ;;
*) export ARCH=$( uname -m ) ;;
esac
fi
CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
if [ "$ARCH" = "i586" ]; then
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
else
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
fi
set -e
SRCNAM=$PRGNAM-$VERSION-src
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $SRCNAM
tar xvf $CWD/$SRCNAM.tar.gz
cd $SRCNAM
# upstream's permissions are horrid, please don't change this to boilerplate
chown -R root:root .
chmod 644 *
# this isn't strictly necessary for Slack 14.1, but at some point these
# warnings might possibly become errors in some future version of gcc.
zcat $CWD/fix_compile_warnings.diff.gz | patch -p1
make -f Makefile.linux CXXFLAGS="$SLKCFLAGS"
mkdir -p $PKG/usr/bin
install -s -m0755 $PRGNAM $PKG/usr/bin
# man page converted from manual.html with html2pod | pod2man
mkdir -p $PKG/usr/man/man1
gzip -9c < $CWD/$PRGNAM.1 > $PKG/usr/man/man1/$PRGNAM.1.gz
# package the GUI unless disabled
if [ "${GUI:-yes}" = "yes" ]; then
GUINAME=${PRGNAM}gui
GUIVER=${GUIVER:-0.1.1}
unzip $CWD/$GUINAME-$GUIVER.zip
cd $GUINAME
# damn thing expects to find its .glade file somewhere in $PATH or the
# current dir. Let's use /usr/share/mp3valgui/ instead.
sed -i \
'/gladefile *= *locate/s,=.*,= "/usr/share/'$GUINAME/$GUINAME.glade'",' \
$GUINAME.py
mkdir -p $PKG/usr/share/$GUINAME
install -m0755 $GUINAME.py $PKG/usr/bin/$GUINAME
cat $GUINAME.glade > $PKG/usr/share/$GUINAME/$GUINAME.glade
# .desktop taken from mandriva's mp3valgui-0.1.1-1mdv2007.1.noarch.rpm
# and modified.
mkdir -p $PKG/usr/share/applications
cat $CWD/$GUINAME.desktop > $PKG/usr/share/applications/$GUINAME.desktop
# .xpm icon is a modified copy of windowmaker's Microphone.xpm
mkdir -p $PKG/usr/share/pixmaps
cat $CWD/$GUINAME.xpm > $PKG/usr/share/pixmaps/$GUINAME.xpm
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/$GUINAME-$GUIVER
cp -a AUTHORS COPYING NEWS $PKG/usr/doc/$PRGNAM-$VERSION/$GUINAME-$GUIVER
cd -
fi
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a changelog.txt manual.html $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
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}