Use https by default
[gentoo.git] / net-misc / tigervnc / tigervnc-1.3.1-r2.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.1"
10 XSERVER_VERSION="1.16.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.1-patches-${PATCHVER}.tar.bz2
20         https://dev.gentoo.org/~armin76/dist/${PN}-1.3.1-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.26
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.1.3
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.3
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" EPATCH_EXCLUDE="*999*" \
111                 EPATCH_FORCE="yes" epatch
112
113         if use server ; then
114                 cd unix/xserver
115                 epatch "${WORKDIR}"/patches/0999_server_xserver-1.14-rebased.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-hal \
139                         --disable-config-udev \
140                         --disable-devel-docs \
141                         --disable-dmx \
142                         --disable-dri \
143                         --disable-dri3 \
144                         --disable-kdrive \
145                         --disable-selective-werror \
146                         --disable-silent-rules \
147                         --disable-static \
148                         --disable-unit-tests \
149                         --disable-xephyr \
150                         --disable-xinerama \
151                         --disable-xnest \
152                         --disable-xorg \
153                         --disable-xvfb \
154                         --disable-xwin \
155                         --enable-dri2 \
156                         --with-pic \
157                         --without-dtrace \
158                         --disable-present \
159                         --disable-unit-tests
160         fi
161 }
162
163 src_compile() {
164         cmake-utils_src_compile
165
166         if use server ; then
167                 cd unix/xserver
168                 emake
169         fi
170 }
171
172 src_install() {
173         cmake-utils_src_install
174
175         newicon "${DISTDIR}"/tigervnc.png vncviewer.png
176         make_desktop_entry vncviewer vncviewer vncviewer Network
177
178         if use server ; then
179                 cd unix/xserver/hw/vnc
180                 emake DESTDIR="${D}" install
181                 ! use xorgmodule && rm -rf "${D}"/usr/$(get_libdir)/xorg
182
183                 newconfd "${FILESDIR}"/${PN}.confd ${PN}
184                 newinitd "${FILESDIR}"/${PN}.initd ${PN}
185
186                 rm "${D}"/usr/$(get_libdir)/xorg/modules/extensions/libvnc.la
187         else
188                 cd "${D}"
189                 for f in vncserver vncpasswd x0vncserver vncconfig; do
190                         rm usr/bin/$f
191                         rm usr/share/man/man1/$f.1
192                 done
193         fi
194 }
195
196 pkg_postinst() {
197         use server && switch_opengl_implem
198 }