PKGBUILD 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. # Maintainer (arch): Antonio Rojas <arojas@archlinux.org>
  2. # Maintainer (arch): Felix Yan <felixonmars@archlinux.org>
  3. # Maintainer: Parabola Hackers <dev@lists.parabola.nu>
  4. # Contributor: bill-auger <bill-auger@programmer.net>
  5. # parabola changes and rationale:
  6. # libre:
  7. # - remove 'qt6-webengine' dependency and recommendation
  8. # technical:
  9. # - add support for armv7h and i686
  10. # - build from versioned source-ball rather than VCS
  11. # - pin to strongly-coupled dependency versions
  12. pkgbase=pyside6
  13. pkgname=(pyside6
  14. pyside6-tools
  15. shiboken6)
  16. _qtver=6.8.1.1
  17. pkgver=${_qtver/-/}
  18. pkgrel=3
  19. _pkgver_i686=6.4.2
  20. _pkgrel_i686=5.0
  21. eval "[[ -v _pkgver_${CARCH} ]] && pkgver=\$_pkgver_${CARCH}" # our different arches do not
  22. eval "[[ -v _pkgrel_${CARCH} ]] && pkgrel=\$_pkgrel_${CARCH}" # always roll at the same speed
  23. pkgrel+=.parabola1
  24. arch=(x86_64)
  25. arch+=(armv7h i686)
  26. url='https://www.qt.io'
  27. license=(LGPL)
  28. makedepends=(clang
  29. cmake
  30. git
  31. llvm
  32. ninja
  33. python-numpy
  34. python-setuptools
  35. qt6-3d
  36. qt6-charts
  37. qt6-connectivity
  38. qt6-datavis3d
  39. qt6-graphs
  40. qt6-httpserver
  41. qt6-location
  42. qt6-multimedia
  43. qt6-networkauth
  44. qt6-positioning
  45. qt6-quick3d
  46. qt6-remoteobjects
  47. qt6-scxml
  48. qt6-sensors
  49. qt6-serialbus
  50. qt6-serialport
  51. qt6-shadertools
  52. qt6-speech
  53. qt6-svg
  54. qt6-tools
  55. qt6-webchannel
  56. qt6-webengine
  57. qt6-websockets)
  58. makedepends=( ${makedepends[*]/git/} ) # build from source-ball
  59. makedepends=( ${makedepends[*]/qt6-webengine/} ) # blacklisted
  60. source=(git+https://code.qt.io/pyside/pyside-setup#tag=v$pkgver
  61. fix-build.patch)
  62. [[ "${pkgver}" =~ ^([0-9]+\.[0-9]+\.[0-9]+).* ]] ; _upstream_ver=${BASH_REMATCH[1]} ; # eg: 6.8.1.1 -> 6.8.1
  63. [[ "${CARCH}" != i686 ]] && _src_name=everywhere || _src_name=opensource
  64. _src_dir=pyside-setup-${_src_name}-src-${_upstream_ver} # source-ball inner dirname
  65. _src_name=pyside-setup-${_src_name}-src-${pkgver} # source-ball filename
  66. source[0]=https://download.qt.io/official_releases/QtForPython/pyside6/PySide6-${_upstream_ver}-src/${_src_name}.tar.xz # build from source-ball
  67. sha256sums=('e1f198f0a9f6f0e694e3b44406166834e27cffa3f23c5a439c934e5c4faba468' # build from source-ball
  68. '77b83cb164ea87d826259864f6a81fb33199510e1948d6daaf5c8d5ab55735a7')
  69. [[ "${CARCH}" != i686 ]] || sha256sums[0]='1ec9d0936332efd229650cf10fed36cadddff7a613a2ea6e897de4d504c1b505'
  70. # simulate arch's `git cherry-pick` changes onto source-ball
  71. source+=(0001-upstream-docs-12aba6c4dfafe191a4640e3ab755a1c7e2ddfc44.patch::https://code.qt.io/cgit/pyside/pyside-setup.git/patch/?id=12aba6c4dfafe191a4640e3ab755a1c7e2ddfc44
  72. 0002-upstream-docs-cacc9c5803a6dec820dd46211a836453183c8dab.patch::https://code.qt.io/cgit/pyside/pyside-setup.git/patch/?id=cacc9c5803a6dec820dd46211a836453183c8dab)
  73. sha256sums+=('0d37757621768fe4131fe385a760e6b70ada3009b6d09f69f76540c61b292e80'
  74. 'a4e948486dafad31b5f2053170fe76e9904e9e3485924074e6139f330bee1e63')
  75. _CONSERVE_RESOURCES=0
  76. (( _CONSERVE_RESOURCES )) && options=( !debug !strip )
  77. _version_constraint() # (dep_pkgname [precision])
  78. {
  79. Log() { [[ "${FUNCNAME[2]}" == package ]] && echo "$@" >&2 || : ; }
  80. local dep_pkgname=$1
  81. declare -i req_precision=$2
  82. local full_version=$(pacman -S --print-format='%v' ${dep_pkgname} 2> /dev/null | tail -n 1)
  83. local n_dots=$(tmp=${full_version%-*} ; tmp=${tmp//[^\.]} ; echo "${#tmp}" ;)
  84. local def_precision=$(( n_dots + 1 ))
  85. local is_prec_valid=$(( req_precision > 0 && req_precision <= def_precision ))
  86. local precision=$((( is_prec_valid )) && echo ${req_precision} || echo ${def_precision})
  87. local epoch_rx='[0-9]+:'
  88. local pkgver_rx='[0-9A-Za-z_]+'
  89. pkgver_rx=$(sed 's|\]|\+]|' <<<${pkgver_rx}) # according to the wiki, '+' is not allowed,
  90. # but some pkgver have it (eg: 5.15.10+kde+r130)
  91. local subver_rx='\.'${pkgver_rx}
  92. local pkgrel_rx='[0-9]+'
  93. local garbage_rx='[^0-9].*'
  94. local capture_rx=${pkgver_rx}
  95. for (( n_dots=1 ; n_dots < precision ; ++n_dots )) ; do capture_rx+=${subver_rx} ; done ;
  96. local epoch version pkgrel has_dot_char version_min version_max constraint_string
  97. declare -i subver subver_inc pkgrel_inc
  98. if [[ "${full_version}" =~ ^(${epoch_rx})*(${capture_rx})(${subver_rx})*-(${pkgrel_rx}).*$ ]]
  99. then epoch=${BASH_REMATCH[1]} # optional epoch
  100. version=${BASH_REMATCH[2]} # pkgver cut to the requested precision
  101. #unused=${BASH_REMATCH[3]} # discarded pkgver segments
  102. pkgrel=${BASH_REMATCH[4]} # pkgrel with non-numerics right-trimmed
  103. has_dot_char=$([[ "${version}" =~ \. ]] ; echo $(( ! $? )) ; )
  104. subver=$(sed "s|${garbage_rx}||" <<<${version##*.}) # right-trim from any non-numeric
  105. version=$( (( has_dot_char )) && echo ${version%.*}.${subver} || echo ${subver} )
  106. version=${epoch}${version}
  107. subver_inc=$(( subver + 1 ))
  108. pkgrel_inc=$(( pkgrel + 1 ))
  109. version_min=$( (( ! is_prec_valid )) && echo ${full_version%-*}-${pkgrel} || \
  110. echo ${version} )
  111. version_max=$( ( (( ! is_prec_valid )) && echo ${full_version%-*}-${pkgrel_inc} ) || \
  112. ( [[ "${version}" =~ \. ]] && echo ${version%.*}.${subver_inc} ) || \
  113. echo ${subver_inc} )
  114. constraint_string="${dep_pkgname}>=${version_min} ${dep_pkgname}<${version_max}"
  115. Log "Applied version constraint: '${constraint_string}'"
  116. else Log "ERROR: in _version_constraint() parsing: dep_pkgname='${dep_pkgname}' full_version='${full_version}'"
  117. exit 1
  118. fi
  119. unset -f Log
  120. echo -n "${constraint_string}"
  121. }
  122. prepare() {
  123. # link source-ball root dir as VCS root dirname
  124. ln -fs ${_src_dir} pyside-setup
  125. [[ "${CARCH}" != i686 ]] || return 0
  126. cd pyside-setup
  127. patch -p1 < ../fix-build.patch
  128. # Install missing doc snippets
  129. # patch -p1 < ../0001-upstream-docs-12aba6c4dfafe191a4640e3ab755a1c7e2ddfc44.patch # does not apply
  130. # patch -p1 < ../0002-upstream-docs-cacc9c5803a6dec820dd46211a836453183c8dab.patch # does not apply
  131. }
  132. build() {
  133. CLANG_INSTALL_DIR="/usr" \
  134. cmake -B build -S pyside-setup -G Ninja \
  135. -DCMAKE_INSTALL_PREFIX=/usr \
  136. -DCMAKE_BUILD_TYPE=None \
  137. -DSHIBOKEN_PYTHON_LIBRARIES=`pkgconf python3-embed --libs` \
  138. -DBUILD_TESTS=OFF \
  139. -DFORCE_LIMITED_API=no \
  140. -DNO_QT_TOOLS=yes
  141. if (( ! _CONSERVE_RESOURCES )) ; then
  142. PYTHONPATH="$PWD"/build/sources \
  143. cmake --build build
  144. else
  145. PYTHONPATH="$PWD"/build/sources \
  146. cmake --build build -j 1
  147. fi
  148. }
  149. package_shiboken6() {
  150. pkgdesc='Generates bindings for C++ libraries using CPython source code'
  151. depends=(clang
  152. gcc-libs
  153. glibc
  154. libxml2
  155. libxslt
  156. llvm
  157. python
  158. qt6-base)
  159. depends+=( $(_version_constraint python 2) ) # per FORCE_LIMITED_API=no
  160. depends+=( $(_version_constraint clang 3) ) # TODO: needed? , too precise?
  161. optdepends=('python: Python bindings')
  162. DESTDIR="$pkgdir" cmake --install build/sources/shiboken6
  163. # Install egg-info
  164. export PATH="/usr/lib/qt6/bin:$PATH"
  165. cd pyside-setup
  166. python setup.py egg_info --build-type=shiboken6
  167. python setup.py egg_info --build-type=shiboken6-generator
  168. _pythonpath=`python -c "from sysconfig import get_path; print(get_path('platlib'))"`
  169. cp -r shiboken6*.egg-info "$pkgdir"/$_pythonpath
  170. }
  171. package_pyside6() {
  172. pkgdesc='Enables the use of Qt6 APIs in Python applications'
  173. depends=(gcc-libs
  174. glibc
  175. python
  176. qt6-base
  177. qt6-declarative
  178. shiboken6)
  179. optdepends=('qt6-3d: Qt3D bindings'
  180. 'qt6-charts: QtCharts bindings'
  181. 'qt6-connectivity: QtBluetooth and QtNfc bindings'
  182. 'qt6-datavis3d: QtDataVisualization bindings'
  183. 'qt6-graphs: QtGraphs bindings'
  184. 'qt6-httpserver: QtHttpServer bindings'
  185. 'qt6-location: QtLocation bindings'
  186. 'qt6-multimedia: QtMultimedia bindings'
  187. 'qt6-networkauth: QtNetworkAuth bindings'
  188. 'qt6-positioning: QtPositioning bindings'
  189. 'qt6-quick3d: QtQuick3D bindings'
  190. 'qt6-remoteobjects: QtRemoteObjects bindings'
  191. 'qt6-scxml: QtScxml bindings'
  192. 'qt6-sensors: QtSensors bindings'
  193. 'qt6-serialbus: QtSerialBus bindings'
  194. 'qt6-serialport: QtSerialPort bindings'
  195. 'qt6-speech: QtTextToSpeech bindings'
  196. 'qt6-svg: QtSvg bindings'
  197. 'qt6-tools: QtHelp, QtUiTools bindings'
  198. 'qt6-webchannel: QtWebChannel bindings'
  199. #'qt6-webengine: QtWebEngine bindings' # non-free? (redmine #1167)
  200. 'qt6-websockets: QtWebSockets bindings')
  201. provides=(qt6-python-bindings)
  202. DESTDIR="$pkgdir" cmake --install build/sources/pyside6
  203. # Install egg-info
  204. export PATH="/usr/lib/qt6/bin:$PATH"
  205. cd pyside-setup
  206. python setup.py egg_info --build-type=pyside6
  207. _pythonpath=`python -c "from sysconfig import get_path; print(get_path('platlib'))"`
  208. cp -r PySide6.egg-info "$pkgdir"/$_pythonpath
  209. }
  210. package_pyside6-tools() {
  211. pkgdesc='Tools for pyside6'
  212. depends=(pyside6
  213. python)
  214. optdepends=('nuitka: for deploy.py')
  215. DESTDIR="$pkgdir" cmake --install build/sources/pyside-tools
  216. # Add convenience pyside6-designer wrapper
  217. # Entry points in /usr/bin are not installed in the cmake build. This is the only one that does anything besides wrapping the Qt executable
  218. echo "export LD_PRELOAD="`python -c "from sysconfig import get_config_var; print(get_config_var('LDLIBRARY'))"` > pyside6-designer
  219. echo "exec designer6 \$@" >> pyside6-designer
  220. install -Dm755 pyside6-designer -t "$pkgdir"/usr/bin
  221. }