aboutsummaryrefslogtreecommitdiff
path: root/audio/stretchplayer/stretchplayer.SlackBuild
blob: 75176fd1f42a04e5b5e72ea6e7b42b03f8f22102 (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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#!/bin/bash

# Slackware build script for stretchplayer

# Written by B. Watson (urchlay@slackware.uk)

# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.

# Upstream git is: https://gitlab.com/stretchplayer/stretchplayer.git
# Latest commits there are post 0.503 release, development
# stopped in 2014. Lots of nice new features there, including mp3
# support. Unfortunately building the latest git code results in a
# stretchplayer that segfaults on startup, and I don't have a fix, so
# I didn't try to package that. I did cherry-pick one commit though.

##### TODO:
# on every exit (close with the close button):
# corrupted double-linked list
# Aborted

cd $(dirname $0) ; CWD=$(pwd)

PRGNAM=stretchplayer
VERSION=${VERSION:-0.503_4}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}

if [ -z "$ARCH" ]; then
  case "$( uname -m )" in
    i?86) ARCH=i586 ;;
    arm*) ARCH=arm ;;
       *) ARCH=$( uname -m ) ;;
  esac
fi

if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  exit 0
fi

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

SRCVER="$( echo $VERSION | cut -d_ -f1 )"
DEBVER="$( echo $VERSION | cut -d_ -f2 )"

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$SRCVER
tar xvf $CWD/${PRGNAM}_$SRCVER.orig.tar.gz
cd $PRGNAM-$SRCVER
tar xvf $CWD/${PRGNAM}_$SRCVER-$DEBVER.debian.tar.xz
chown -R root:root .
find -L .  -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
        \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+

# Apply Debian's patches, especially qt5.diff!
for i in $( cat debian/patches/series ); do
  patch -p1 < debian/patches/$i
done

# Patch by SlackBuild author. Allows tuning up and down by 10 cents
# (1/10 of a semitone) when holding the Shift key, or 1 cent when
# holding Control. Helps with stuff that was recorded slightly out of
# tune, or mastered from ancient tapes. Patch was sent upstream, but
# upstream isn't responding.
patch -p1 < $CWD/fine_tuning.diff

# Patch from upstream git, changes the stretch range from 25%-125%.
# commit a3e0f1f.
patch -p1 < $CWD/stretch_25_125.diff

mkdir -p build
cd build
  cmake \
    -DENABLE_UNIT_TESTS=OFF \
    -DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \
    -DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DLIB_SUFFIX=${LIBDIRSUFFIX} \
    -DMAN_INSTALL_DIR=/usr/man \
    -DCMAKE_BUILD_TYPE=Release ..
  make
  make install/strip DESTDIR=$PKG
cd ..

# man page by SlackBuild author. Based on the Debian one, but
# includes a list of keystrokes.
mkdir -p $PKG/usr/man/man1
gzip -9c < $CWD/$PRGNAM.1 > $PKG/usr/man/man1/$PRGNAM.1.gz

# I don't think stretchplayer needs this at runtime:
rm -rf $PKG/usr/share/$PRGNAM $PKG/usr/share/icons

for i in art/$PRGNAM-icon-*.png; do
  size="$( basename $i .png | cut -d- -f3 )"
  mkdir -p $PKG/usr/share/icons/hicolor/$size/apps
  cp -a $i $PKG/usr/share/icons/hicolor/$size/apps/$PRGNAM.png
done
mkdir -p $PKG/usr/share/icons/hicolor/scalable/apps
cp -a art/$PRGNAM-icon.svg $PKG/usr/share/icons/hicolor/scalable/apps/$PRGNAM.svg

rm $PKG/usr/share/pixmaps/*
ln -s ../icons/hicolor/48x48/apps/$PRGNAM.png $PKG/usr/share/pixmaps/$PRGNAM.png

sed -i "/^Icon/s,=.*,=$PRGNAM," $PKG/usr/share/applications/$PRGNAM.desktop

mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a AUTHORS BUGS* COPYING ChangeLog README* $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

if [ "${SETCAP:-yes}" = "yes" ]; then
  cat $CWD/setcap.sh >> $PKG/install/doinst.sh
  chown root:audio $PKG/usr/bin/$PRGNAM
  chmod 0750 $PKG/usr/bin/$PRGNAM
fi

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