Use https by default
[gentoo.git] / net-misc / tigervnc / tigervnc-1.3.1-r1.ebuild
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI="4"
6
7 inherit eutils cmake-utils autotools java-pkg-opt-2 flag-o-matic
8
9 PATCHVER="0.2"
10 XSERVER_VERSION="1.15.0"
11 OPENGL_DIR="xorg-x11"
12 #MY_P="${PN}-1.2.80-20130314svn5065"
13 #S="${WORKDIR}/${MY_P}"
14
15 DESCRIPTION="Remote desktop viewer display system"
16 HOMEPAGE="http://www.tigervnc.org"
17 SRC_URI="mirror://sourceforge/tigervnc/${P}.tar.gz
18         mirror://gentoo/${PN}.png
19         mirror://gentoo/${PN}-1.3.0-patches-${PATCHVER}.tar.bz2
20         https://dev.gentoo.org/~armin76/dist/${PN}-1.3.0-patches-${PATCHVER}.tar.bz2
21         server? ( ftp://ftp.freedesktop.org/pub/xorg/individual/xserver/xorg-server-${XSERVER_VERSION}.tar.bz2  )"
22
23 LICENSE="GPL-2"
24 SLOT="0"
25 KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ppc64 sh sparc x86"
26 IUSE="gnutls java nptl +opengl pam server +xorgmodule"
27
28 RDEPEND="virtual/jpeg:0
29         sys-libs/zlib
30         >=x11-libs/libXtst-1.0.99.2
31         >=x11-libs/fltk-1.3.1
32         gnutls? ( net-libs/gnutls )
33         java? ( >=virtual/jre-1.5 )
34         pam? ( virtual/pam )
35         server? (
36                 dev-lang/perl
37                 >=x11-libs/libXi-1.2.99.1
38                 >=x11-libs/libXfont-1.4.2
39                 >=x11-libs/libxkbfile-1.0.4
40                 x11-libs/libXrender
41                 >=x11-libs/pixman-0.27.2
42                 >=x11-apps/xauth-1.0.3
43                 x11-apps/xsetroot
44                 >=x11-misc/xkeyboard-config-2.4.1-r3
45                 opengl? ( >=app-eselect/eselect-opengl-1.0.8 )
46                 xorgmodule? ( =x11-base/xorg-server-${XSERVER_VERSION%.*}* )
47         )
48         !net-misc/vnc
49         !net-misc/tightvnc
50         !net-misc/xf4vnc"
51 DEPEND="${RDEPEND}
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.22
57         java? ( >=virtual/jdk-1.5 )
58         server? (
59                 virtual/pkgconfig
60                 media-fonts/font-util
61                 x11-misc/util-macros
62                 >=x11-proto/bigreqsproto-1.1.0
63                 >=x11-proto/compositeproto-0.4
64                 >=x11-proto/damageproto-1.1
65                 >=x11-proto/fixesproto-5.0
66                 >=x11-proto/fontsproto-2.0.2
67                 >=x11-proto/glproto-1.4.17
68                 >=x11-proto/randrproto-1.4.0
69                 >=x11-proto/renderproto-0.11
70                 >=x11-proto/resourceproto-1.2.0
71                 >=x11-proto/scrnsaverproto-1.1
72                 >=x11-proto/videoproto-2.2.2
73                 >=x11-proto/xcmiscproto-1.2.0
74                 >=x11-proto/xineramaproto-1.1.3
75                 >=x11-libs/xtrans-1.3.2
76                 >=x11-proto/dri2proto-2.8
77                 opengl? ( >=media-libs/mesa-7.8_rc[nptl=] )
78         )"
79
80 CMAKE_IN_SOURCE_BUILD=1
81
82 pkg_setup() {
83         if ! use server ; then
84                 echo
85                 einfo "The 'server' USE flag will build tigervnc's server."
86                 einfo "If '-server' is chosen only the client is built to save space."
87                 einfo "Stop the build now if you need to add 'server' to USE flags.\n"
88         else
89                 ewarn "Forcing on xorg-x11 for new enough glxtokens.h..."
90                 OLD_IMPLEM="$(eselect opengl show)"
91                 eselect opengl set ${OPENGL_DIR}
92         fi
93 }
94
95 switch_opengl_implem() {
96         # Switch to the xorg implementation.
97         # Use new opengl-update that will not reset user selected
98         # OpenGL interface ...
99         echo
100         eselect opengl set ${OLD_IMPLEM}
101 }
102
103 src_prepare() {
104         if use server ; then
105                 cp -r "${WORKDIR}"/xorg-server-${XSERVER_VERSION}/* unix/xserver
106         else
107                 rm "${WORKDIR}"/patches/*_server_*
108         fi
109
110         EPATCH_SOURCE="${WORKDIR}/patches" EPATCH_SUFFIX="patch" \
111                 EPATCH_FORCE="yes" epatch
112
113         if use server ; then
114                 cd unix/xserver
115                 epatch ../xserver114.patch
116                 eautoreconf
117         fi
118 }
119
120 src_configure() {
121
122         use arm || use hppa && append-flags "-fPIC"
123
124         mycmakeargs=(
125                 -G "Unix Makefiles"
126                 $(cmake-utils_use_enable gnutls GNUTLS)
127                 $(cmake-utils_use_enable pam PAM)
128                 $(cmake-utils_use_build java JAVA)
129         )
130
131         cmake-utils_src_configure
132
133         if use server; then
134                 cd unix/xserver
135                 econf \
136                         $(use_enable nptl glx-tls) \
137                         $(use_enable opengl glx) \
138                         --disable-config-dbus \
139                         --disable-config-hal \
140                         --disable-config-udev \
141                         --disable-devel-docs \
142                         --disable-dmx \
143                         --disable-dri \
144                         --disable-dri3 \
145                         --disable-kdrive \
146                         --disable-selective-werror \
147                         --disable-silent-rules \
148                         --disable-static \
149                         --disable-unit-tests \
150                         --disable-xephyr \
151                         --disable-xinerama \
152                         --disable-xnest \
153                         --disable-xorg \
154                         --disable-xvfb \
155                         --disable-xwin \
156                         --enable-dri2 \
157                         --with-pic \
158                         --without-dtrace \
159                         --disable-present \
160                         --disable-unit-tests
161         fi
162 }
163
164 src_compile() {
165         cmake-utils_src_compile
166
167         if use server ; then
168                 cd unix/xserver
169                 emake
170         fi
171 }
172
173 src_install() {
174         cmake-utils_src_install
175
176         newicon "${DISTDIR}"/tigervnc.png vncviewer.png
177         make_desktop_entry vncviewer vncviewer vncviewer Network
178
179         if use server ; then
180                 cd unix/xserver/hw/vnc
181                 emake DESTDIR="${D}" install
182                 ! use xorgmodule && rm -rf "${D}"/usr/$(get_libdir)/xorg
183
184                 newconfd "${FILESDIR}"/${PN}.confd ${PN}
185                 newinitd "${FILESDIR}"/${PN}.initd ${PN}
186
187                 rm "${D}"/usr/$(get_libdir)/xorg/modules/extensions/libvnc.la
188         else
189                 cd "${D}"
190                 for f in vncserver vncpasswd x0vncserver vncconfig; do
191                         rm usr/bin/$f
192                         rm usr/share/man/man1/$f.1
193                 done
194         fi
195 }
196
197 pkg_postinst() {
198         use server && switch_opengl_implem
199 }