aboutsummaryrefslogtreecommitdiff
path: root/audio/mp3val/mp3val.SlackBuild
blob: 436bf332b3b892f176537961ee9c3738730d0bfb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#!/bin/bash

# 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}