PKGBUILD 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. # Maintainer (aur): Fabio 'Lolix' Loli <fabio.loli@disroot.org>
  2. # Contributor: Zen Wen <zen.8841@gmail.com>
  3. # Contributor: Felix Yan <felixonmars@archlinux.org>
  4. # Contributor: Antonio Rojas <arojas@archlinux.org>
  5. # Contributor: Andrea Scarpino <andrea@archlinux.org>
  6. # Maintainer: Parabola Hackers <dev@lists.parabola.nu>
  7. # Contributor: bill-auger <bill-auger@programmer.net>
  8. # parabola changes and rationale:
  9. # - blacklist rescue for webengine clients which support webkit
  10. # - pin to strongly-coupled dependency versions
  11. # NOTE: for each qt5-base N.N.N release, build order:
  12. # (qt5-base-N.N.N) <- qt5-webkit <- python-pyqt5 <- qutebrowser
  13. # <- qt5-styleplugins
  14. pkgname=qt5-webkit
  15. _pkgver=5.212.0-alpha4
  16. pkgver=${_pkgver/-/}
  17. pkgrel=26
  18. pkgrel+=.parabola2
  19. arch=(x86_64 aarch64)
  20. arch+=(armv7h i686)
  21. url="https://github.com/qtwebkit/qtwebkit"
  22. license=(LGPL-2.1-only)
  23. # TODO: the licensing of 'qt5-webkit' is not clear (needs review)
  24. # the AUR 'qt5-webkit' PKGBUILD has not yet migrated to SPDX
  25. # LGPL-2.1-only is only a guess - there is a LGPL2.1 file in the root dir;
  26. # but is not obvious which or if any files are covered by it
  27. # at least one license is not accounted for
  28. # (the BSD-like license from apple in many files)
  29. pkgdesc="Classes for a WebKit2 based implementation and a new QML API"
  30. source=("https://github.com/qtwebkit/qtwebkit/releases/download/qtwebkit-$_pkgver/qtwebkit-${_pkgver}.tar.xz"
  31. "https://src.fedoraproject.org/rpms/qt5-qtwebkit/raw/rawhide/f/qtwebkit-cstdint.patch"
  32. "https://src.fedoraproject.org/rpms/qt5-qtwebkit/raw/rawhide/f/qtwebkit-fix-build-gcc14.patch"
  33. https://src.fedoraproject.org/rpms/qt5-qtwebkit/raw/rawhide/f/webkit-offlineasm-warnings-ruby27.patch
  34. "qt5-webkit-icu75.patch::https://github.com/qtwebkit/qtwebkit/commit/756e1c8f23dc2720471298281c421c0076d02df8.patch"
  35. icu68.patch
  36. glib-2.68.patch
  37. qt5-webkit-python-3.9.patch
  38. qt5-webkit-bison-3.7.patch)
  39. depends=(qt5-location qt5-sensors qt5-webchannel libwebp libxcomposite gst-plugins-base hyphen woff2
  40. # namcap implicit depends
  41. glibc gcc-libs glib2 zlib libx11 sqlite gst-plugins-base-libs libjpeg-turbo icu libpng gstreamer libxml2
  42. qt5-base qt5-declarative)
  43. # libxslt
  44. depends+=(libicuuc.so libicui18n.so)
  45. makedepends=(cmake ruby ruby-erb gperf python qt5-doc qt5-tools)
  46. optdepends=('gst-plugins-good: Webm codec support')
  47. options=(!lto)
  48. [[ "${CARCH}" == armv7h ]] && options+=(!debug) # reduce memory usage for armv7h
  49. sha256sums=('9ca126da9273664dd23a3ccd0c9bebceb7bb534bddd743db31caf6a5a6d4a9e6'
  50. '4c71c958eae45cae65c9f002024eb1369d06029b668e595158138ff7971e64f1'
  51. 'eea38db22078700887bf22b6a49bb628fd8444cdb2e506770c993df883d0e8fb'
  52. '8768433ff3f641b506962ed22cc596eaf57bf21b6d3402e0e73ad8c2afeaa502'
  53. 'b4d1ba1e99e28fd8cb1ec82252373c870ede683869a9cd43c8e465fe09531bcb'
  54. '0b40ed924f03ff6081af610bb0ee01560b7bd1fb68f8af02053304a01d4ccdf0'
  55. '4969dd03e482155e2490b50307dada81dda7bbc9e5398e3a53c20bc474f7c04e'
  56. '6e0cee08e4fa57b04752e80817f33562f48aa42608a3a620930b6040259b4932'
  57. '34f37b53ee0bc31c63ce85ebd1ae95543a8ba28483e387b20efd50574bd813be')
  58. ## dependency tweaks ##
  59. # FIXME: Could NOT find Sqlite (missing: SQLITE_LIBRARIES)
  60. # [[ "${CARCH}" == armv7h ]] && makedepends+=( 'pkgconf<=2.1.0' ) # dustbin 2024-01-31
  61. _version_constraint() # (dep_pkgname [precision])
  62. {
  63. Log() { [[ "${FUNCNAME[2]}" == package ]] && echo "$@" >&2 || : ; }
  64. local dep_pkgname=$1
  65. declare -i req_precision=$2
  66. local full_version=$(pacman -S --print-format='%v' ${dep_pkgname} 2> /dev/null | tail -n 1)
  67. local n_dots=$(tmp=${full_version%-*} ; tmp=${tmp//[^\.]} ; echo "${#tmp}" ;)
  68. local def_precision=$(( n_dots + 1 ))
  69. local is_prec_valid=$(( req_precision > 0 && req_precision <= def_precision ))
  70. local precision=$((( is_prec_valid )) && echo ${req_precision} || echo ${def_precision})
  71. local pkgver_rx='[0-9A-Za-z_]+'
  72. pkgver_rx=$(sed 's|\]|\+]|' <<<${pkgver_rx}) # according to the wiki, '+' is not allowed,
  73. # but some pkgver have it (eg: 5.15.10+kde+r130)
  74. local subver_rx='\.'${pkgver_rx}
  75. local pkgrel_rx='[0-9]+'
  76. local garbage_rx='[^0-9].*'
  77. local capture_rx=${pkgver_rx}
  78. for (( n_dots=1 ; n_dots < precision ; ++n_dots )) ; do capture_rx+=${subver_rx} ; done ;
  79. local version pkgrel has_dot_char version_min version_max constraint_string
  80. declare -i subver subver_inc pkgrel_inc
  81. if [[ "${full_version}" =~ ^(${capture_rx})(${subver_rx})*-(${pkgrel_rx}).*$ ]]
  82. then version=${BASH_REMATCH[1]} # pkgver cut to the requested precision
  83. #unused=${BASH_REMATCH[2]} # discarded pkgver segments
  84. pkgrel=${BASH_REMATCH[3]} # pkgrel with non-numerics right-trimmed
  85. has_dot_char=$([[ "${version}" =~ \. ]] ; echo $(( ! $? )) ; )
  86. subver=$(sed "s|${garbage_rx}||" <<<${version##*.}) # right-trim from any non-numeric
  87. version=$( (( has_dot_char )) && echo ${version%.*}.${subver} || echo ${subver} )
  88. subver_inc=$(( subver + 1 ))
  89. pkgrel_inc=$(( pkgrel + 1 ))
  90. version_min=$( (( ! is_prec_valid )) && echo ${full_version%-*}-${pkgrel} || \
  91. echo ${version} )
  92. version_max=$( ( (( ! is_prec_valid )) && echo ${full_version%-*}-${pkgrel_inc} ) || \
  93. ( [[ "${version}" =~ \. ]] && echo ${version%.*}.${subver_inc} ) || \
  94. echo ${subver_inc} )
  95. constraint_string="${dep_pkgname}>=${version_min} ${dep_pkgname}<${version_max}"
  96. Log "Applied version constraint: '${constraint_string}'"
  97. else Log "ERROR: in _version_constraint() parsing: dep_pkgname='${dep_pkgname}' full_version='${full_version}'"
  98. exit 1
  99. fi
  100. unset -f Log
  101. echo -n "${constraint_string}"
  102. }
  103. prepare() {
  104. cd "qtwebkit-${_pkgver}"
  105. patch -p0 -i ../icu68.patch # Fix build with ICU 68.x
  106. patch -p1 -i ../glib-2.68.patch # https://github.com/qtwebkit/qtwebkit/issues/1057
  107. patch -p1 -i ../qt5-webkit-python-3.9.patch # Fix build with python 3.9
  108. patch -p1 -i ../qt5-webkit-bison-3.7.patch # Fix build with bison 3.7
  109. patch -p1 -i ../qtwebkit-cstdint.patch # gcc 11.1
  110. patch -p1 -i ../qtwebkit-fix-build-gcc14.patch # GCC 14.1
  111. patch -p1 -i ../qt5-webkit-icu75.patch
  112. patch -Np1 -i ../webkit-offlineasm-warnings-ruby27.patch
  113. }
  114. build() {
  115. # reduce memory usage for armv7h
  116. local parabola_opts=()
  117. if [[ "${CARCH}" == armv7h ]]
  118. then export CXXFLAGS="${CXXFLAGS} -fuse-ld=bfd"
  119. export LDFLAGS+=' -Wl,--no-keep-memory -Wl,--reduce-memory-overheads'
  120. parabola_opts=( '--' '-j4')
  121. fi
  122. cmake -B build -S "qtwebkit-${_pkgver}" -Wno-dev \
  123. -DCMAKE_BUILD_TYPE=None \
  124. -DCMAKE_INSTALL_PREFIX=/usr \
  125. -DCMAKE_CXX_FLAGS="${CXXFLAGS} -DNDEBUG" \
  126. -DPORT=Qt \
  127. -DUSE_LD_GOLD=OFF \
  128. -DENABLE_XSLT=OFF \
  129. -DENABLE_TOOLS=OFF
  130. cmake --build build ${parabola_opts[*]}
  131. }
  132. package() {
  133. # pin to strongly-coupled dependency versions
  134. depends+=( libicudata.so \
  135. $(_version_constraint qt5-base 3) )
  136. DESTDIR="${pkgdir}" cmake --install build
  137. # "install" 'qt5-base' licenses
  138. install -d "$pkgdir"/usr/share/licenses
  139. ln -s /usr/share/licenses/qt5-base "$pkgdir"/usr/share/licenses/${pkgname}
  140. }