PKGBUILD 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. # Maintainer (arch): Morten Linderud <foxboron@archlinux.org>
  2. # Maintainer (arch): Lukas Fleischer <lfleischer@archlinux.org>
  3. # Contributor: Pierre Neidhardt <ambrevar@gmail.com>
  4. # Contributor: Florian Bruhin (The Compiler) <archlinux.org@the-compiler.org>
  5. # Maintainer: Omar Vega Ramos <ovruni@gnu.org.pe>
  6. # Contributor: André Silva <emulatorman@hyperbola.info>
  7. # Contributor: bill-auger <bill-auger@programmer.net>
  8. # parabola changes and rationale:
  9. # - removed 'qt5-webengine' dependency
  10. # - set webkit backend as default
  11. # - condensed the excessive webkit rant on the welcome screen
  12. # - pin to strongly-coupled dependency versions
  13. # NOTE: Arch has no QT webkit. Parabola retains 'qt5-webkit' primarily
  14. # to support 'qutebrowser'.
  15. # Qt5 and webkit are supported upstream; but that may change.
  16. # Watch https://github.com/qutebrowser/qutebrowser/issues/4039
  17. # especiallly, WRT movableink/webkit + mnutt/PyQt6-QtWebKit.
  18. # NOTE: for each 'qt5-base' N.N.N release, build order:
  19. # (qt5-base-N.N.N) <- qt5-webkit <- python-pyqt5 <- qutebrowser
  20. # NOTE: for each ''python N.N release, build order:
  21. # (python-N.N) <- python-pyqt5 <- qutebrowser
  22. pkgname=qutebrowser
  23. pkgver=3.3.1
  24. pkgrel=2
  25. pkgrel+=.parabola1
  26. pkgdesc="A keyboard-driven, vim-like browser based on Python and Qt"
  27. pkgdesc+="/QtWebKit"
  28. arch=("any")
  29. arch=(armv7h i686 x86_64) # for per arch version constraints
  30. url="https://www.qutebrowser.org/"
  31. license=("GPL-3.0-only")
  32. depends=("python-jinja" "python-pyqt6" "python-yaml" "qt6-base" "python-pyqt6-webengine")
  33. depends=( ${depends[*]/python-pyqt6-webengine/qt5-webkit} )
  34. depends=( ${depends[*]/python-pyqt6/python-pyqt5} )
  35. depends=( ${depends[*]/qt6-base/qt5-base} )
  36. makedepends=("asciidoc" "python-setuptools")
  37. makedepends=( ${makedepends[*]/asciidoc/asciidoc>=10.2.0} ) # for python3
  38. optdepends=("python-adblock: adblocking backend"
  39. "python-pygments"
  40. "pdfjs: displaying PDF in-browser")
  41. optdepends+=("gst-libav: media playback with qt5-webkit backend"
  42. "gst-plugins-base: media playback with qt5-webkit backend"
  43. "gst-plugins-good: media playback with qt5-webkit backend"
  44. "gst-plugins-bad: media playback with qt5-webkit backend"
  45. "gst-plugins-ugly: media playback with qt5-webkit backend")
  46. options=(!emptydirs)
  47. source=("https://github.com/qutebrowser/qutebrowser/releases/download/v$pkgver/qutebrowser-$pkgver.tar.gz"
  48. "https://github.com/qutebrowser/qutebrowser/releases/download/v$pkgver/qutebrowser-$pkgver.tar.gz.asc")
  49. source+=("warning-webkit.html")
  50. noextract=(qutebrowser-$pkgver.tar.gz) # for armv7h
  51. validpgpkeys=("27F3BB4FC217EECB858578AEEF7EE4D039690B7B")
  52. sha256sums=('aadb64accc730bc9a15ce341c9a0580b1f36383ed4874f54d31ce1dabe94e17a'
  53. 'SKIP')
  54. sha256sums+=('e18216f24387b61a109611958bb59248beaf5afc90da8654e29ea8b0a7ef1610')
  55. _version_constraint() # (dep_pkgname [precision])
  56. {
  57. Log() { [[ "${FUNCNAME[2]}" == package ]] && echo "$@" >&2 || : ; }
  58. local dep_pkgname=$1
  59. declare -i req_precision=$2
  60. local full_version=$(pacman -S --print-format='%v' ${dep_pkgname} 2> /dev/null | tail -n 1)
  61. local n_dots=$(tmp=${full_version%-*} ; tmp=${tmp//[^\.]} ; echo "${#tmp}" ;)
  62. local def_precision=$(( n_dots + 1 ))
  63. local is_prec_valid=$(( req_precision > 0 && req_precision <= def_precision ))
  64. local precision=$((( is_prec_valid )) && echo ${req_precision} || echo ${def_precision})
  65. local pkgver_rx='[0-9A-Za-z_]+'
  66. pkgver_rx=$(sed 's|\]|\+]|' <<<${pkgver_rx}) # according to the wiki, '+' is not allowed,
  67. # but some pkgver have it (eg: 5.15.10+kde+r130)
  68. local subver_rx='\.'${pkgver_rx}
  69. local pkgrel_rx='[0-9]+'
  70. local garbage_rx='[^0-9].*'
  71. local capture_rx=${pkgver_rx}
  72. for (( n_dots=1 ; n_dots < precision ; ++n_dots )) ; do capture_rx+=${subver_rx} ; done ;
  73. local version pkgrel has_dot_char version_min version_max constraint_string
  74. declare -i subver subver_inc pkgrel_inc
  75. if [[ "${full_version}" =~ ^(${capture_rx})(${subver_rx})*-(${pkgrel_rx}).*$ ]]
  76. then version=${BASH_REMATCH[1]} # pkgver cut to the requested precision
  77. #unused=${BASH_REMATCH[2]} # discarded pkgver segments
  78. pkgrel=${BASH_REMATCH[3]} # pkgrel with non-numerics right-trimmed
  79. has_dot_char=$([[ "${version}" =~ \. ]] ; echo $(( ! $? )) ; )
  80. subver=$(sed "s|${garbage_rx}||" <<<${version##*.}) # right-trim from any non-numeric
  81. version=$( (( has_dot_char )) && echo ${version%.*}.${subver} || echo ${subver} )
  82. subver_inc=$(( subver + 1 ))
  83. pkgrel_inc=$(( pkgrel + 1 ))
  84. version_min=$( (( ! is_prec_valid )) && echo ${full_version%-*}-${pkgrel} || \
  85. echo ${version} )
  86. version_max=$( ( (( ! is_prec_valid )) && echo ${full_version%-*}-${pkgrel_inc} ) || \
  87. ( [[ "${version}" =~ \. ]] && echo ${version%.*}.${subver_inc} ) || \
  88. echo ${subver_inc} )
  89. constraint_string="${dep_pkgname}>=${version_min} ${dep_pkgname}<${version_max}"
  90. Log "Applied version constraint: '${constraint_string}'"
  91. else Log "ERROR: in _version_constraint() parsing: dep_pkgname='${dep_pkgname}' full_version='${full_version}'"
  92. exit 1
  93. fi
  94. unset -f Log
  95. echo -n "${constraint_string}"
  96. }
  97. prepare() {
  98. # for armv7h
  99. # bsdtar: Pathname can't be converted from UTF-8 to current locale
  100. tar xzf "$srcdir"/qutebrowser-$pkgver.tar.gz
  101. cd "qutebrowser-$pkgver/qutebrowser"
  102. # tone-down the webkit warning on the first-run welcome page
  103. cp "$srcdir"/warning-webkit.html html/
  104. # make sure webkit is the default backend
  105. sed -i 's|default: webengine|default: webkit|' config/configdata.yml
  106. ! grep 'default: webengine' config/configdata.yml ||
  107. ! echo "prepare() requires re-working - config still prefers webengine" || return 1
  108. # force QT5 support
  109. sed -i 's/_WRAPPER_OVERRIDE = .*/_WRAPPER_OVERRIDE = "PyQt5"/' qt/machinery.py
  110. }
  111. build() {
  112. cd "$pkgname-$pkgver"
  113. make -f misc/Makefile all
  114. }
  115. package() {
  116. # pin to strongly-coupled dependency versions
  117. depends=( $(_version_constraint python 2) \
  118. $(_version_constraint qt5-base 3) ${depends[*]%qt5-base} )
  119. cd "$pkgname-$pkgver"
  120. make -f misc/Makefile DESTDIR="$pkgdir" PREFIX=/usr install
  121. }