summaryrefslogtreecommitdiffstats
path: root/office/re-typeset/re-typeset.SlackBuild
blob: 5fe1fab0c69815f909b85ddd014ec1f5c5a39884 (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
#!/bin/sh

# Slackware build script for re-typeset

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

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

PRGNAM=re-typeset
VERSION=${VERSION:-1.2.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}

# No need for SLKCFLAGS or LIBDIRSUFFIX.

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 {} \+

# The Language menu doesn't actually work. For now, it's disabled,
# unless/until someone fixes it (upstream? me? *you*?). If you build
# with LANGMENU=yes, you'll see the menu with 2 entries (English
# and Polish), but it won't actually *do* anything. With LANGMENU=no,
# the UI is English only.
LANGMENU="${LANGMENU:-no}"

if [ "$LANGMENU" = "yes" ]; then
  # Look in /usr/share/$PRGNAM for language icons and translations.
  patch -p1 < $CWD/paths.diff
else
  # Remove the Languages menu entirely.
  patch -p1 < $CWD/rm_lang_menu.diff
fi

# The Makefile is a mess... and it's intended for the author's particular
# setup with various cross-compilers installed in his home directory &
# such. Fortunately we can just do this for a native build (and qmake-qt5
# will set CXXFLAGS to the SLKCFLAGS it was compiled with, too):
cd $PRGNAM-src
qmake-qt5
make

# No install target, just put everything where it goes.
mkdir -p $PKG/usr/bin $PKG/usr/share/pixmaps
install -s -m0755 $PRGNAM $PKG/usr/bin
cat img/$PRGNAM.png > $PKG/usr/share/pixmaps/$PRGNAM.png

if [ "$LANGMENU" = "yes" ]; then
  # Translations don't get built automatically.
  mkdir -p $PKG/usr/share/$PRGNAM
  lrelease-qt5 lang/*.ts
  for i in img/??.png lang/*.qm; do
    cat $i > $PKG/usr/share/$PRGNAM/$( basename $i )
  done
fi

# .desktop file written by SlackBuild author. Sorry about the lame little
# 16x16 icon, it's all upstream gave us.
mkdir -p $PKG/usr/share/applications
cat $CWD/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop

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

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