net-misc/unison: use eselect update to set a default.
[gentoo.git] / net-misc / unison / unison-2.32.52.ebuild
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI="2"
6
7 inherit eutils versionator
8
9 IUSE="gtk doc static debug threads +ocamlopt test"
10
11 DESCRIPTION="Two-way cross-platform file synchronizer"
12 HOMEPAGE="http://www.cis.upenn.edu/~bcpierce/unison/"
13 LICENSE="GPL-2"
14 SLOT="$(get_version_component_range 1-2 ${PV})"
15 KEYWORDS="~amd64 ~ppc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos ~sparc-solaris"
16
17 # ocaml version so we are sure it has ocamlopt use flag
18 DEPEND=">=dev-lang/ocaml-3.10.2[ocamlopt?]
19         gtk? ( >=dev-ml/lablgtk-2.2 )
20         test? ( || ( dev-util/ctags virtual/emacs ) )"
21
22 RDEPEND="gtk? ( >=dev-ml/lablgtk-2.2
23         || ( net-misc/x11-ssh-askpass net-misc/ssh-askpass-fullscreen ) )
24         !net-misc/unison:0
25         app-eselect/eselect-unison"
26
27 #PDEPEND="gtk? ( media-fonts/font-schumacher-misc )"
28
29 SRC_URI="http://www.cis.upenn.edu/~bcpierce/unison/download/releases/${P}/${P}.tar.gz
30         doc? ( http://www.cis.upenn.edu/~bcpierce/unison/download/releases/${P}/${P}-manual.pdf
31                 http://www.cis.upenn.edu/~bcpierce/unison/download/releases/${P}/${P}-manual.html )"
32
33 src_prepare() {
34         epatch "${FILESDIR}/${PN}-2.27.57-as-needed.patch"
35         epatch "${FILESDIR}/${PN}-mymap.patch"
36 }
37
38 src_compile() {
39         local myconf
40
41         if use threads; then
42                 myconf="$myconf THREADS=true"
43         fi
44
45         if use static; then
46                 myconf="$myconf STATIC=true"
47         fi
48
49         if use debug; then
50                 myconf="$myconf DEBUGGING=true"
51         fi
52
53         if use gtk; then
54                 myconf="$myconf UISTYLE=gtk2"
55         else
56                 myconf="$myconf UISTYLE=text"
57         fi
58
59         use ocamlopt || myconf="$myconf NATIVE=false"
60
61         # Discard cflags as it will try to pass them to ocamlc...
62         emake $myconf CFLAGS="" buildexecutable || die "error making unsion"
63 }
64
65 src_test() {
66         emake selftest ||  die "selftest failed"
67 }
68
69 src_install () {
70         # install manually, since it's just too much
71         # work to force the Makefile to do the right thing.
72         newbin unison unison-${SLOT} || die
73         dodoc BUGS.txt CONTRIB INSTALL NEWS \
74                   README ROADMAP.txt TODO.txt || die
75
76         if use doc; then
77                 dohtml "${DISTDIR}/${P}-manual.html" || die
78                 dodoc "${DISTDIR}/${P}-manual.pdf" || die
79         fi
80         use ocamlopt || export STRIP_MASK="*/bin/*"
81 }
82
83 pkg_postinst() {
84         elog "Unison now uses SLOTs, so you can specify servercmd=/usr/bin/unison-${SLOT}"
85         elog "in your profile files to access exactly this version over ssh."
86         elog "Or you can use 'eselect unison' to set the version."
87 }