summaryrefslogtreecommitdiffstats
path: root/development/kakoune/kakoune.SlackBuild
blob: fda7cbd93209c9b19c71ffbc8730ccccc8dabfa0 (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
#!/bin/bash

# Slackware build script for kakoune

# Oritinally written by Leonardo Citrolo.
# Now maintained by B. Watson (urchlay@slackware.uk).

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

# 20231108 bkw: update for v2023.08.05.
# 20230509 bkw:
# - new maintainer.
# - update for v2022.10.31.
# - relicense as WTFPL with permission from original author.
# - override -O3 with $SLKCFLAGS.

# Note: I (B. Watson) took over this build to keep it from
# disappearing from the repo, but if you actually use and enjoy
# kakoune, please take the build from me (ask via email). I can't
# stand to actually use kakoune (tried it, utterly hate it, sorry).

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

PRGNAM=kakoune
VERSION=${VERSION:-2023.08.05}
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
  SLKCFLAGS="-O2 -march=i586 -mtune=i686"
elif [ "$ARCH" = "i686" ]; then
  SLKCFLAGS="-O2 -march=i686 -mtune=i686"
elif [ "$ARCH" = "x86_64" ]; then
  SLKCFLAGS="-O2 -fPIC"
else
  SLKCFLAGS="-O2"
fi

set -e

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.bz2
cd $PRGNAM-$VERSION
chown -R root:root .
rm libexec/kak/kak   # dangling symlink
find -L .  -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
        \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+

# N.B. slightly nonstandard use of DESTDIR: we have to include $PKG
# in docdir and mandir, below.
PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION

sed -i "s,-O3,$SLKCFLAGS," src/Makefile
make -C src PREFIX=/usr
strip src/kak
make -C src \
  PREFIX=/usr \
  docdir=$PKGDOC \
  mandir=$PKG/usr/man/man1 \
  DESTDIR=$PKG \
  install

# Man page already gzipped, we stripped the binary above. Thought
# about symlinking all the asciidoc from /usr/share/kak to our doc
# dir, but it's intended to be read from within kak, with the :doc
# command.

cp -a CONTRIBUTING UNLICENSE VIMTOKAK $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