diff options
author | Luke Arms | 2022-02-28 16:03:04 +1100 |
---|---|---|
committer | Luke Arms | 2022-02-28 16:03:04 +1100 |
commit | b98da9f521ff9aa29612a0763939bf067c5e11c3 (patch) | |
tree | 8ba077c49d9b69e41098a1babbfc54f26ba16d18 | |
download | aur-b98da9f521ff9aa29612a0763939bf067c5e11c3.tar.gz |
Initial commit (v1.10.0)
-rw-r--r-- | .SRCINFO | 31 | ||||
-rw-r--r-- | .gitignore | 5 | ||||
-rw-r--r-- | PKGBUILD | 90 |
3 files changed, 126 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..b136c05260eb --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,31 @@ +pkgbase = stretchly + pkgdesc = The break time reminder app + pkgver = 1.10.0 + pkgrel = 1 + url = https://github.com/hovancik/stretchly/ + arch = i686 + arch = x86_64 + license = BSD + makedepends = git + makedepends = nvm + makedepends = jq + makedepends = python + depends = gtk3 + depends = libnotify + depends = nss + depends = libxss + depends = libxtst + depends = xdg-utils + depends = at-spi2-atk + depends = util-linux-libs + depends = libsecret + depends = libappindicator-gtk3 + depends = libxcrypt-compat + depends = electron>=17 + depends = electron<18 + conflicts = stretchly-bin + conflicts = stretchly-git + source = https://github.com/hovancik/stretchly/archive/v1.10.0.tar.gz + sha256sums = cc01383ef15fe56662cc143e7ac89dd07e10bdd68e963d79229a0643f978b815 + +pkgname = stretchly diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000000..091d90939cd4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +* +!.gitignore +!PKGBUILD +!.SRCINFO +!*.patch diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..94a75cdb7863 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,90 @@ +# Maintainer: Luke Arms <luke@arms.to> + +pkgname=stretchly +pkgver=1.10.0 +pkgrel=1 +pkgdesc="The break time reminder app" +arch=('i686' 'x86_64') +url="https://github.com/hovancik/stretchly/" +license=('BSD') +depends=('gtk3' 'libnotify' 'nss' 'libxss' 'libxtst' 'xdg-utils' 'at-spi2-atk' 'util-linux-libs' 'libsecret' 'libappindicator-gtk3' 'libxcrypt-compat' 'electron>=17' 'electron<18') +makedepends=('git' 'nvm' 'jq' 'python') +conflicts=("${pkgname}-bin" "${pkgname}-git") +source=("https://github.com/hovancik/stretchly/archive/v${pkgver}.tar.gz") + +sha256sums=('cc01383ef15fe56662cc143e7ac89dd07e10bdd68e963d79229a0643f978b815') + +_ensure_local_nvm() { + if type nvm &>/dev/null; then + nvm deactivate + nvm unload + fi + unset npm_config_prefix + export NVM_DIR=${srcdir}/.nvm + . /usr/share/nvm/init-nvm.sh +} + +prepare() { + cd "${srcdir}/${pkgname}-${pkgver}" + _ensure_local_nvm + _node_version=$(jq -r '.engines.node' package.json) + # Don't create an asar package + local TEMP + TEMP=$(mktemp) + jq '.build.asar = false' package.json >"$TEMP" + cp "$TEMP" package.json + rm -f "$TEMP" + # ` || false` is a workaround until this upstream fix is released: + # https://github.com/nvm-sh/nvm/pull/2698 + nvm ls "$_node_version" &>/dev/null || + nvm install "$_node_version" || false + nvm use "$_node_version" + npm install --no-save --no-audit --no-progress --no-fund +} + +build() { + cd "${srcdir}/${pkgname}-${pkgver}" + _ensure_local_nvm + nvm use "$_node_version" + # electron-builder only generates /usr/share/* assets for target package + # types 'apk', 'deb', 'freebsd', 'p5p', 'pacman', 'rpm' and 'sh', so build a + # pacman package and unpack it + local _outfile _appname _electron _unpackdir=${srcdir}/${pkgname}-${pkgver}.unpacked + _outfile=dist/$(jq -r '"\(.name)-\(.version)"' package.json).pacman + _appname=$(jq -r .name package.json) + _electron=${_unpackdir}/opt/${_appname}/${pkgname} + rm -Rf "${_unpackdir}" + mkdir -p "${_unpackdir}" + local i686=ia32 x86_64=x64 + ./node_modules/.bin/electron-builder build \ + --linux pacman \ + --"${!CARCH}" \ + -c.electronDist=/usr/lib/electron \ + -c.electronVersion="$(</usr/lib/electron/version)" + tar -C "${_unpackdir}" -Jxf "${_outfile}" + + echo "Deleting Electron ($(du -h "$_electron" | awk '{print $1}'))..." >&2 + rm -v "$_electron" + + # Replace absolute path in desktop entry + sed -Ei "s/^(Exec=).*/\1stretchly/" \ + "${_unpackdir}/usr/share/applications/${pkgname}.desktop" + + # Create /usr/bin/stretchly + install -D -m 0755 /dev/null "${_unpackdir}/usr/bin/stretchly" + cat >"${_unpackdir}/usr/bin/stretchly" <<EOF +#!/bin/sh +exec electron '/usr/lib/$(sed -E "s/'/'\\\\''/g" <<<"${_appname}")/' "\$@" +EOF +} + +package() { + cd "${srcdir}/${pkgname}-${pkgver}" + local _appname + _appname=$(jq -r .name package.json) + rm -rf "${pkgdir:?}/usr" + mv "${srcdir}/${pkgname}-${pkgver}.unpacked/usr" "${pkgdir}/" + install -d "${pkgdir}/usr/lib" + mv "${srcdir}/${pkgname}-${pkgver}.unpacked/opt/${_appname}/resources/app" "${pkgdir}/usr/lib/${_appname}" + install -D "${srcdir}/${pkgname}-${pkgver}/LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" +} |