aboutsummaryrefslogtreecommitdiff
path: root/system/kitty-bin/kitty-bin.SlackBuild
blob: 18f22b814beb63ca686cf262aad31b9d3de7c6f8 (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
#!/bin/bash

# Slackware build script for kitty-bin

# Written by B. Watson (urchlay@slackware.uk)

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

# Notes:

# This exists because building kitty from source requires the latest
# bleeding-edge google-go-lang, newer than we have in the repo, and
# because Go is just too fast-moving a target for me. At any given
# time, it's likely that the latest binaries will work before we're
# able to build our own. This means kitty-bin will probably be a bit
# newer version than the regular kitty build.

# Since upstream provides a 64-bit ARM binary bundle, this script can
# create an aarch64 package. I don't use ARM and haven't tested it.

# 20230715 bkw: update for v0.29.0.

# 20230630 bkw: BUILD=2
# - fix a major boo-boo: /usr/lib was being overwritten with a symlink
#   to lib64. this broke on multilib, badly.

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

PRGNAM=kitty-bin
SRCNAM=kitty
VERSION=${VERSION:-0.29.0}
BUILD=${BUILD:-1}
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 [ ! -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}

if [ "$ARCH" = "i586" ]; then
  SRCARCH=i686
elif [ "$ARCH" = "i686" ]; then
  SRCARCH=i686
elif [ "$ARCH" = "x86_64" ]; then
  SRCARCH=x86_64
  LIBDIR=lib64
elif [ "$ARCH" = "aarch64" ]; then
  SRCARCH=arm64
  LIBDIR=lib64
else
  echo "ARCH '$ARCH' not supported (only i586, i686, x86_64, aarch64)." 1>&1
  exit 1
fi

set -e

rm -rf $PKG
mkdir -p $TMP $PKG/usr $OUTPUT
cd $PKG/usr
tar xvf $CWD/$SRCNAM-$VERSION-$SRCARCH.txz
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 {} \+

# Use system shared libs. This works, for now, until upstream starts
# using newer ones. Removing the rpath isn't strictly necessary for
# 32-bit or pure 64-bit, but it's needed on multilib.
rm -rf lib/*.so.*
patchelf --remove-rpath bin/*

if [ -n "$LIBDIR" ]; then
  mv lib $LIBDIR
  mkdir -p lib
  ln -s ../$LIBDIR/kitty lib/kitty
  ln -s ../$LIBDIR/kitty-extensions lib/kitty-extensions
fi

# TODO: find out WTF lib/cacert.pem is intended to be used for, and
# whether or not kitty can find it at runtime. No idea currently.

mv share/man man
gzip -9 man/man*/*

PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
mkdir -p $PKGDOC
mv share/doc/kitty/* $PKGDOC
rm -rf share/doc
cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$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