# Maintainer: Danilo pkgname=threema-desktop _binname=threema _variant=consumer _appname="Threema" pkgdesc="Threema Desktop (Threema Web in Electron)." pkgver=1.2.18 pkgrel=2 _threema_web_ver=2.4.2 # Keep in sync with version used by threema-desktop arch=('any') url="https://github.com/threema-ch/threema-web-electron" license=('AGPL') depends=(electron18) makedepends=(npm git) source=( "threema-web-electron-v${pkgver}.tar.gz::https://github.com/threema-ch/threema-web-electron/archive/refs/tags/${pkgver}.tar.gz" "threema-web-v${_threema_web_ver}.tar.gz::https://github.com/threema-ch/threema-web/archive/refs/tags/v${_threema_web_ver}.tar.gz" "threema.desktop" "0001-When-browser-detection-fails-don-t-return-undefined.patch" "0002-Remove-browser-warning.patch" ) sha256sums=( '87938d1329d55159717c87dbdab7e59e615457c8528aef638e313e4233c3b86f' '61942d1ea93746580e0219eefa38114e8aa597355c4fd620bbd31dfd1b270b09' 'ccfdae3416e2a1f096cfaf67fd8f8dacb0d8348582fc666ecc8b5b0d08ef5bf2' '5079f273e325a9206ae31e1537a63862cadd4e93471b1ec715c1587b808a6c08' '75be30059dab96e015a9030477c3a7e55584b408761f9c50a9491d1bed152c78' ) prepare() { cd "${srcdir}/threema-web-${_threema_web_ver}" patch --forward --strip=1 --input="${srcdir}/0001-When-browser-detection-fails-don-t-return-undefined.patch" patch --forward --strip=1 --input="${srcdir}/0002-Remove-browser-warning.patch" } build() { cd "${srcdir}/threema-web-electron-${pkgver}/" # Copy threema-web source code (since threema-web-electron submodule # is not contained in GitHub export) rm -r "app/dependencies/threema-web" cp -R "../threema-web-${_threema_web_ver}" "app/dependencies/threema-web" # Build Threema Web export DEV_ENV=production export threema_web_version=threema-web-${_threema_web_ver} npm install ./tools/patches/patch-threema-web.sh npm run app:build:web ./tools/patches/post-patch-threema-web.sh touch app/dependencies/threema-web/release/threema-web-${_threema_web_ver}/userconfig.overrides.js # Build Electron app npm run app:install _target_os=linux-deb _target_dist=linux:deb node tools/patches/post-patch-threema-web.js $_target_os $_variant if [ "$_variant" = "red" ]; then tools/patches/red-patch-threema-web.sh; fi npm run electron:dist:$_target_dist:$_variant } package() { cd "${srcdir}/" _app_root="${srcdir}/threema-web-electron-${pkgver}" # Copy application mkdir -p "${pkgdir}/usr/lib/${pkgname}/resources/" cp "${_app_root}/app/build/dist-electron/packaged/${_appname}-linux-x64/resources/app.asar" \ "${pkgdir}/usr/lib/${pkgname}/resources/" # Create launcher mkdir -p "${pkgdir}/usr/bin/" _launcher="${pkgdir}/usr/bin/${_binname}" echo -e "#!/bin/sh\nexec electron18 '/usr/lib/${pkgname}/resources/app.asar' '$@'" > "$_launcher" chmod +x "$_launcher" # Copy desktop files mkdir -p "${pkgdir}/usr/share/applications" mkdir -p "${pkgdir}/usr/share/pixmaps" cp "${_app_root}/app/assets/icons/png/${_variant}-512x512.png" "${pkgdir}/usr/share/pixmaps/${pkgname}.png" cp "${srcdir}/threema.desktop" "${pkgdir}/usr/share/applications/${pkgname}.desktop" sed -i -s "s/{{appname}}/${_appname}/" "${pkgdir}/usr/share/applications/${pkgname}.desktop" sed -i -s "s/{{binname}}/${_binname}/" "${pkgdir}/usr/share/applications/${pkgname}.desktop" sed -i -s "s/{{pkgname}}/${pkgname}/" "${pkgdir}/usr/share/applications/${pkgname}.desktop" sed -i -s "s/{{pkgdesc}}/${pkgdesc}/" "${pkgdir}/usr/share/applications/${pkgname}.desktop" } # vim:set ts=2 sw=2 et: