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

# Slackware build script for podget

# Copyright (c) 2008-2010, Antonio Hernández Blas <email removed>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1.- Redistributions of source code 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.

# 20210223 bkw: update for v0.8.8
# 20201103 bkw:
# - update for v0.8.7
# - fix CRLF removal
# - redo README and slack-desc
# 20200619 bkw: BUILD=2, apparently nobody (including me) ever noticed
# that v0.8.6 didn't actually work on Slackware 14.2.
# 20191130 bkw: update for v0.8.6
# 20170712 bkw:
# - Take over as maintainer
# - Update for v0.8.5
# - Get rid of CRLF line endings in a couple of the scripts
# - Minor cleanups

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

PRGNAM=podget
VERSION=${VERSION:-0.8.8}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}

ARCH=noarch

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

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 -L .  -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
        \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+

# 20170712 bkw: get rid of DOS/Win line endings.
# 20201103 bkw: turns out there's an embedded \r in podget that's
# supposed to be there, so the regex becomes \r$ instead of \r.
find . -type f | \
  xargs file | \
  grep 'ASCII.*LF' | \
  cut -d: -f1 | \
  xargs sed -i 's,\r$,,' \
|| true

# 20200619 bkw: 14.2's creaky old bash 4.3 doesn't support
# inherit_errexit, which is a feature of bash 4.4 and up. The sed
# command below allows the script to run without it, which will change
# some of the error handling a bit, but won't actually break anything
# when there *aren't* errors. Previous versions of podget got along just
# fine without inherit_errexit...
# 20201103 bkw: upstream added checking code, this had to change some.
sed -i '/shopt *inherit_errexit/,/shopt *-s *inherit_errexit/s,^,## ,' \
       $PRGNAM

# 20201103 bkw: change hardcoded paths
sed -i \
  -e "s,share/man,man,g" \
  -e "s,share/doc/$PRGNAM,doc/$PRGNAM-$VERSION," \
  Makefile

make -j1 prefix=/usr DESTDIR=$PKG install

mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/scripts
cp -a COPYING README $PKG/usr/doc/$PRGNAM-$VERSION
cp -r SCRIPTS/* $PKG/usr/doc/$PRGNAM-$VERSION/scripts
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 -p $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE