PKGBUILD 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  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.0.1
  17. pkgver=${_qtver/-/}
  18. pkgrel=2
  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. _src_dir=pyside-setup-everywhere-src-${pkgver%\.*} # source-ball filename and inner dirname
  24. [[ "${CARCH}" != i686 ]] || _src_dir=pyside-setup-opensource-src-${pkgver}
  25. pkgrel+=.parabola1
  26. arch=(x86_64)
  27. arch+=(armv7h i686)
  28. url='https://www.qt.io'
  29. license=(LGPL)
  30. makedepends=(clang
  31. cmake
  32. git
  33. llvm
  34. ninja
  35. python-numpy
  36. python-setuptools
  37. qt6-3d
  38. qt6-charts
  39. qt6-connectivity
  40. qt6-datavis3d
  41. qt6-graphs
  42. qt6-httpserver
  43. qt6-location
  44. qt6-multimedia
  45. qt6-networkauth
  46. qt6-positioning
  47. qt6-quick3d
  48. qt6-remoteobjects
  49. qt6-scxml
  50. qt6-sensors
  51. qt6-serialbus
  52. qt6-serialport
  53. qt6-shadertools
  54. qt6-speech
  55. qt6-svg
  56. qt6-tools
  57. qt6-webchannel
  58. qt6-webengine
  59. qt6-websockets)
  60. makedepends=( ${makedepends[*]/git/} ) # build from source-ball
  61. makedepends=( ${makedepends[*]/qt6-webengine/} ) # blacklisted
  62. source=(git+https://code.qt.io/pyside/pyside-setup#tag=v$pkgver
  63. fix-build.patch)
  64. source[0]=https://download.qt.io/official_releases/QtForPython/pyside6/PySide6-${pkgver}-src/${_src_dir}.tar.xz
  65. sha256sums=('7ae346f2d85f04c8828f2344c96cc211f342983d3ee81cc02923897a6b5c4940'
  66. '77b83cb164ea87d826259864f6a81fb33199510e1948d6daaf5c8d5ab55735a7')
  67. [[ "${CARCH}" != i686 ]] || sha256sums[0]='1ec9d0936332efd229650cf10fed36cadddff7a613a2ea6e897de4d504c1b505'
  68. _version_constraint() # (dep_pkgname [precision])
  69. {
  70. Log() { [[ "${FUNCNAME[2]}" == package ]] && echo "$@" >&2 || : ; }
  71. local dep_pkgname=$1
  72. declare -i req_precision=$2
  73. local full_version=$(pacman -S --print-format='%v' ${dep_pkgname} 2> /dev/null | tail -n 1)
  74. local n_dots=$(tmp=${full_version%-*} ; tmp=${tmp//[^\.]} ; echo "${#tmp}" ;)
  75. local def_precision=$(( n_dots + 1 ))
  76. local is_prec_valid=$(( req_precision > 0 && req_precision <= def_precision ))
  77. local precision=$((( is_prec_valid )) && echo ${req_precision} || echo ${def_precision})
  78. local epoch_rx='[0-9]+:'
  79. local pkgver_rx='[0-9A-Za-z_]+'
  80. pkgver_rx=$(sed 's|\]|\+]|' <<<${pkgver_rx}) # according to the wiki, '+' is not allowed,
  81. # but some pkgver have it (eg: 5.15.10+kde+r130)
  82. local subver_rx='\.'${pkgver_rx}
  83. local pkgrel_rx='[0-9]+'
  84. local garbage_rx='[^0-9].*'
  85. local capture_rx=${pkgver_rx}
  86. for (( n_dots=1 ; n_dots < precision ; ++n_dots )) ; do capture_rx+=${subver_rx} ; done ;
  87. local epoch version pkgrel has_dot_char version_min version_max constraint_string
  88. declare -i subver subver_inc pkgrel_inc
  89. if [[ "${full_version}" =~ ^(${epoch_rx})*(${capture_rx})(${subver_rx})*-(${pkgrel_rx}).*$ ]]
  90. then epoch=${BASH_REMATCH[1]} # optional epoch
  91. version=${BASH_REMATCH[2]} # pkgver cut to the requested precision
  92. #unused=${BASH_REMATCH[3]} # discarded pkgver segments
  93. pkgrel=${BASH_REMATCH[4]} # pkgrel with non-numerics right-trimmed
  94. has_dot_char=$([[ "${version}" =~ \. ]] ; echo $(( ! $? )) ; )
  95. subver=$(sed "s|${garbage_rx}||" <<<${version##*.}) # right-trim from any non-numeric
  96. version=$( (( has_dot_char )) && echo ${version%.*}.${subver} || echo ${subver} )
  97. version=${epoch}${version}
  98. subver_inc=$(( subver + 1 ))
  99. pkgrel_inc=$(( pkgrel + 1 ))
  100. version_min=$( (( ! is_prec_valid )) && echo ${full_version%-*}-${pkgrel} || \
  101. echo ${version} )
  102. version_max=$( ( (( ! is_prec_valid )) && echo ${full_version%-*}-${pkgrel_inc} ) || \
  103. ( [[ "${version}" =~ \. ]] && echo ${version%.*}.${subver_inc} ) || \
  104. echo ${subver_inc} )
  105. constraint_string="${dep_pkgname}>=${version_min} ${dep_pkgname}<${version_max}"
  106. Log "Applied version constraint: '${constraint_string}'"
  107. else Log "ERROR: in _version_constraint() parsing: dep_pkgname='${dep_pkgname}' full_version='${full_version}'"
  108. exit 1
  109. fi
  110. unset -f Log
  111. echo -n "${constraint_string}"
  112. }
  113. prepare() {
  114. # link source-ball root dir as VCS root dirname
  115. ln -fs ${_src_dir} pyside-setup
  116. [[ "${CARCH}" != i686 ]] || return 0
  117. cd pyside-setup
  118. patch -p1 < ../fix-build.patch
  119. }
  120. build() {
  121. CLANG_INSTALL_DIR="/usr" \
  122. cmake -B build -S pyside-setup -G Ninja \
  123. -DCMAKE_INSTALL_PREFIX=/usr \
  124. -DCMAKE_BUILD_TYPE=None \
  125. -DSHIBOKEN_PYTHON_LIBRARIES=`pkgconf python3-embed --libs` \
  126. -DBUILD_TESTS=OFF \
  127. -DFORCE_LIMITED_API=no \
  128. -DNO_QT_TOOLS=yes
  129. PYTHONPATH="$PWD"/build/sources \
  130. cmake --build build
  131. }
  132. package_shiboken6() {
  133. pkgdesc='Generates bindings for C++ libraries using CPython source code'
  134. depends=(clang
  135. gcc-libs
  136. glibc
  137. libxml2
  138. libxslt
  139. llvm
  140. python
  141. qt6-base)
  142. depends+=( $(_version_constraint python 2) ) # per FORCE_LIMITED_API=no
  143. depends+=( $(_version_constraint clang 3) ) # TODO: needed? , too precise?
  144. optdepends=('python: Python bindings')
  145. DESTDIR="$pkgdir" cmake --install build/sources/shiboken6
  146. # Install egg-info
  147. export PATH="/usr/lib/qt6/bin:$PATH"
  148. cd pyside-setup
  149. python setup.py egg_info --build-type=shiboken6
  150. python setup.py egg_info --build-type=shiboken6-generator
  151. _pythonpath=`python -c "from sysconfig import get_path; print(get_path('platlib'))"`
  152. cp -r shiboken6*.egg-info "$pkgdir"/$_pythonpath
  153. }
  154. package_pyside6() {
  155. pkgdesc='Enables the use of Qt6 APIs in Python applications'
  156. depends=(gcc-libs
  157. glibc
  158. python
  159. qt6-base
  160. qt6-declarative
  161. shiboken6)
  162. optdepends=('qt6-3d: Qt3D bindings'
  163. 'qt6-charts: QtCharts bindings'
  164. 'qt6-connectivity: QtBluetooth and QtNfc bindings'
  165. 'qt6-datavis3d: QtDataVisualization bindings'
  166. 'qt6-graphs: QtGraphs bindings'
  167. 'qt6-httpserver: QtHttpServer bindings'
  168. 'qt6-location: QtLocation bindings'
  169. 'qt6-multimedia: QtMultimedia bindings'
  170. 'qt6-networkauth: QtNetworkAuth bindings'
  171. 'qt6-positioning: QtPositioning bindings'
  172. 'qt6-quick3d: QtQuick3D bindings'
  173. 'qt6-remoteobjects: QtRemoteObjects bindings'
  174. 'qt6-scxml: QtScxml bindings'
  175. 'qt6-sensors: QtSensors bindings'
  176. 'qt6-serialbus: QtSerialBus bindings'
  177. 'qt6-serialport: QtSerialPort bindings'
  178. 'qt6-speech: QtTextToSpeech bindings'
  179. 'qt6-svg: QtSvg bindings'
  180. 'qt6-tools: QtHelp, QtUiTools bindings'
  181. 'qt6-webchannel: QtWebChannel bindings'
  182. #'qt6-webengine: QtWebEngine bindings'
  183. 'qt6-websockets: QtWebSockets bindings')
  184. provides=(qt6-python-bindings)
  185. DESTDIR="$pkgdir" cmake --install build/sources/pyside6
  186. # Install egg-info
  187. export PATH="/usr/lib/qt6/bin:$PATH"
  188. cd pyside-setup
  189. python setup.py egg_info --build-type=pyside6
  190. _pythonpath=`python -c "from sysconfig import get_path; print(get_path('platlib'))"`
  191. cp -r PySide6.egg-info "$pkgdir"/$_pythonpath
  192. }
  193. package_pyside6-tools() {
  194. pkgdesc='Tools for pyside6'
  195. depends=(pyside6
  196. python)
  197. optdepends=('nuitka: for deploy.py')
  198. DESTDIR="$pkgdir" cmake --install build/sources/pyside-tools
  199. # Add convenience pyside6-designer wrapper
  200. # 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
  201. echo "export LD_PRELOAD="`python -c "from sysconfig import get_config_var; print(get_config_var('LDLIBRARY'))"` > pyside6-designer
  202. echo "exec designer6 \$@" >> pyside6-designer
  203. install -Dm755 pyside6-designer -t "$pkgdir"/usr/bin
  204. }