Skip to content

Instantly share code, notes, and snippets.

@pkillnine
Last active October 6, 2017 08:02
Show Gist options
  • Save pkillnine/fc1d620cc93832c9d7ced1eb36727da8 to your computer and use it in GitHub Desktop.
Save pkillnine/fc1d620cc93832c9d7ced1eb36727da8 to your computer and use it in GitHub Desktop.
qutebrowser slackbuild
PRGNAM="qutebrowser"
VERSION="git"
HOMEPAGE="https://www.qutebrowser.org/"
#DOWNLOAD="direct download link(s) of application source tarball(s) arch-independent or x86"
#MD5SUM="md5sum(s) of the source tarball(s) defined in DOWNLOAD"
#DOWNLOAD_x86_64="direct download link(s) of application source tarball(s), x86_64 only"
#MD5SUM_x86_64="md5sum(s) of the source tarball(s) defined in DOWNLOAD_x86_64"
REQUIRES="tox"
MAINTAINER="PKill-9"
EMAIL="none@none.com"
#!/bin/sh -e
# Slackware build script for qutebrowser (git-master)
APP=qutebrowser
VERSION=git
PKG_VERSION=$VERSION
ARCH=noarch
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
LIB_PREFIX=var/lib
BIN_PREFIX=usr/bin
LIB_DIR=$LIB_PREFIX/$APP
PKG=$(/usr/bin/mktemp -d -t qutebrowser.build-XXXXXX)
CWD=$(pwd)
if [ "$TMP" = "" ]; then
TMP=/tmp
fi
echo Building $APP in $PKG...
cd $PKG
mkdir -p $PKG/$LIB_DIR
cd $PKG/$LIB_DIR
/usr/bin/git init
/usr/bin/git remote add -t master origin https://github.com/qutebrowser/qutebrowser/
cd $PKG
mkdir -p $BIN_PREFIX
echo """#!/bin/sh
LIB_DIR=\$(dirname \$0)/$(realpath --relative-to=$PKG/$BIN_PREFIX $PKG/$LIB_DIR)
if [[ \$1 == "--help" ]]
then
echo Qutebrowser is installed at \$LIB_DIR
echo \'get-master\' to pull latest git master. \'get-requirements\' to reinstall requirements. \'get-all\' to get both.
exit
fi
#Add 'get-master' command to pull latest master with git.
if [[ \$1 == "get-master" ]]
then
cd \$LIB_DIR
git pull origin master
update-desktop-database
exit
fi
#Add 'get-requirements' command to reinstall requirements.
if [[ \$1 == "get-requirements" ]]
then
cd \$LIB_DIR
tox -r -e mkvenv-pypi
exit
fi
if [[ \$1 == "get-all" ]]
then
cd \$LIB_DIR
git pull origin master
update-desktop-database
tox -r -e mkvenv-pypi
exit
fi
if [ -f \$LIB_DIR/.venv/bin/activate ]
then
source \$LIB_DIR/.venv/bin/activate
else
echo \$LIB_DIR/.venv/bin/activate doesn\\'t exist.
exit 1
fi
if [ -f \$LIB_DIR/qutebrowser.py ]
then
\$LIB_DIR/qutebrowser.py
else
echo \$LIB_DIR/qutebrowser.py doesn\'t exist.
exit 1
fi""" > $BIN_PREFIX/$APP
chmod +x $BIN_PREFIX/$APP
#Finalise
#Need to make it use functions to make everything simpler.
#Add .desktop file and icon (with symlink cos it may update)
mkdir -p usr/share/applications
ln -s --relative $LIB_DIR/misc/qutebrowser.desktop usr/share/applications/qutebrowser.desktop
mkdir -p usr/share/icons/hicolor/scalable/apps
ln -s --relative $LIB_DIR/icons/qutebrowser.svg usr/share/icons/hicolor/scalable/apps/qutebrowser.svg
mkdir $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
if [ -e $CWD/doinst.sh.gz ]; then
zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh
fi
/sbin/makepkg -l y -c n $TMP/$APP-$PKG_VERSION-$ARCH-$BUILD-$TAG.tgz
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|' on
# the right side marks the last column you can put a character in. You must make
# exactly 11 lines for the formatting to be correct. It's also customary to
# leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
qutebrowser: Qutebrowser - A keyboard-driven, vim-like browser based on PyQt5.
qutebrowser:
qutebrowser: This version provides the git version that you can update at
qutebrowser: any time. It automatically grabs requirements using tox.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment