summaryrefslogtreecommitdiff
path: root/libre/qutebrowser/PKGBUILD
blob: cefc050c790a1b67f81f3e69e826b1fe3765a1df (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
# Maintainer (arch): Morten Linderud <foxboron@archlinux.org>
# Maintainer (arch): Lukas Fleischer <lfleischer@archlinux.org>
# Contributor: Pierre Neidhardt <ambrevar@gmail.com>
# Contributor: Florian Bruhin (The Compiler) <archlinux.org@the-compiler.org>
# Maintainer: Omar Vega Ramos <ovruni@gnu.org.pe>
# Contributor: André Silva <emulatorman@hyperbola.info>
# Contributor: bill-auger <bill-auger@programmer.net>


# parabola changes and rationale:
#   - removed qt5-webengine dependency
#   - set webkit backend as default
#   - condensed the excessive webkit rant on the welcome screen
#   - pin to strongly-coupled dependency versions
# NOTE: according to the release notes, v2.5.0 is the final release to support webkit
#       options:
#         * recover webkit support --> may be difficult to maintain
#         * freeze the version     --> does anyone want a frozen GUI web browser?
#         * blacklist it           --> RIP qutebrowser - parabola has plenty more :)


pkgname=qutebrowser
pkgver=2.5.0
pkgrel=1
pkgrel+=.parabola2
pkgdesc="A keyboard-driven, vim-like browser based on PyQt5"
pkgdesc+=" and QtWebKit"
arch=('armv7h' 'i686' 'x86_64') # per arch version constraints
url="https://www.qutebrowser.org/"
license=("GPL")
depends=("python-jinja" "python-pyqt5" "python-yaml" "qt5-base" "python-pyqtwebengine")
depends=( ${depends[*]/python-pyqtwebengine/qt5-webkit} )
makedepends=("asciidoc" "python-setuptools")
optdepends=("python-adblock: adblocking backend"
            "python-pygments"
            "gst-libav: media playback with qt5-webkit backend"
            "gst-plugins-base: media playback with qt5-webkit backend"
            "gst-plugins-good: media playback with qt5-webkit backend"
            "gst-plugins-bad: media playback with qt5-webkit backend"
            "gst-plugins-ugly: media playback with qt5-webkit backend"
            "pdfjs: displaying PDF in-browser"
)
options=(!emptydirs)
source=("https://github.com/qutebrowser/qutebrowser/releases/download/v$pkgver/qutebrowser-$pkgver.tar.gz"
        "https://github.com/qutebrowser/qutebrowser/releases/download/v$pkgver/qutebrowser-$pkgver.tar.gz.asc")
source+=("warning-webkit.html")
validpgpkeys=("E04E560002401B8EF0E76F0A916EB0C8FD55A072") # Florian Bruhin
sha256sums=('e18442a230570f25918a2e89ad4d073ace46c4f59b5fdda2e80ab3c4764451fd'
            'SKIP')
sha256sums+=('e18216f24387b61a109611958bb59248beaf5afc90da8654e29ea8b0a7ef1610')


_version_constraint() # (dep_pkgname [precision])
{
  local dep_pkgname=$1
  local full_version=$(pacman -S --print-format='%v' ${dep_pkgname} | tail -n 1)
  local n_dots=$(tmp=${full_version%-*} ; tmp=${tmp//[^\.]} ; echo "${#tmp}" ;)
  local def_precision=$(( n_dots + 1 ))
  local precision=$( [[ "$2" =~ ^[1-${def_precision}]$ ]] && echo $2 || echo ${def_precision} )
  local pkgver_rx='[^-\.\ ]+'
  local subver_rx='\.'${pkgver_rx}
  local pkgrel_rx='[^-\ ]+'
  local capture_rx=${pkgver_rx}
  for (( n_dots=1 ; n_dots < precision ; n_dots++ )) ; do capture_rx+=${subver_rx} ; done ;

  if   [[ "${full_version}" =~ ^(${capture_rx})(${subver_rx})*-${pkgrel_rx}$ ]]
  then local version=${BASH_REMATCH[1]}
       local subver_inc=$(( ${version##*.} + 1 ))
       local version_inc=$( [[ "${version}" =~ \. ]] && echo ${version%.*}.${subver_inc} || \
                                                        echo ${subver_inc}                  )
       local constraint_string="${dep_pkgname}>=${version} ${dep_pkgname}<${version_inc}"

       echo "applied version constraint: ${constraint_string}" >&2
       echo -n "${constraint_string}"
  else echo "ERROR: _version_constraint() error parsing: dep_pkgname='${dep_pkgname}' full_version='${full_version}'" >&2
       exit 1
  fi
}

prepare() {
    cd "$pkgname-$pkgver"

    cp "$srcdir"/warning-webkit.html qutebrowser/html/

    # make sure webkit is the default backend
    sed -i 's/webengine/webkit/' qutebrowser/config/configdata.yml
}

build() {
    cd "$pkgname-$pkgver"
    make -f misc/Makefile all
}

package() {
    cd "$pkgname-$pkgver"
    make -f misc/Makefile DESTDIR="$pkgdir" PREFIX=/usr install

    depends+=( $(_version_constraint python       2) \
               $(_version_constraint python-pyqt5  ) \
               $(_version_constraint qt5-base      ) )

}