Skip to content

Instantly share code, notes, and snippets.

@alecmev
Last active August 23, 2022 09:52
Show Gist options
  • Save alecmev/a83a03e4c45042bcb01ff3e00421adf3 to your computer and use it in GitHub Desktop.
Save alecmev/a83a03e4c45042bcb01ff3e00421adf3 to your computer and use it in GitHub Desktop.
_name=gmail-desktop
pkgname="${_name}-dev"
_ver=3.0.0-alpha.35
pkgver="${_ver//-/_}"
_namever="${_name}-${_ver}"
pkgrel=1
pkgdesc='Nifty Gmail desktop app'
arch=('x86_64')
url='https://github.com/timche/gmail-desktop/tree/develop'
license=('MIT')
_electronv=19
depends=("electron${_electronv}")
makedepends=(
'gendesk'
'npm'
)
optdepends=('libappindicator-gtk3: Tray icon')
conflicts=('gmail-desktop')
source=("${_namever}.tar.gz::https://github.com/timche/gmail-desktop/archive/refs/tags/v${_ver}.tar.gz")
sha256sums=('f22b10215586d5d879ea98a1671e6c0aac4b1166cff765f197f8e21f2bd66998')
prepare() {
cd "${_namever}"
# https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=gmail-desktop&id=7e3912df588282beea9010d71dcfea457658f91c#n24
sed -i '/husky/d' package.json
cat > "${pkgname}" <<EOF
#!/usr/bin/env bash
exec electron${_electronv} /usr/share/${pkgname}/app.asar "\$@"
EOF
gendesk \
--pkgname "${pkgname}" \
--pkgdesc "${pkgdesc}" \
--name "Gmail Desktop" \
--categories "Network;Office;Email" \
-n \
-f
}
build() {
cd "${_namever}"
# https://github.com/electron-userland/electron-builder/issues/5668
npm i electron-builder@22
npm run build
local _electronDist="/usr/lib/electron${_electronv}"
local _electronVersion=`cat "${_electronDist}/version"`
npm run dist:linux -- \
--dir \
-c.electronDist="${_electronDist}" \
-c.electronVersion="${_electronVersion}"
}
package() {
cd "${_namever}"
mkdir -p "${pkgdir}/usr/share"
cp -r "dist/linux-unpacked/resources" "${pkgdir}/usr/share/${pkgname}"
install -Dm755 -t "${pkgdir}/usr/bin/" "${pkgname}"
install -Dm644 -t "${pkgdir}/usr/share/applications/" "${pkgname}.desktop"
install -Dm644 -t "${pkgdir}/usr/share/licenses/${pkgname}" LICENSE
install -Dm644 -t "${pkgdir}/usr/share/pixmaps/" build/icon.png
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment