aboutsummaryrefslogtreecommitdiff
path: root/network/canto-next/canto-next.SlackBuild
blob: 45e470312c04ed72ef230cca252e8b7d8e6efb14 (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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#!/bin/bash

# Slackware build script for canto-next

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

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

# This replaces the old abandoned canto SlackBuild, which was for canto 0.7.x.

# Note that the plugins are installed to /usr/lib/canto, even on
# 64-bit. This isn't a problem: they're Python scripts (not shared
# libs), and they don't even get used from their default location.
# You have to copy them to ~/.config/canto/plugins to use them.
# I considered changing this to /usr/share/canto, but I decided to
# leave upstream's default as-is.

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

PRGNAM=canto-next
VERSION=${VERSION:-0.9.8}
CURSVER=${CURSVER:-0.9.9}
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}

# No compiler flags or libdir stuff needed: setup.py knows what to do.

set -e

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-build
mkdir -p $PRGNAM-build
cd $PRGNAM-build
TOPDIR=$(pwd)
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
tar xvf $CWD/canto-curses-$CURSVER.tar.gz
chown -R root:root .
find . ! -type l    -a \
  \(     -perm /111 -a ! -perm 755 -a -exec chmod -f 755 {} + \) -o \
  \(   ! -perm /111 -a ! -perm 644 -a -exec chmod -f 644 {} + \)

# 20251213 bkw: This builds fine with Slackware 15.0's old
# python-setuptools on either 32-bit x86 or pure (non-multilib)
# x86_64. If we're on multilib, the old setuptools has a hard-coded
# -L/usr/lib that causes the build to fail if 32-bit libncursesw
# and/or libreadline are installed.  Using the new setuptools on SBo
# works, but I don't want to put it in REQUIRES for everyone.

if [ -e /lib64/libc.so.6 -a -e /lib/libc.so.6 ]; then
  PYVER=$(python3 -c 'import sys; print("%d.%d" % sys.version_info[:2])')
  export PYTHONPATH=/opt/python$PYVER/site-packages
  if [ ! -d $PYTHONPATH/setuptools ]; then
    cat <<EOF

*** You are trying to build on a multilib system. For this to work, you
*** must install python3-setuptools-opt and re-run this script.

EOF
    exit 1
  fi
fi

sed -i 's,share/man/,man/,' */setup.py

cd $PRGNAM-$VERSION
python3 setup.py install --root=$PKG

cd $TOPDIR/canto-curses-$CURSVER

# 20251214 bkw: Pressing the spacebar on a feed title (rather than
# an article) causes a scary-looking stack trace in the UI. Patched
# by the SlackBuild author.
patch -p1 < $CWD/fix_exception.diff

# 20251214 bkw: These 2 came from upstream git, by way of Gentoo.
# Not needed on 15.0, but helpful for -current.
patch -p1 < $CWD/drop_pipes_import.diff
patch -p1 < $CWD/missing_headers.diff

python3 setup.py install --root=$PKG

strip $PKG/usr/lib*/python*/site-packages/canto_curses/*.so
gzip -9 $PKG/usr/man/man*/*

# Don't need, and including it can be misleading.
rm -rf $PKG/usr/lib/systemd

# Icon is internet-news-reader.svg from the Tango icon theme.
for i in $CWD/icons/*.png; do
  px="$( basename $i .png )"
  dir=$PKG/usr/share/icons/hicolor/${px}x${px}/apps
  mkdir -p $dir
  cat $i > $dir/$PRGNAM.png
done

PXMAP=$PKG/usr/share/pixmaps
mkdir -p $PXMAP
ln -s ../icons/hicolor/48x48/apps/$PRGNAM.png $PXMAP/$PRGNAM.png

# .desktop written by SlackBuild author.
mkdir -p $PKG/usr/share/applications
cat $CWD/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop

# Don't bother with the READMEs, they're basically content-free. The real
# docs are the man pages.
PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
mkdir -p $PKGDOC
cp -a COPYING $PKGDOC
cat $CWD/README > $PKGDOC/README
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
cat $CWD/doinst.sh > $PKG/install/douninst.sh

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