app-editors/kakoune: drop old 0_pre20160620
[gentoo.git] / net-misc / teamviewer / teamviewer-10.0.46203.ebuild
1 # Copyright 1999-2016 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=5
5
6 inherit eutils gnome2-utils systemd unpacker
7
8 # Major version
9 MV=${PV/\.*}
10 MY_PN=${PN}${MV}
11 DESCRIPTION="All-In-One Solution for Remote Access and Support over the Internet"
12 HOMEPAGE="https://www.teamviewer.com"
13 SRC_URI="https://download.teamviewer.com/download/version_${MV}x/${PN}_${PV}_i386.deb"
14
15 IUSE="+system-wine"
16
17 LICENSE="TeamViewer LGPL-2.1" #LGPL for bundled wine
18 SLOT=${MV}
19 KEYWORDS="-* ~amd64 ~x86"
20
21 RESTRICT="bindist mirror"
22
23 RDEPEND="
24         system-wine? ( app-emulation/wine[abi_x86_32(-)] )
25         dev-qt/qtcore:4[abi_x86_32(-)]
26         dev-qt/qtgui:4[abi_x86_32(-)]
27         dev-qt/qtwebkit:4[abi_x86_32(-)]
28         media-libs/alsa-lib[abi_x86_32(-)]
29         x11-libs/libICE[abi_x86_32(-)]
30         x11-libs/libSM[abi_x86_32(-)]
31         x11-libs/libX11[abi_x86_32(-)]
32         x11-libs/libXau[abi_x86_32(-)]
33         x11-libs/libXdamage[abi_x86_32(-)]
34         x11-libs/libXdmcp[abi_x86_32(-)]
35         x11-libs/libXext[abi_x86_32(-)]
36         x11-libs/libXfixes[abi_x86_32(-)]
37         x11-libs/libXrandr[abi_x86_32(-)]
38         x11-libs/libXtst[abi_x86_32(-)]"
39
40 QA_PREBUILT="opt/teamviewer${MV}/*"
41
42 S=${WORKDIR}/opt/teamviewer/tv_bin
43
44 src_prepare() {
45         #epatch "${FILESDIR}/${P}-gentoo.patch"
46         sed \
47                 -e "s/@TVV@/${MV}/g" \
48                 "${FILESDIR}"/${PN}d.init > "${T}"/init || die
49         sed \
50                 -e "s:/opt/teamviewer:/opt/teamviewer${MV}:g" \
51                 "script//${PN}d.service" > "${T}/${PN}d.service" || die
52         sed \
53                 -e "s/@TVV@/${PV}/g" \
54                 -e "s/@TVMV@/${MV}/g" \
55                 "${FILESDIR}"/${PN}.sh > "${T}"/sh || die
56         if ! use system-wine; then
57                 sed -i "s/native=true/native=false/g" "${T}/sh" || die
58         fi
59 }
60
61 src_install () {
62         local destdir="/opt/${MY_PN}"
63
64         # install wine prefix skeleton and reg keys
65         insinto "${destdir}/wine/drive_c/"
66         doins -r wine/drive_c/TeamViewer/
67         # install bundled wine if necessary
68         if ! use system-wine; then
69                 insinto "${destdir}/tv_bin/wine"
70                 doins -r wine/{lib,share}
71                 exeinto "${destdir}/tv_bin/wine/bin"
72                 doexe wine/bin/{wine,wine-preloader,wineserver}
73         fi
74         # fix permissions
75         fperms 755 ${destdir}/wine/drive_c/TeamViewer/TeamViewer.exe
76
77         # install wine wrapper
78         exeinto "/opt/bin"
79         newexe "${T}/sh" "${MY_PN}"
80
81         # install teamviewer linux binaries
82         exeinto "${destdir}/tv_bin"
83         doexe TeamViewer_Desktop TVGuiDelegate TVGuiSlave.32
84         use amd64 && doexe TVGuiSlave.64
85
86         # install daemon binary and scripts
87         exeinto "${destdir}/tv_bin"
88         doexe ${PN}d
89         newinitd "${T}/init" ${PN}d${MV}
90         newconfd "${FILESDIR}/${PN}d.conf" ${PN}d${MV}
91         systemd_newunit "${T}/${PN}d.service" ${PN}d${MV}.service
92
93         # set up logdir
94         keepdir /var/log/${MY_PN}
95         dosym /var/log/${MY_PN} /opt/${MY_PN}/logfiles
96
97         # set up config dir
98         keepdir /etc/${MY_PN}
99         dosym /etc/${MY_PN} /opt/${MY_PN}/config
100
101         newicon -s 48 desktop/${PN}.png ${MY_PN}.png
102         #dodoc ../doc/linux_FAQ_{EN,DE}.txt
103         make_desktop_entry ${MY_PN} "TeamViewer ${MV}" ${MY_PN}
104 }
105
106 pkg_preinst() {
107         gnome2_icon_savelist
108 }
109
110 pkg_postinst() {
111         gnome2_icon_cache_update
112
113         elog "TeamViewer from upstream uses an overly-complicated set of bash"
114         elog "scripts to start the program.  This has been simplified for Gentoo"
115         elog "use.  Any issues should be reported via bugzilla."
116         if use system-wine; then
117                 elog
118                 elog "Due to bug #552016, when using system wine, one is not able to"
119                 elog "share one's own screen.  At this time, this may be remedied by"
120                 elog "toggling the system-wine USE flag."
121         fi
122         elog
123         elog "The end-user client requires running the accompanying daemon,"
124         elog "available via init-scripts."
125 }
126
127 pkg_postrm() {
128         gnome2_icon_cache_update
129 }