PKGBUILD 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. # Maintainer (arch): Bruno Pagani <archange@archlinux.org>
  2. # Maintainer: Parabola Hackers <dev@lists.parabola.nu>
  3. # parabola changes and rationale:
  4. # - build without qt6-webengine
  5. # - pin to strongly-coupled dependency versions
  6. # - build from source-ball rather than VCS
  7. # - build as split package ('jami-daemon'+'jami-qt' PKGBUILDs)
  8. # jami-{daemon,qt} versions are tightly inter-dependent;
  9. # so they always need rebuild together anyways
  10. # the release source-ball includes both;
  11. # so separate PKGBUILDs and build jobs are not necessary
  12. pkgbase=jami
  13. pkgname=(jami-daemon jami-qt)
  14. pkgver=20240125.0
  15. pkgrel=1
  16. pkgrel+=.parabola1
  17. pkgdesc="Free and universal communication platform which preserves the users’ privacy and freedoms (Qt client)"
  18. arch=(x86_64)
  19. arch+=(armv7h i686)
  20. url="https://jami.net"
  21. license=(GPL3)
  22. groups=(jami)
  23. depends=(glibc opendht gnutls nettle libgit2 libsecp256k1 libsecp256k1.so ffmpeg speexdsp
  24. fmt yaml-cpp jsoncpp zlib alsa-lib libpulse jack libupnp libnatpmp
  25. openssl webrtc-audio-processing systemd-libs libarchive) # daemon
  26. depends+=(jami-daemon glib2 gdk-pixbuf2 libnm libnotify qrencode
  27. qt6-declarative qt6-multimedia qt6-svg qt6-5compat qt6-webengine
  28. qt6-webchannel qt6-shadertools) # client
  29. depends=( ${depends[*]/qt6-webengine/} )
  30. depends=( ${depends[*]/jami-daemon/} )
  31. # depends+=( qt6-positioning )
  32. makedepends=(git cmake perl asio msgpack-c msgpack-cxx restinio systemd meson) # daemon
  33. makedepends+=(git cmake python qt6-networkauth qt6-tools) # client
  34. makedepends=( ${makedepends[*]/git/} )
  35. source=(https://ftp.gnu.org/gnu/jami/jami-${pkgver}.tar.gz{,.sig}
  36. qt-6.6.patch)
  37. # _pjprojectver=311bd018fc07aaf62d4c2d2494e08b5ee97e6846 # 2023-10-19 (arch PKGBUILD)
  38. # _pjprojectver=8d32e0b87ee3c747412be34fc9916a4e209f2e8f # 2024-01-08
  39. _pjprojectver=e12ea3bfa81cc4f46031599f80707e81133f1353 # 2024-02-18
  40. # _dhtnetver=fe79669b400d5e6a521fd1408dae02e0d4e50a5b # 2023-10-31 (arch PKGBUILD)
  41. # _dhtnetver=41848a2c770d7eb0940d731014b81643f85e0d07 # 2024-01-22
  42. _dhtnetver=18d344dce9bc9a683d73721a6efbc5cd8eb33828 # 2024-03-02
  43. source+=(https://github.com/savoirfairelinux/pjproject/archive/${_pjprojectver}/pjproject-${_pjprojectver}.tar.gz
  44. dhtnet-$_dhtnetver.tar.gz::https://review.jami.net/plugins/gitiles/dhtnet/+archive/$_dhtnetver.tar.gz)
  45. noextract=(pjproject-${_pjprojectver}.tar.gz
  46. dhtnet-${_dhtnetver}.tar.gz)
  47. sha256sums=('27a5d689db39a5f23a1f57cc258898abdb56c3426c1a9280d3d1b2e96551c3f2' # 20240125.0
  48. 'SKIP'
  49. '61d7ca804ed18650274f233cd60a811518859b4c6739ecc246414c35c4b8d906')
  50. # sha256sums+=('7416e3879eb6c20b4a86f4bc86ca91053c580c7641a3f938a4a196183e9a80b4' # 2024-01-08
  51. # '5b25af3dbd3a6f9c423062e58356e8e56f5bdeb9e342b79b2baf1ee623b3ee4d') # 2024-01-22
  52. sha256sums+=('9e1e6362f144eaa743da79c6b818349eb188943e24e0553efd178a220346ab19' # 2024-02-18
  53. '76ed18742c496814d2aa5e0f953a38adbd0e7c8b51ddb8be68bbdb8502d054ec') # 2024-03-02
  54. validpgpkeys=('BE6273738E616D6D1B3A08E8A21A020248816103')
  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. ## prepare daemon ##
  99. cd "${srcdir}"/${pkgbase}-${pkgver}/daemon
  100. cp "${srcdir}"/pjproject-${_pjprojectver}.tar.gz contrib/tarballs/
  101. cp "${srcdir}"/dhtnet-$_dhtnetver.tar.gz contrib/tarballs/
  102. mkdir contrib/native
  103. ## prepare client ##
  104. cd "${srcdir}"/${pkgbase}-${pkgver}
  105. # Drop strict Qt version check. Qt is ABI stable and jami is not using any private API
  106. # corresponds to arch patch: 'drop-qt-version-check.patch'
  107. sed -i '/Qt build version mismatch!/d' src/app/mainapplication.cpp
  108. ! grep "Qt build version mismatch!" src/app/mainapplication.cpp ||
  109. ! echo "ERROR: patches need re-working" || return 1
  110. # Workaround for running with Qt 6.6 https://git.jami.net/savoirfairelinux/jami-client-qt/-/issues/1397
  111. echo "applying qt-6.6.patch"
  112. patch -p1 < "${srcdir}"/qt-6.6.patch
  113. }
  114. build() {
  115. echo "building dependencies" # diff this section against 'jami-daemon' PKGBUILD
  116. cd "${srcdir}"/${pkgbase}-${pkgver}/daemon/contrib/native
  117. ../bootstrap \
  118. --disable-downloads \
  119. --disable-all \
  120. --enable-pjproject \
  121. --enable-dhtnet
  122. make DEPS_pjproject= DEPS_dhtnet=pjproject
  123. echo "building daemon" # diff this section against 'jami-daemon' PKGBUILD
  124. cd "${srcdir}"/${pkgbase}-${pkgver}/daemon
  125. arch-meson . build -D interfaces=library -D opensl=disabled -D portaudio=disabled \
  126. $( ((CHECKFUNC)) && echo -D tests=true) \
  127. -D pkg_config_path="${PWD}/contrib/$(cc -dumpmachine)/lib/pkgconfig"
  128. meson compile -C build
  129. echo "building client" # diff this section against 'jami-qt' PKGBUILD
  130. cd "${srcdir}"/${pkgbase}-${pkgver}
  131. cmake -B build -S ${pkgbase}-${pkgver} \
  132. -DCMAKE_INSTALL_PREFIX=/usr \
  133. -DCMAKE_BUILD_TYPE=Release \
  134. -DWITH_DAEMON_SUBMODULE=false \
  135. -DENABLE_LIBWRAP=OFF \
  136. -DWITH_WEBENGINE=false \
  137. -Wno-dev
  138. make -C build
  139. }
  140. package_jami-daemon() {
  141. : # TODO: fails to build
  142. # ../src/jamidht/archive_account_manager.cpp:660:29: error: ‘aesGetKey’ is not a member of ‘dht::crypto’
  143. # tried with the both of the unversioned external dependencies at the revisions the arch PKGBUILD uses
  144. # and also the revisions which were apparently current when the jami source-ball was made,
  145. # and also the current revisions today - all fail with same error
  146. }
  147. package_jami-qt() {
  148. # pin to current 'qt5-base' libs
  149. depends+=( $(_version_constraint 'qt5-base' 3) )
  150. replaces=(jami-gnome jami-libclient)
  151. conflicts=(jami-gnome jami-libclient)
  152. make -C build DESTDIR="${pkgdir}" install
  153. }