aboutsummaryrefslogtreecommitdiff
path: root/network/qutebrowser-tox/qutebrowser-tox.SlackBuild
blob: b78916e01a200009827b3b95da11436f5a17d5d3 (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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#!/bin/sh

# Slackware build script for qutebrowser-tox

# Copyright 2019-2020, Alexander Verbovetsky, Moscow, Russia
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
#
#  THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
#  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
#  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
#  EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
#  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
#  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
#  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
#  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
#  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
#  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

PRGNAM=qutebrowser-tox
VERSION=${VERSION:-1.10.1}
SSLVERSION=${SSLVERSION:-1.1.1d}
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

if [ "$ARCH" != "x86_64" ]; then
  echo "Only x86_64 is supported."
  exit 1
fi

CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}

set -e

rm -rf $PKG
mkdir -p $TMP $PKG/opt $OUTPUT
cd $PKG/opt
tar xvf $CWD/qutebrowser-$VERSION.tar.gz
mv qutebrowser-$VERSION qutebrowser
cd qutebrowser
sed -i.bak "s|\(run_venv(venv_dir, 'python3', '-m', 'pip', 'install',\)|\1 \
'--no-index', '--find-links=$CWD/',|" scripts/mkvenv.py

chown -R root:root .
find -L . \
 \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  -o -perm 511 \) -exec chmod 755 {} \; -o \
 \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;

python3 scripts/mkvenv.py

mv scripts/mkvenv.py.bak scripts/mkvenv.py

find ./ -type f -name '*.pyc' -delete
find ./ -type d -name '__pycache__' -delete
find ./ -type f -exec sed -i -e "s|$PKG||" {} \;
find ./ -type f -exec sed -i -e \
  '1,2 s|^#!/usr/bin/env python.*$|#!/opt/qutebrowser/.venv/bin/python3|' {} \;
.venv/bin/python3 -m compileall scripts/__init__.py \
  scripts/setupcommon.py scripts/utils.py -fq
.venv/bin/python3 -m compileall .venv/lib -fq

.venv/bin/python3 scripts/asciidoc2html.py
a2x -f manpage doc/qutebrowser.1.asciidoc
gzip -9 doc/qutebrowser.1
mkdir -p $PKG/usr/man/man1
mv doc/qutebrowser.1.gz $PKG/usr/man/man1

mkdir -p $PKG/usr/share/{metainfo,applications,icons/hicolor/scalable/apps,pixmaps,qutebrowser/pdf.js}
install -m 0644 misc/org.qutebrowser.qutebrowser.appdata.xml \
  $PKG/usr/share/metainfo/
install -m 0644 misc/org.qutebrowser.qutebrowser.desktop \
  $PKG/usr/share/applications
for res in 16 24 32 48 64 96 128 256 512; do
  mkdir -p $PKG/usr/share/icons/hicolor/${res}x${res}/apps/;
  install -m 0644 "icons/qutebrowser-${res}x${res}.png" \
"$PKG/usr/share/icons/hicolor/${res}x${res}/apps/qutebrowser.png"
done
install -m 0644 "icons/qutebrowser.svg" \
  $PKG/usr/share/icons/hicolor/scalable/apps/
install -m 0644 "icons/qutebrowser.xpm" $PKG/usr/share/pixmaps/

cp -a misc/userscripts $PKG/usr/share/qutebrowser
cp -a scripts $PKG/usr/share/qutebrowser
rm -rf $PKG/usr/share/qutebrowser/scripts/{__pycache__,dev,testbrowser,__init__.py,asciidoc2html.py,setupcommon.py,link_pyqt.py}

mkdir -p $PKG/usr/bin
install -m 0755 -o root -g root $CWD/wrapper.qutebrowser \
  $PKG/usr/bin/qutebrowser

find ./ -type f -exec sed -i -e \
  's|/usr/share/pdf.js|/usr/share/qutebrowser/pdf.js|' {} \;
cd $PKG/usr/share/qutebrowser/pdf.js
unzip $CWD/pdfjs-*-dist.zip
chown -R root:root $PKG/usr/share/qutebrowser/pdf.js
find ./ -type f -exec chmod 644 {} \;

cd $TMP
rm -rf openssl-$SSLVERSION
tar xvf $CWD/openssl-$SSLVERSION.tar.gz
cd openssl-$SSLVERSION
./config \
 zlib \
 enable-camellia \
 enable-seed \
 enable-rfc3779 \
 enable-cms \
 enable-md2 \
 enable-rc5 \
 enable-ssl3 \
 enable-ssl3-method \
 no-weak-ssl-ciphers \
 no-mdc2 \
 no-ec2m \
 no-idea \
 no-sse2 \
 shared

make

mv libcrypto.so.1.1 libssl.so.1.1 $PKG/opt/qutebrowser
cd $PKG/opt/qutebrowser

find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true

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