app-editors/kakoune: drop old 0_pre20160620
[gentoo.git] / net-misc / teamviewer / teamviewer-12.0.85001.ebuild
1 # Copyright 1999-2017 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(-),png] )
25         !system-wine? ( media-libs/libpng:1.2[abi_x86_32(-)] )
26         sys-apps/dbus[abi_x86_32(-)]
27         dev-qt/qtcore:4[abi_x86_32(-)]
28         dev-qt/qtgui:4[abi_x86_32(-)]
29         dev-qt/qtwebkit:4[abi_x86_32(-)]
30         media-libs/alsa-lib[abi_x86_32(-)]
31         x11-libs/libICE[abi_x86_32(-)]
32         x11-libs/libSM[abi_x86_32(-)]
33         x11-libs/libX11[abi_x86_32(-)]
34         x11-libs/libXau[abi_x86_32(-)]
35         x11-libs/libXdamage[abi_x86_32(-)]
36         x11-libs/libXdmcp[abi_x86_32(-)]
37         x11-libs/libXext[abi_x86_32(-)]
38         x11-libs/libXfixes[abi_x86_32(-)]
39         x11-libs/libXrandr[abi_x86_32(-)]
40         x11-libs/libXtst[abi_x86_32(-)]"
41
42 QA_PREBUILT="opt/teamviewer${MV}/*"
43
44 S=${WORKDIR}/opt/teamviewer/tv_bin
45
46 src_prepare() {
47         #epatch "${FILESDIR}/${P}-gentoo.patch"
48         sed \
49                 -e "s/@TVV@/${MV}/g" \
50                 "${FILESDIR}"/${PN}d.init > "${T}"/init || die
51         sed \
52                 -e "s:/opt/teamviewer:/opt/teamviewer${MV}:g" \
53                 "script//${PN}d.service" > "${T}/${PN}d.service" || die
54         sed \
55                 -e "s/@TVV@/${PV}/g" \
56                 -e "s/@TVMV@/${MV}/g" \
57                 "${FILESDIR}"/${PN}.sh > "${T}"/sh || die
58         if ! use system-wine; then
59                 sed -i "s/native=true/native=false/g" "${T}/sh" || die
60         fi
61 }
62
63 src_install () {
64         local destdir="/opt/${MY_PN}"
65
66         # install wine prefix skeleton and reg keys
67         insinto "${destdir}/wine/drive_c/"
68         doins -r wine/drive_c/TeamViewer/
69         # install bundled wine if necessary
70         if ! use system-wine; then
71                 insinto "${destdir}/tv_bin/wine"
72                 doins -r wine/{lib,share}
73                 exeinto "${destdir}/tv_bin/wine/bin"
74                 doexe wine/bin/{wine,wine-preloader,wineserver}
75         fi
76         # fix permissions
77         fperms 755 ${destdir}/wine/drive_c/TeamViewer/TeamViewer.exe
78
79         # install wine wrapper
80         exeinto "/opt/bin"
81         newexe "${T}/sh" "${MY_PN}"
82
83         # install teamviewer linux binaries
84         exeinto "${destdir}/tv_bin"
85         doexe TeamViewer_Desktop TVGuiDelegate TVGuiSlave.32
86         use amd64 && doexe TVGuiSlave.64
87
88         # install daemon binary and scripts
89         exeinto "${destdir}/tv_bin"
90         doexe ${PN}d
91         newinitd "${T}/init" ${PN}d${MV}
92         newconfd "${FILESDIR}/${PN}d.conf" ${PN}d${MV}
93         systemd_newunit "${T}/${PN}d.service" ${PN}d${MV}.service
94
95         # set up logdir
96         keepdir /var/log/${MY_PN}
97         dosym /var/log/${MY_PN} /opt/${MY_PN}/logfiles
98
99         # set up config dir
100         keepdir /etc/${MY_PN}
101         dosym /etc/${MY_PN} /opt/${MY_PN}/config
102
103         newicon -s 48 desktop/${PN}.png ${MY_PN}.png
104         #dodoc ../doc/linux_FAQ_{EN,DE}.txt
105         make_desktop_entry ${MY_PN} "TeamViewer ${MV}" ${MY_PN}
106 }
107
108 pkg_preinst() {
109         gnome2_icon_savelist
110 }
111
112 pkg_postinst() {
113         gnome2_icon_cache_update
114
115         elog "TeamViewer from upstream uses an overly-complicated set of bash"
116         elog "scripts to start the program.  This has been simplified for Gentoo"
117         elog "use.  Any issues should be reported via bugzilla."
118         if use system-wine; then
119                 elog
120                 elog "Due to bug #552016, when using system wine, one is not able to"
121                 elog "share one's own screen.  At this time, this may be remedied by"
122                 elog "toggling the system-wine USE flag."
123         fi
124         elog
125         elog "The end-user client requires running the accompanying daemon,"
126         elog "available via init-scripts."
127 }
128
129 pkg_postrm() {
130         gnome2_icon_cache_update
131 }