aboutsummaryrefslogtreecommitdiff
path: root/misc/par/par.SlackBuild
blob: f7b1c7f7365fe8202ef4ffc7f860579c5026eff1 (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
#!/bin/sh

# Slackware build script for par
# Written by slakmagik <slakmagik@gmail.com>
# Released under the WTFPL
# Now maintained by B. Watson <yalhcru@gmail.com>

# 20200622 bkw:
# - Update for v1.53 (after *19 years*)
# - Correctly rm the source dir from previous runs
# - Fix mode 0700 top-level source dir (it's annoying)
# - i486 => i586
# - various tweaks
# - add default_env patch (see below)

PRGNAM=par
SRCNAM=Par
VERSION=${VERSION:-1.53.0}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}

if [ -z "$ARCH" ]; then
  case "$( uname -m )" in
    i?86) ARCH=i586 ;;
    arm*) ARCH=arm ;;
       *) 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

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $SRCNAM-$VERSION
tar xvf $CWD/$SRCNAM-$VERSION.tar.gz
cd $SRCNAM-$VERSION
chown -R root:root .
# please don't revert this to template:
chmod 755 .
chmod 644 *

# 20200622 bkw: the man page says to:
# $ export PARINIT="rTbgqR B=.,?'_A_a_@ Q=_s>|"
# before running. This one-line patch just makes that the default, if
# the PARINIT variable isn't set. This sets a reasonable default so
# users don't have to diddle their startup files.
[ "${PRISTINE:-no}" = "no" ] && patch -p1 < $CWD/default_env.diff

make -f protoMakefile CFLAGS="$SLKCFLAGS"
mkdir -p $PKG/usr/bin
install -m0755 -s $PRGNAM $PKG/usr/bin

# rename ".doc" so nothing thinks it's a word document.
mv $PRGNAM.doc $PRGNAM.txt
sed -i "s/$PRGNAM\.doc/$PRGNAM.txt/g" $PRGNAM.txt $PRGNAM.1

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

PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
mkdir -p $PKGDOC
cp -a $PRGNAM.txt releasenotes $PKGDOC
cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$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}