aboutsummaryrefslogtreecommitdiff
path: root/audio/mktoc/mktoc.SlackBuild
blob: abb98e26a4fbb73e06b829aa2ca91e700f1c03d8 (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
#!/bin/bash

# Slackware build script for mktoc

# Written by Luis Henrique <email removed>
# Now maintained by B. Watson <yalhcru@gmail.com>

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

# 20180111 bkw:
# - take over maintenance
# - BUILD=2
# - i486 => i586
# - don't include the install instructions in the package
# - get rid of some useless boilerplate
# - fix upstream typo/illiteracy: you LOSE information, you don't LOOSE it!
#   (sorry, this is a pet peeve, I can't not fix it)
# - add man page, basically upstream's README

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

PRGNAM=mktoc
VERSION=${VERSION:-1.3}
BUILD=${BUILD:-2}
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 the variable PRINT_PACKAGE_NAME is set, then this script will report what
# the name of the created package would be, and then exit. This information
# could be useful to other scripts.
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}

# 20180111 bkw: No CFLAGS here, this is pure Python code. Would be noarch,
# except for the lib vs lib64 thing.

set -e

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
cd $PRGNAM-$VERSION
chown -R root:root .
find . -type d -print0 | xargs -0 chmod 755
find . -type f -print0 | xargs -0 chmod 644

# You know, I never saw the "loose" for "lose" typo until the internet
# age. Does that mean computers make people illiterate?
patch -p1 < $CWD/lose_not_loose.diff

python setup.py install --root=$PKG

mkdir -p $PKG/usr/man/man1
gzip -9c $CWD/$PRGNAM.1 > $PKG/usr/man/man1/$PRGNAM.1.gz

mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a CHANGELOG.rst LICENSE PKG-INFO 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

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