]> git.friedersdorff.com Git - max/slackbuilds.git/blobdiff - network/qutebrowser/qutebrowser.SlackBuild
Add packages for qutebrowser and it's dependencies
[max/slackbuilds.git] / network / qutebrowser / qutebrowser.SlackBuild
diff --git a/network/qutebrowser/qutebrowser.SlackBuild b/network/qutebrowser/qutebrowser.SlackBuild
new file mode 100755 (executable)
index 0000000..5b96f96
--- /dev/null
@@ -0,0 +1,104 @@
+#!/bin/sh -e
+
+# Slackware build script for qutebrowser
+
+# Copyright 2017 Maximilian Friederdorff
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+
+# set up some variables for the build process
+CWD=$(pwd)
+if [ "$TMP" = "" ]; then
+  TMP=/tmp
+fi
+
+APP="qutebrowser"
+VERSION=${VERSION:-1.0.3}
+PKG_VERSION=$VERSION
+
+# Detect the architecture
+if [ -z "$ARCH" ]; then
+  case "$( uname -m )" in
+    i?86) export ARCH=i586 ;;
+    arm*) export ARCH=arm ;;
+    # Unless $ARCH is already set, use uname -m for all other archs:
+    *) export ARCH=$( uname -m ) ;;
+  esac
+fi
+
+if [ "$ARCH" = "i486" ]; then
+  SLKCFLAGS="-O2 -march=i486 -mtune=i686"
+elif [ "$ARCH" = "x86_64" ]; then
+  SLKCFLAGS="-O2 -fPIC"
+fi
+
+NUMJOBS=${NUMJOBS:-" -j4 "}
+
+BUILD=${BUILD:-1_maf}
+PKG=$TMP/package-$APP
+
+# Clean build location in case of previous build attempts
+rm -rf $PKG
+mkdir -p $TMP $PKG
+rm -rf $TMP/$APP-$VERSION
+
+cd $TMP || exit 1
+
+# Extract sources
+tar -zxvf $CWD/${APP}-${VERSION}-1.tar.gz || exit 1
+cd $APP-$VERSION || exit 1
+
+# Ensure ownership and permissions are consistant 
+chown -R root:root .
+chmod -R u+w,go+r-w,a-s .
+
+# Build and install
+python3 setup.py build
+python3 setup.py install --root="$PKG/" --optimize=1
+install -dm755 $PKG/usr/share/qutebrowser/userscripts
+find misc/userscripts -type f -exec install -m755 {} $PKG/usr/share/qutebrowser/userscripts \;
+
+# Install documentation
+a2x -f manpage doc/qutebrowser.1.asciidoc
+install -Dm644 doc/qutebrowser.1 $PKG/usr/man/man1/qutebrowser.1
+
+mkdir -p $PKG/usr/doc/$APP-$VERSION
+cp -a README.asciidoc LICENSE MANIFEST.in doc/ $PKG/usr/doc/$APP-$VERSION 
+find $PKG/usr/doc/$APP-$VERSION -type f -exec chmod 644 {} \;
+cat $CWD/$APP.SlackBuild > $PKG/usr/doc/$APP-$VERSION/$APP.SlackBuild
+
+# Install slack-desc file
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+
+# Strip some libraries and binaries
+
+# Compress man pages if they exist
+if [ -d $PKG/usr/man ]; then
+  ( cd $PKG/usr/man
+  find . -type f -exec gzip -9 {} \;
+  for i in $(find . -type l) ; do ln -s $(readlink $i).gz $i.gz ; rm $i ; done
+  ) 
+fi
+
+# Compress info pages if they exist (and remove the dir file)
+if [ -d $PKG/usr/info ]; then
+  gzip -9 $PKG/usr/info/*.info
+  rm -f $PKG/usr/info/dir
+fi
+
+# Make the package
+cd $PKG
+/sbin/makepkg -l y -c n $TMP/$APP-$PKG_VERSION-$ARCH-$BUILD.tgz