summaryrefslogtreecommitdiff
path: root/net-im/beeper/beeper-4.2.742.ebuild
blob: c44ec21a2e572ccf450666ed933d31f32d67ea28 (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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# Copyright 2024-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

# NOTICE: This is an Electron app (uh-oh) and the upstream only provides AppImages.
#
# To check the latest version, run:
#
#	curl -s "https://api.beeper.com/desktop/update-feed.json?bundleID=com.automattic.beeper.desktop&platform=linux&arch=x64&channel=stable" | jq .version

EAPI=8

CHROMIUM_LANGS="
	af am ar bg bn ca cs da de el en-GB en-US es es-419 et fa fi fil fr gu he hi
	hr hu id it ja kn ko lt lv ml mr ms nb nl pl pt-BR pt-PT ro ru sk sl sr sv
	sw ta te th tr uk ur vi zh-CN zh-TW
"

inherit chromium-2 optfeature pax-utils xdg

DESCRIPTION="Beeper: Unified Messenger"
HOMEPAGE="https://www.beeper.com/"
SRC_URI="
	amd64? ( https://beeper-desktop.download.beeper.com/builds/Beeper-${PV}-x86_64.AppImage )
	arm64? ( https://beeper-desktop.download.beeper.com/builds/Beeper-${PV}-arm64.AppImage )
"
S="${WORKDIR}/squashfs-root"

LICENSE="all-rights-reserved"
# node_modules licenses
LICENSE+=" Apache-2.0 BSD ISC MIT"
SLOT="4"
KEYWORDS="-* ~amd64"

RESTRICT="bindist mirror strip"

RDEPEND="
	>=app-accessibility/at-spi2-core-2.46.0:2
	app-crypt/libsecret[crypt]
	app-misc/ca-certificates
	dev-libs/expat
	dev-libs/glib:2
	dev-libs/nspr
	dev-libs/nss
	media-libs/alsa-lib
	media-libs/mesa
	media-libs/vips:0/42
	net-print/cups
	sys-apps/dbus
	>=sys-libs/glibc-2.26
	virtual/udev
	virtual/zlib
	x11-libs/cairo
	x11-libs/gtk+:3
	x11-libs/libX11
	x11-libs/libXcomposite
	x11-libs/libXdamage
	x11-libs/libXext
	x11-libs/libXfixes
	x11-libs/libXrandr
	x11-libs/libxcb
	x11-libs/libxkbcommon
	x11-libs/pango
	x11-misc/xdg-utils
"

QA_PREBUILT="*"

src_unpack() {
	local appimage
	use amd64 && appimage="Beeper-${PV}-x86_64.AppImage"
	use arm64 && appimage="Beeper-${PV}-arm64.AppImage"

	cd "${WORKDIR}" || die	# "appimage-extract" unpacks to current directory.
	cp "${DISTDIR}/${appimage}" Beeper.AppImage || die
	chmod +x Beeper.AppImage || die
	./Beeper.AppImage --appimage-extract || die
}

src_prepare() {
	default

	# Fix permissions
	find "${S}" -type d -exec chmod a+rx {} + || die
	find "${S}" -type f -exec chmod a+r {} + || die

	# Fix desktop menu item
	sed "/^Exec=/c Exec=beepertexts %U" -i beepertexts.desktop || die

	# Handle Chromium language packs
	pushd locales || die
	chromium_remove_language_paks
	popd || die
}

src_configure() {
	default
	chromium_suid_sandbox_check_kernel_config
}

src_install() {
	# Install icons and the desktop file
	mkdir -p usr/share/applications || die
	mv beepertexts.desktop usr/share/applications || die

	insinto /usr/share
	doins -r ./usr/share/{applications,icons}

	# Cleanup
	local -a toremove=(
		.DirIcon
		AppRun
		LICENSE.electron.txt
		LICENSES.chromium.html
		beepertexts.png
		resources/app/node_modules/@cbor-extract/cbor-extract-linux-x64/node.abi115.musl.node
		resources/app/node_modules/@cbor-extract/cbor-extract-linux-x64/node.napi.musl.node
		resources/app/node_modules/classic-level/prebuilds/linux-x64/classic-level.musl.node
		usr
	)
	rm -r "${toremove[@]}" || die
	: | tee resources/app/build/main/linux-*.mjs || die

	# Install
	local apphome="/opt/BeeperTexts"

	pax-mark m beepertexts
	mkdir -p "${ED}${apphome}" || die
	cp -r . "${ED}${apphome}" || die
	fperms 4711 "${apphome}"/chrome-sandbox

	local libvips_dest=(
		resources/app/node_modules/@img/sharp-libvips-linux-x64/lib/libvips-cpp.so.*
	)
	(( ${#libvips_dest[@]} == 1 )) ||
		die "multiple or no libvips libraries found"
	dosym -r /usr/$(get_libdir)/libvips-cpp.so.42 "${apphome}/${libvips_dest[0]}"

	dosym -r "${apphome}"/beepertexts /usr/bin/beepertexts
}

pkg_postinst() {
	xdg_pkg_postinst
	optfeature "desktop notifications" x11-libs/libnotify
}