]> git.friedersdorff.com Git - max/slackbuilds.git/blob - network/qutebrowser/qutebrowser.SlackBuild
Add packages for qutebrowser and it's dependencies
[max/slackbuilds.git] / network / qutebrowser / qutebrowser.SlackBuild
1 #!/bin/sh -e
2
3 # Slackware build script for qutebrowser
4
5 # Copyright 2017 Maximilian Friederdorff
6
7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
11
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU General Public License for more details.
16
17 # You should have received a copy of the GNU General Public License
18 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
20
21 # set up some variables for the build process
22 CWD=$(pwd)
23 if [ "$TMP" = "" ]; then
24   TMP=/tmp
25 fi
26
27 APP="qutebrowser"
28 VERSION=${VERSION:-1.0.3}
29 PKG_VERSION=$VERSION
30
31 # Detect the architecture
32 if [ -z "$ARCH" ]; then
33   case "$( uname -m )" in
34     i?86) export ARCH=i586 ;;
35     arm*) export ARCH=arm ;;
36     # Unless $ARCH is already set, use uname -m for all other archs:
37     *) export ARCH=$( uname -m ) ;;
38   esac
39 fi
40
41 if [ "$ARCH" = "i486" ]; then
42   SLKCFLAGS="-O2 -march=i486 -mtune=i686"
43 elif [ "$ARCH" = "x86_64" ]; then
44   SLKCFLAGS="-O2 -fPIC"
45 fi
46
47 NUMJOBS=${NUMJOBS:-" -j4 "}
48
49 BUILD=${BUILD:-1_maf}
50 PKG=$TMP/package-$APP
51
52 # Clean build location in case of previous build attempts
53 rm -rf $PKG
54 mkdir -p $TMP $PKG
55 rm -rf $TMP/$APP-$VERSION
56
57 cd $TMP || exit 1
58
59 # Extract sources
60 tar -zxvf $CWD/${APP}-${VERSION}-1.tar.gz || exit 1
61 cd $APP-$VERSION || exit 1
62
63 # Ensure ownership and permissions are consistant 
64 chown -R root:root .
65 chmod -R u+w,go+r-w,a-s .
66
67 # Build and install
68 python3 setup.py build
69 python3 setup.py install --root="$PKG/" --optimize=1
70 install -dm755 $PKG/usr/share/qutebrowser/userscripts
71 find misc/userscripts -type f -exec install -m755 {} $PKG/usr/share/qutebrowser/userscripts \;
72
73 # Install documentation
74 a2x -f manpage doc/qutebrowser.1.asciidoc
75 install -Dm644 doc/qutebrowser.1 $PKG/usr/man/man1/qutebrowser.1
76
77 mkdir -p $PKG/usr/doc/$APP-$VERSION
78 cp -a README.asciidoc LICENSE MANIFEST.in doc/ $PKG/usr/doc/$APP-$VERSION 
79 find $PKG/usr/doc/$APP-$VERSION -type f -exec chmod 644 {} \;
80 cat $CWD/$APP.SlackBuild > $PKG/usr/doc/$APP-$VERSION/$APP.SlackBuild
81
82 # Install slack-desc file
83 mkdir -p $PKG/install
84 cat $CWD/slack-desc > $PKG/install/slack-desc
85
86 # Strip some libraries and binaries
87
88 # Compress man pages if they exist
89 if [ -d $PKG/usr/man ]; then
90   ( cd $PKG/usr/man
91   find . -type f -exec gzip -9 {} \;
92   for i in $(find . -type l) ; do ln -s $(readlink $i).gz $i.gz ; rm $i ; done
93   ) 
94 fi
95
96 # Compress info pages if they exist (and remove the dir file)
97 if [ -d $PKG/usr/info ]; then
98   gzip -9 $PKG/usr/info/*.info
99   rm -f $PKG/usr/info/dir
100 fi
101
102 # Make the package
103 cd $PKG
104 /sbin/makepkg -l y -c n $TMP/$APP-$PKG_VERSION-$ARCH-$BUILD.tgz