Advertisement
Guest User

schildichat-desktop-git version 1.11.81.sc.0.test.0.r1.6b2b1a6 PKGBUILD

a guest
Oct 21st, 2024
21
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 5.29 KB | Source Code | 0 0
  1. # Maintainer: lsf
  2. # Contributor: dreieck (https://aur.archlinux.org/account/dreieck)
  3. # Contributor: Bruno Pagani <archange@archlinux.org>
  4. # Contributor: Steef Hegeman <mail@steefhegeman.com>
  5. # Contributor: Luca Weiss <luca (at) z3ntu (dot) xyz>
  6. # Contributor: Julian Schacher <jspp@posteo.net>
  7.  
  8. _electron=electron33
  9. _nodeversion=20
  10. pkgname=schildichat-desktop-git
  11. _pkgname=schildichat-desktop
  12. pkgver=1.11.81.sc.0.test.0.r1.6b2b1a6
  13. pkgrel=1
  14. pkgdesc="A Matrix client based on Element with a more traditional instant messaging experience"
  15. arch=(x86_64)
  16. url="https://schildi.chat"
  17. license=('Apache-2.0')
  18. conflicts=(schildichat-desktop schildichat-desktop-bin)
  19. provides=(schildichat-desktop=${pkgver})
  20. makedepends=(npm git yarn python python-setuptools rust tcl "nodejs>=${_nodeversion}" nvm libxcrypt-compat asar)
  21. depends=(${_electron} libsecret)
  22. source=(git+https://github.com/SchildiChat/schildichat-desktop.git
  23.         git+https://github.com/SchildiChat/matrix-js-sdk.git
  24.         git+https://github.com/SchildiChat/matrix-react-sdk.git
  25.         git+https://github.com/SchildiChat/element-web.git
  26.         git+https://github.com/SchildiChat/element-desktop.git
  27.         autolaunch.patch
  28.         schildichat-desktop.desktop
  29.         schildichat-desktop.sh
  30.         "workaround_issue_265.patch::https://github.com/user-attachments/files/17462237/workaround_issue_265.patch.txt")
  31. sha256sums=('SKIP'
  32.             'SKIP'
  33.             'SKIP'
  34.             'SKIP'
  35.             'SKIP'
  36.             '20533d63ffadf03dbfd173e6d4f1f1048746a628db7b2a70f5bc02390e812302'
  37.             '6450af411fea039cb76357ff4ea7f1ef336601315de4d27b848a75d7960cef17'
  38.             '8084211fe11ba23be956ef4b8bb0fffaa6aaa721b79f9753ecc3574666ef95ce'
  39.             '74e4efde4a76261203ee7b215309b3be11308151c8e3270b07e7c96099822c16')
  40.  
  41. pkgver() {
  42.   cd ${_pkgname}
  43.   git describe --long --tags | sed 's/^v//;s/rc.\[0-9\]+-//;s/\([^-]*-\)g/r\1/;s/-/./g'
  44. }
  45.  
  46. prepare() {
  47.   cd ${_pkgname}
  48.   export npm_config_cache="${srcdir}/npm_cache"
  49.   _ensure_local_nvm
  50.   #nvm install ${_nodeversion} # Not needed; `nodejs>=${_nodeversion}` from the repositories suffices.
  51.  
  52.   git submodule init
  53.   git config submodule.matrix-js-sdk.url ${srcdir}/matrix-js-sdk
  54.   git config submodule.matrix-react-sdk.url ${srcdir}/matrix-react-sdk
  55.   git config submodule.element-web.url ${srcdir}/element-web
  56.   git config submodule.element-desktop.url ${srcdir}/element-desktop
  57.   git -c protocol.file.allow=always submodule update
  58.  
  59.   # Specify electron version in launcher
  60.   sed -i "s|@ELECTRON@|${_electron}|" ../schildichat-desktop.sh
  61.  
  62.   _electron_dist=/usr/lib/${_electron}
  63.   _electron_ver=$(cat ${_electron_dist}/version)
  64.  
  65.   cd element-desktop
  66.   patch -p1 < ${srcdir}/autolaunch.patch
  67.   sed -i 's|"target": "deb"|"target": "dir"|' package.json
  68.   sed -i "s|\"electronVersion\": \".*\"|\"electronVersion\": \"${_electron_ver}\"|" package.json # removed?
  69.   sed -i "s|\"electron\": \".*\"|\"electron\": \"${_electron_ver}\"|" package.json
  70.   sed -i 's|"https://packages.element.io/desktop/update/"|null|' element.io/release/config.json
  71.   cd ${srcdir}/${_pkgname}
  72.  
  73.   patch -Np1 --follow-symlinks -i "${srcdir}/workaround_issue_265.patch"
  74.  
  75.   make setup
  76. }
  77.  
  78. build() {
  79.   cd ${_pkgname}
  80.   export npm_config_cache="$srcdir/npm_cache"
  81.   _ensure_local_nvm
  82.   #nvm use ${_nodeversion} # Not needed; `nodejs>=${_nodeversion}` from the repositories suffices.
  83.   export SQLCIPHER_BUNDLED=1
  84.   export CFLAGS+=" -ffat-lto-objects"
  85.  
  86.   # yarn --cwd element-desktop run build:64 --linux -c.linux.target=dir -c.electronDist=${_electron_dist} -c.electronVersion=${_electron_ver}
  87.   # let's use the ready-made build script instead - otherwise, we'd have to do a lot more work to get the webapp build etc.
  88.   make pacman
  89. }
  90.  
  91. package() {
  92.   cd ${_pkgname}
  93.  
  94.   install -d "${pkgdir}"/usr/lib/${_pkgname}
  95.  
  96.   cp -r element-desktop/dist/linux-unpacked/resources{,.pak} "${pkgdir}"/usr/lib/${_pkgname}/
  97.   cp -r element-desktop/dist/linux-unpacked/locales "${pkgdir}"/usr/lib/${_pkgname}/
  98.  
  99.   # crashes (at least on wayland) when remaining packed. might be some issue with the webapp.asar location, but inconclusive
  100.   # workaround by extracting app.asar
  101.  
  102.   install -d "${pkgdir}"/usr/lib/${_pkgname}/resources/app
  103.   asar e "${pkgdir}"/usr/lib/${_pkgname}/resources/app.asar "${pkgdir}"/usr/lib/${_pkgname}/resources/app
  104.   rm "${pkgdir}"/usr/lib/${_pkgname}/resources/app.asar
  105.  
  106.   # Required extras
  107.   install -Dm644 ../schildichat-desktop.desktop -t "${pkgdir}"/usr/share/applications/
  108.   install -Dm755 ../${_pkgname}.sh "${pkgdir}"/usr/bin/${_pkgname}
  109.  
  110.   # Icons
  111.   install -Dm644 element-desktop/res/img/element.png "${pkgdir}"/usr/share/icons/hicolor/scalable/apps/schildichat-desktop.png
  112.   for i in 16 24 48 64 96 128 256 512; do
  113.     install -Dm644 element-desktop/build/icons/${i}x${i}.png "${pkgdir}"/usr/share/icons/hicolor/${i}x${i}/apps/schildichat-desktop.png
  114.   done
  115. }
  116.  
  117. # https://wiki.archlinux.org/title/Node.js_package_guidelines#Using_nvm
  118. _ensure_local_nvm() {
  119.     # let's be sure we are starting clean
  120.     which nvm >/dev/null 2>&1 && nvm deactivate && nvm unload
  121.     export NVM_DIR="${srcdir}/.nvm"
  122.  
  123.     # The init script returns 3 if version specified
  124.     # in ./.nvrc is not (yet) installed in $NVM_DIR
  125.     # but nvm itself still gets loaded ok
  126.     source /usr/share/nvm/init-nvm.sh || [[ $? != 1 ]]
  127. }
  128.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement