summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: e8fe2651f941b1823353596dd286469d351f55e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# Maintainer: Nixuge
# Contributor: Noah Vogt <noah@noahvogt.com>

# Note: check if "depends" are still valid. As of 1.9, the AppImage
# Should contain everything already to just work everywhere.

# Note 2 (for future me & others):
# I really dislike using the AppImage for this package as it's slow to launch & kinda bloated
# Ideally I'd use the deb, which is 10MB instead of 50MB for the appimage
#
# However, as of 1.9, the introduction of the "libayatana-appindicator" dependency has caused some problems on Arch,
# and is why the appimage became bloated in the first place to include everything for max compatibility
#
# This forces me to unfortunately stick with the appimage, as arch's "libayatana-appindicator" just segfaults
#
# Could also redistribute debian's lib & patch the deb around, but I'd have to either:
# - Add another file to download from another source (more risks of it going down)
# - Add the raw file here directly (you'd have to trust me, or go check if the hash in the pkgbuild matches the one from an official src)
#
# So for now just sticking with that. Will switch in the future if that lib implementation gets fixed.

pkgname=localsend-bin
pkgver=1.14.0
pkgrel=3
pkgdesc='An open source cross-platform alternative to AirDrop'
url=https://github.com/localsend/localsend
arch=(x86_64)
license=(MIT)
depends=(fuse2 xdg-user-dirs)
conflicts=('localsend')
provides=('localsend')
options=(!strip !debug)
source=("https://github.com/localsend/localsend/releases/download/v${pkgver}/LocalSend-${pkgver}-linux-x86-64.AppImage")
sha256sums=('e89e885a1de2122dbe5b2b7ec439dca00accee1e63237d4685946a48a35ca8d2')
_appimage="LocalSend-${pkgver}-linux-x86-64.AppImage"
_appimage_nover="localsend.AppImage"
_pkgdesktop="org.localsend.localsend_app.desktop"


prepare() {
	chmod +x "${_appimage}"
	./"${_appimage}" --appimage-extract
}

build() {
	# Adjust .desktop so it will work outside of AppImage container
	sed -i -E \
		"s|Exec=localsend_app|Exec=env DESKTOPINTEGRATION=false /usr/bin/${pkgname%-*}|" \
		"squashfs-root/${_pkgdesktop}"

	# Adjust .desktop to have it point to the correct icon (@CIAvash)
	sed -i -E 's/^Icon=.+/Icon=localsend/' "squashfs-root/${_pkgdesktop}"

	# Fix permissions; .AppImage permissions are 700 for all directories
	chmod -R a-x+rX squashfs-root/usr
}

package() {
	# AppImage
	install -Dm755 \
		"${srcdir}/${_appimage}" \
		"${pkgdir}/opt/${pkgname%-*}/${_appimage_nover}"

	# Desktop file
	install -Dm644 \
		"${srcdir}/squashfs-root/${_pkgdesktop}" \
		"${pkgdir}/usr/share/applications/${_pkgdesktop}"

	# Icon files
    for size in 32 128 256 512; do
	    install -Dm644 \
		    "${srcdir}/squashfs-root/data/flutter_assets/assets/img/logo-$size.png" \
            "${pkgdir}/usr/share/icons/hicolor/${size}x${size}/apps/localsend.png"
    done

	# Symlink executable
	install -dm755 "${pkgdir}/usr/bin"
	ln -s \
		"/opt/${pkgname%-*}/${_appimage_nover}" \
		"${pkgdir}/usr/bin/${pkgname%-*}"
}