summaryrefslogtreecommitdiff
blob: 3121f5462ff9fe73bbe36a6453bce6e0652ec7fb (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
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit chromium-2 desktop unpacker xdg-utils

DESCRIPTION="Microsoft Teams Linux Client (Insiders Build)"
HOMEPAGE="https://teams.microsoft.com/"
SRC_URI="https://packages.microsoft.com/repos/ms-teams/pool/main/t/${PN}/${PN}_${PV}_amd64.deb"

LICENSE="ms-teams-pre"
SLOT="0"
KEYWORDS="-* ~amd64"
RESTRICT="bindist mirror splitdebug test"
IUSE="system-ffmpeg system-mesa"

QA_PREBUILT="*"

RDEPEND="
	!net-im/teams
	app-accessibility/at-spi2-atk
	app-crypt/libsecret
	dev-libs/atk
	dev-libs/expat
	dev-libs/glib
	dev-libs/nspr
	dev-libs/nss
	media-libs/alsa-lib
	media-libs/fontconfig
	net-print/cups
	sys-apps/dbus
	sys-apps/util-linux
	x11-libs/cairo
	x11-libs/gdk-pixbuf
	x11-libs/gtk+:3
	x11-libs/libX11
	x11-libs/libXScrnSaver
	x11-libs/libXcomposite
	x11-libs/libXcursor
	x11-libs/libXdamage
	x11-libs/libXext
	x11-libs/libXfixes
	x11-libs/libXi
	x11-libs/libXrandr
	x11-libs/libXrender
	x11-libs/libXtst
	x11-libs/libxcb
	x11-libs/libxkbfile
	x11-libs/pango
	system-ffmpeg? ( <media-video/ffmpeg-4.3[chromium] )
	system-mesa? ( media-libs/mesa[egl,gles2] )
"

S="${WORKDIR}"

pkg_pretend() {
	chromium_suid_sandbox_check_kernel_config
}

src_configure() {
	chromium_suid_sandbox_check_kernel_config
	default
}

src_install() {
	local dest=/usr

	# Remove keytar3, it needs libgnome-keyring. keytar4 uses libsecret and is used instead
	rm -rf "${WORKDIR}/usr/share/teams-insiders/resources/app.asar.unpacked/node_modules/keytar3" || die

	insinto ${dest}/share
	doins -r "${S}"${dest}/share/applications
	doins -r "${S}"${dest}/share/pixmaps
	doins -r "${S}"${dest}/share/${PN}

	exeinto ${dest}/bin
	doexe "${S}"${dest}/bin/${PN}

	exeinto ${dest}/share/${PN}
	doexe "${S}"${dest}/share/${PN}/${PN}
	doexe "${S}"${dest}/share/${PN}/chrome-sandbox
	doexe "${S}"${dest}/share/${PN}/crashpad_handler

	# Use system ffmpeg, if wanted. Might crash MS Teams!
	if use system-ffmpeg; then
		rm -f "${D}"/${dest}/share/${PN}/libffmpeg.so
		dosym "${dest}/$(get_libdir)/chromium/libffmpeg.so" "${dest}/share/${PN}/libffmpeg.so"
		elog "Using system ffmpeg. This is experimental and may lead to crashes."
	else
		# Otherwise keep the executable bit on the bundled lib
		doexe "${S}"${dest}/share/${PN}/libffmpeg.so
	fi

	# Use system mesa, if wanted. Might Crash MS Teams!
	if use system-mesa; then
		rm -f "${D}"/${dest}/share/${PN}/libEGL.so
		rm -f "${D}"/${dest}/share/${PN}/libGLESv2.so
		elog "Using system mesa. This is experimental and may lead to crashes."
	else
		# Otherwise keep original executable flag
		doexe "${S}"/${dest}/share/${PN}/libEGL.so
		doexe "${S}"/${dest}/share/${PN}/libGLESv2.so
	fi

	# Keep swiftshader, used in GPU-/Head-less systems
	exeinto ${dest}/share/${PN}/swiftshader
	doexe "${S}"/${dest}/share/${PN}/swiftshader/libEGL.so
	doexe "${S}"/${dest}/share/${PN}/swiftshader/libGLESv2.so

	# The overlay handler seems to need executable bits
	# See: https://microsoftteams.uservoice.com/forums/908686-bug-reports/suggestions/40805257-screen-sharing-broken-on-linux-with-1-3-00-16851#comments
	exeinto ${dest}/share/${PN}/resources/app.asar.unpacked/node_modules/slimcore/bin
	doexe "${S}"/${dest}/share/${PN}/resources/app.asar.unpacked/node_modules/slimcore/bin/platform.node
	doexe "${S}"/${dest}/share/${PN}/resources/app.asar.unpacked/node_modules/slimcore/bin/rect-overlay
	doexe "${S}"/${dest}/share/${PN}/resources/app.asar.unpacked/node_modules/slimcore/bin/sharing-indicator.node
	doexe "${S}"/${dest}/share/${PN}/resources/app.asar.unpacked/node_modules/slimcore/bin/slimcore.node
	doexe "${S}"/${dest}/share/${PN}/resources/app.asar.unpacked/node_modules/slimcore/bin/trouter-client.node

	sed -i '/OnlyShowIn=/d' "${S}"${dest}/share/applications/${PN}.desktop
	domenu "${S}"${dest}/share/applications/${PN}.desktop
}

pkg_postinst() {
	xdg_desktop_database_update
	xdg_icon_cache_update
}

pkg_postrm() {
	xdg_desktop_database_update
	xdg_icon_cache_update
}