app-editors/kakoune: drop old 0_pre20160620
[gentoo.git] / net-misc / tigervnc / tigervnc-1.8.0.ebuild
1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI="6"
5
6 CMAKE_IN_SOURCE_BUILD=1
7
8 inherit autotools cmake-utils eutils flag-o-matic java-pkg-opt-2 systemd
9
10 XSERVER_VERSION="1.19.1"
11
12 DESCRIPTION="Remote desktop viewer display system"
13 HOMEPAGE="http://www.tigervnc.org"
14 SRC_URI="https://github.com/TigerVNC/tigervnc/archive/v${PV}.tar.gz -> ${P}.tar.gz
15         https://dev.gentoo.org/~armin76/dist/tigervnc-1.4.2-patches-0.1.tar.bz2
16         server? ( ftp://ftp.freedesktop.org/pub/xorg/individual/xserver/xorg-server-${XSERVER_VERSION}.tar.bz2  )"
17
18 LICENSE="GPL-2"
19 SLOT="0"
20 KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ppc64 ~sh sparc x86"
21 IUSE="+drm gnutls nls java +opengl pam server systemd +xorgmodule"
22
23 CDEPEND="virtual/jpeg:0
24         sys-libs/zlib
25         >=x11-libs/libXtst-1.0.99.2
26         >=x11-libs/fltk-1.3.1
27         gnutls? ( net-libs/gnutls:= )
28         nls? ( virtual/libiconv )
29         pam? ( virtual/pam )
30         server? (
31                 dev-lang/perl
32                 >=x11-libs/libXi-1.2.99.1
33                 >=x11-libs/libXfont-1.4.2
34                 >=x11-libs/libxkbfile-1.0.4
35                 x11-libs/libXrender
36                 >=x11-libs/pixman-0.27.2
37                 >=x11-apps/xauth-1.0.3
38                 x11-apps/xsetroot
39                 >=x11-misc/xkeyboard-config-2.4.1-r3
40                 opengl? ( >=app-eselect/eselect-opengl-1.3.1-r1 )
41                 xorgmodule? ( =x11-base/xorg-server-${XSERVER_VERSION%.*}* )
42                 drm? ( x11-libs/libdrm )
43         )"
44
45 RDEPEND="${CDEPEND}
46         !net-misc/tightvnc
47         !net-misc/vnc
48         !net-misc/xf4vnc
49         java? ( >=virtual/jre-1.5:* )"
50
51 DEPEND="${CDEPEND}
52         amd64? ( dev-lang/nasm )
53         x86? ( dev-lang/nasm )
54         >=x11-proto/inputproto-2.2.99.1
55         >=x11-proto/xextproto-7.2.99.901
56         >=x11-proto/xproto-7.0.31
57         x11-libs/libXfont2
58         nls? ( sys-devel/gettext )
59         java? ( >=virtual/jdk-1.5 )
60         server? (
61                 virtual/pkgconfig
62                 media-fonts/font-util
63                 x11-misc/util-macros
64                 >=x11-proto/bigreqsproto-1.1.0
65                 >=x11-proto/compositeproto-0.4
66                 >=x11-proto/damageproto-1.1
67                 >=x11-proto/fixesproto-5.0
68                 >=x11-proto/fontsproto-2.1.3
69                 >=x11-proto/glproto-1.4.17
70                 >=x11-proto/randrproto-1.4.0
71                 >=x11-proto/renderproto-0.11
72                 >=x11-proto/resourceproto-1.2.0
73                 >=x11-proto/scrnsaverproto-1.1
74                 >=x11-proto/videoproto-2.2.2
75                 >=x11-proto/xcmiscproto-1.2.0
76                 >=x11-proto/xineramaproto-1.1.3
77                 >=x11-libs/xtrans-1.3.3
78                 >=x11-proto/dri2proto-2.8
79                 opengl? ( >=media-libs/mesa-10.3.4-r1 )
80         )"
81
82 PATCHES=(
83         "${WORKDIR}"/patches/030_manpages.patch
84         "${WORKDIR}"/patches/055_xstartup.patch
85 )
86
87 src_prepare() {
88         if use server ; then
89                 cp -r "${WORKDIR}"/xorg-server-${XSERVER_VERSION}/. unix/xserver || die
90         fi
91
92         cmake-utils_src_prepare
93
94         if use server; then
95                 cd unix/xserver || die
96                 eapply "${FILESDIR}/xserver119.patch"
97                 eautoreconf
98         fi
99 }
100
101 src_configure() {
102         use arm || use hppa && append-flags "-fPIC"
103
104         local mycmakeargs=(
105                 -DENABLE_GNUTLS=$(usex gnutls)
106                 -DENABLE_NLS=$(usex nls)
107                 -DENABLE_PAM=$(usex pam)
108                 -DBUILD_JAVA=$(usex java)
109         )
110
111         cmake-utils_src_configure
112
113         if use server; then
114                 cd unix/xserver || die
115                 econf \
116                         $(use_enable opengl glx) \
117                         $(use_enable drm libdrm) \
118                         --disable-config-hal \
119                         --disable-config-udev \
120                         --disable-devel-docs \
121                         --disable-dmx \
122                         --disable-dri \
123                         --disable-dri3 \
124                         --disable-glamor \
125                         --disable-kdrive \
126                         --disable-libunwind \
127                         --disable-linux-acpi \
128                         --disable-record \
129                         --disable-selective-werror \
130                         --disable-silent-rules \
131                         --disable-static \
132                         --disable-tslib \
133                         --disable-unit-tests \
134                         --disable-xephyr \
135                         --disable-xinerama \
136                         --disable-xnest \
137                         --disable-xorg \
138                         --disable-xvfb \
139                         --disable-xwin \
140                         --disable-xwayland \
141                         --enable-dri2 \
142                         --with-pic \
143                         --without-dtrace \
144                         --disable-present \
145                         --disable-unit-tests
146         fi
147 }
148
149 src_compile() {
150         cmake-utils_src_compile
151
152         if use server; then
153                 # deps of the vnc module and the module itself
154                 local d subdirs=(
155                         fb xfixes Xext dbe $(usex opengl glx "") randr render damageext miext Xi xkb
156                         composite dix mi os hw/vnc
157                 )
158                 for d in "${subdirs[@]}"; do
159                         emake -C unix/xserver/"${d}"
160                 done
161         fi
162 }
163
164 src_install() {
165         cmake-utils_src_install
166
167         if use server; then
168                 emake -C unix/xserver/hw/vnc DESTDIR="${D}" install
169                 if ! use xorgmodule; then
170                         rm -rv "${ED%/}"/usr/$(get_libdir)/xorg || die
171                 else
172                         rm -v "${ED%/}"/usr/$(get_libdir)/xorg/modules/extensions/libvnc.la || die
173                 fi
174
175                 newconfd "${FILESDIR}"/${PN}.confd ${PN}
176                 if use systemd; then
177                         systemd_douserunit contrib/systemd/user/vncserver@.service
178                 else
179                         newinitd "${FILESDIR}"/${PN}.initd ${PN}
180                 fi
181         else
182                 local f
183                 cd "${ED}" || die
184                 for f in vncserver x0vncserver vncconfig; do
185                         rm usr/bin/$f || die
186                         rm usr/share/man/man1/$f.1 || die
187                 done
188         fi
189 }