summaryrefslogtreecommitdiffstats
path: root/desktop/xpra/xpra.SlackBuild
blob: 4c0239070a7d0fbad80b15a99d63f9b93ba90ffd (about) (plain) (blame)
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
#!/bin/bash

# Slackware build script for xpra

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

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

# 20240126 bkw: update for v5.0.4.
# - add xpra-html5-10.1, by request from Andrew Randrianasulu.
# - make the config files .new!
# 20230112 bkw: update for v4.4.3.
# 20221217 bkw: BUILD=2.
# - fix paths in config file (do not include $PKG).

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

PRGNAM=xpra
VERSION=${VERSION:-5.0.4}
HTML5VER=${HTML5VER:-10.1}
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 SLKCFLAGS because I don't see how to force setup.py to use it.
# no LIBDIRSUFFIX needed.

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
tar xvf $CWD/xpra-html5-$HTML5VER.tar.gz
tar xvf $CWD/$PRGNAM-$VERSION-prebuilt-docs.tar.xz
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 {} +

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

# without-strict turns off -Werror. without-docs because we don't want
# pandoc *and its 139 deps* as a dependency. Include prebuilt docs
# instead.
# 20230112 bkw: pandoc now has 196 deps... Could use pandoc-bin, but
# it doesn't do 32-bit. Still using prebuilt docs for now.
python3 setup.py install \
  --root=$PKG \
  --without-docs \
  --without-strict \
  --without-debug

# 20221217 bkw: grrr. $PKG getting hardcoded in config file.
sed -i "s,$PKG,,g" $PKG/etc/xpra/conf.d/55_server_x11.conf

# 20230112 bkw: a few things are getting installed in the wrong place.
mkdir -p $PKG/lib
mv $PKG/usr/lib/udev $PKG/lib
if [ -d $PKG/usr/lib64 ]; then
  mv $PKG/usr/lib/cups $PKG/usr/lib64
fi

# /usr/lib/{sysusers.d,tmpfiles.d} are for systemd. Apparently they
# are in the correct place, I'll leave them there (they won't hurt
# anything and apparently there are Slackware derivatives that use
# systemd).
# rm -rf $PKG/usr/lib/{sysusers.d,tmpfiles.d}

# This is *much* faster than using 'file' to classify them.
find $PKG/usr/lib* -name '*.so' | xargs strip --strip-unneeded

gzip -9 $PKG/usr/man/man?/*

# put the icons in the right places.
cd $PKG/usr/share/icons
  for i in *.png; do
    px="$( identify $i | cut -d' ' -f3 )"
    mkdir -p hicolor/$px/apps
    mv $i hicolor/$px/apps
  done
cd -

mkdir -p $PKG/usr/share/pixmaps
ln -s ../icons/hicolor/64x64/apps/$PRGNAM.png $PKG/usr/share/pixmaps/$PRGNAM.png

PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
mkdir -p $PKGDOC/html

# Instead of requiring pandoc's insanely long chain of deps, use
# prebuilt docs. See mkdoc.sh for details.
cp -a $PRGNAM-$VERSION-prebuilt-docs/* $PKGDOC/html

# 20240127 bkw: include the html5 server-side stuff.
# Nonstandard setup.py, uses positional arguments, undocumented.
# Adapted from packaging/rpm/xpra-html5.spec in the xpra-html5 src, and
# from looking at the finished rpm package. See also the doinst.sh!
cd xpra-html5-$HTML5VER
  python3 setup.py install $PKG /usr/share/xpra/www/ /etc/xpra/html5-client copy
  mkdir $PKGDOC/xpra-html5-$HTML5VER
  # The RPM doesn't include these, but they look useful:
  cp -a LICENSE *.md docs $PKGDOC/xpra-html5-$HTML5VER
cd -

cp -a COPYING README.md $PKGDOC
cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild

# 20240127 bkw: lots of config files. Maybe not all of them are really meant
# to be user-edited, but it's easier to treat them all the same way here.
find $PKG/etc/xpra -type f | while read f; do
  mv $f $f.new
done

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