aboutsummaryrefslogtreecommitdiff
path: root/libraries/remglk/remglk.SlackBuild
blob: f485f9a57708c5bbead4c342b8a54b9678717e49 (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
#!/bin/sh

# Slackware build script for remglk

# Written by B. Watson (yalhcru@gmail.com)

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

PRGNAM=remglk
VERSION=${VERSION:-0.2.6}
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}

# Note: Using -Os here rather than -O2, since we're building a static
# library. Upstream doesn't do shared libs, and this de-bloats the
# static lib by around 15%. Please don't change this.
if [ "$ARCH" = "i586" ]; then
  SLKCFLAGS="-Os -march=i586 -mtune=i686"
  LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
  SLKCFLAGS="-Os -march=i686 -mtune=i686"
  LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
  SLKCFLAGS="-Os -fPIC"
  LIBDIRSUFFIX="64"
else
  SLKCFLAGS="-Os"
  LIBDIRSUFFIX=""
fi

set -e

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$PRGNAM-$VERSION.tar.gz
cd $PRGNAM-$PRGNAM-$VERSION

# no subdirs, no need for template find stuff
chown -R root:root .
chmod 644 *

make OPTIONS="$SLKCFLAGS"

# Cuidado! strip strips too much from a static lib by default.
strip --strip-unneeded lib$PRGNAM.a

# Headers go in /usr/include/remglk, because glktermw installs
# identically-named (but slightly different) headers.
# Make.remglk really shouldn't go in /usr/include, it's *not* a C
# include (it's a Makefile include), but that's where upstream wants it,
# and where stuff that builds with glktermw looks for it (?)
# The Makefile says we only need to install glk.h and glkstart.h,
# but fizmo wants to include gi_blorb.h. Also gi_dispa.h looks like
# public API stuff.
mkdir -p $PKG/usr/lib$LIBDIRSUFFIX $PKG/usr/include/$PRGNAM
cat lib$PRGNAM.a > $PKG/usr/lib$LIBDIRSUFFIX/lib$PRGNAM.a
for i in glk.h glkstart.h Make.$PRGNAM gi_*.h; do
  cat $i > $PKG/usr/include/$PRGNAM/$i
done

mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a *.txt *.html LICENSE $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}