[ARM] PKGBUILD for simplenote-electron-bin

I now maintain a multi-arch PKGBUILD for simplenote-electron-bin in my GitLab repo. I’m posting it here in case anyone’s interested:

This used to be an ARM-specific (armv7h & aarch64) PKGBUILD on the AUR (simplenote-electron-arm-bin), but a trusted user kicked it off for not supporting x86_64. Since then, I’ve added support for non-ARM architectures (i686 & x86_64), but I won’t be re-adding it to the AUR as there’s already a PKGBUILD that covers armv7h & x86_64 (simplenote-electron-bin). The maintainer of this package is reluctant to add support for aarch64 because it would mean reworking their PKGBUILD to use a different type of source binary. This leaves people with aarch64 systems (like me) a bit out in the cold.

A copy of the current (at the time of posting) version of the PKGBUILD is below. Feel free to use/adapt or whatever.

# Maintainer: Feakster <feakster at posteo dot eu>

### Info ###
pkgname=simplenote-electron-bin
_pkgname=${pkgname%-electron-bin}
pkgver=2.13.0
_appimage="simplenote-electron-${pkgver}-${CARCH}.AppImage"
pkgrel=6
pkgdesc='The simplest way to keep notes'
arch=('armv7h' 'aarch64' 'i686' 'x86_64')
url='https://github.com/Automattic/simplenote-electron'
license=('GPL2')
depends=('gtk3' 'hicolor-icon-theme' 'libxss' 'mesa' 'nss')
optdepends=(
    'libnotify: desktop notifications'
    'noto-fonts-emoji: emoji support'
    'ttf-joypixels: emoji support'
)
makedepends=('fuse2')
provides=('simplenote')
replaces=('simplenote-electron-arm-bin')
options=(!strip)
source_armv7h=("simplenote-electron-${pkgver}-armv7h.AppImage::${url}/releases/download/v${pkgver}/Simplenote-linux-${pkgver}-armv7l.AppImage")
source_aarch64=("simplenote-electron-${pkgver}-aarch64.AppImage::${url}/releases/download/v${pkgver}/Simplenote-linux-${pkgver}-arm64.AppImage")
source_i686=("simplenote-electron-${pkgver}-i686.AppImage::${url}/releases/download/v${pkgver}/Simplenote-linux-${pkgver}-i386.AppImage")
source_x86_64=("simplenote-electron-${pkgver}-x86_64.AppImage::${url}/releases/download/v${pkgver}/Simplenote-linux-${pkgver}-x86_64.AppImage")
noextract=("${source[@]%%::*}")
b2sums_armv7h=('73915723c884d741465b47049159496aadb9378fb487f4bbf165568675e69ad0a2de2a5af18b281eee1a2dc35eb805b3a5c8684885c50c383ee44d645d240a7d')
b2sums_aarch64=('1df436f6b106528d44e4bd3ed3f8ed0fcbf41d129174291545dffba8dbcdca57722fb7447d8d6edcb7df0be6d8d69c695379f07c15df37331a77e8b67098dd63')
b2sums_i686=('45a2c06bf37824b968d28f7c6a94da97218ee51e71b3472c2156f2dfdd01294bd1044e7e4d27255b3071bf14b7d26c86ef33ae454152c32090a0fd24f6ed29f7')
b2sums_x86_64=('27f858e19861cf15b482161f8a6167d1a3839464e76dcdc59fdd5e2472df0544f805813f4711bd76643b1893fbfebc3f90f469e189ba0bac8a034a7ccc77d054')

### Prepare ###
prepare() {
    ## Change Directory ##
    cd "$srcdir"

    ## Mark AppImage as Executable ##
    chmod a+x $_appimage

    ## Extract AppImage into squashfs-root Directory ##
    ./$_appimage --appimage-extract

    ## Remove Unnecessary Files ##
    rm squashfs-root/{.DirIcon,AppRun,$_pkgname.png}

    ## Fix Permissions ##
    find squashfs-root -type d -exec chmod 0755 {} \;
    find squashfs-root -type f -exec chmod 0644 {} \;
    find squashfs-root -type f -regex '^.+\.so\(\.[0-9]+\)?$' -exec chmod 0755 {} \;
    chmod 0755 squashfs-root/$_pkgname

    ## Modify Desktop File ##
    sed -i \
    -e "s|^Exec=.*|Exec=/usr/bin/$_pkgname %U|" \
    -e '/^TryExec=.*/d' \
    -e '/^X-AppImage-Version=.*/d' \
    squashfs-root/${_pkgname}.desktop
    echo "TryExec=/opt/$_pkgname/$_pkgname" >> squashfs-root/${_pkgname}.desktop
}

### Package ###
package() {
    ## Move AppImage Contents to /opt/$_pkgname ##
    install -dm0755 "$pkgdir"/opt/$_pkgname
    cp -RT "$srcdir"/squashfs-root "$pkgdir"/opt/$_pkgname

    ## SUID Sandbox ##
    chmod 4755 "$pkgdir"/opt/$_pkgname/chrome-sandbox

    ## Executable Binary ##
    install -dm0755 "$pkgdir"/usr/bin
    ln -fs \
    /opt/$_pkgname/$_pkgname \
    "$pkgdir"/usr/bin/$_pkgname

    ## Icons ##
    for SIZE in 16 32 48 64 128 256 512 1024
    do
        install -dm0755 "$pkgdir"/usr/share/icons/hicolor/${SIZE}x${SIZE}/apps
        ln -fs \
        /opt/$_pkgname/usr/share/icons/hicolor/${SIZE}x${SIZE}/apps/${_pkgname}.png \
        "$pkgdir"/usr/share/icons/hicolor/${SIZE}x${SIZE}/apps/${_pkgname}.png
    done

    ## Desktop Entry ##
    install -dm0755 "$pkgdir"/usr/share/applications
    ln -fs \
    /opt/$_pkgname/${_pkgname}.desktop \
    "$pkgdir"/usr/share/applications/${_pkgname}.desktop

    ## Licenses ##
    install -dm0755 "$pkgdir"/usr/share/licenses/$pkgname
    ln -fs \
    /opt/$_pkgname/LICENSE.electron.txt \
    "$pkgdir"/usr/share/licenses/$pkgname/LICENSE.electron.txt
    ln -fs \
    /opt/$_pkgname/LICENSES.chromium.html \
    "$pkgdir"/usr/share/licenses/$pkgname/LICENSES.chromium.html
}

I’m also reworking my old vivaldi-arm-bin PKGBUILD, along with someone else’s old zotero-arm-bin PKGBUILD, to make them multi-arch. These were kicked off the AUR by the same trusted user for the same reason. Hopefully, I’ll be able to upstream these to Arch Linux ARM (& Arch x86_64, in the case of Simplenote), but don’t hold your breath.

5 Likes