Merge remote-tracking branch 'github/pr/1633', bug 527306 by Ettore Di Giacinto
[gentoo.git] / net-misc / unison / unison-2.45.4.ebuild
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI="5"
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 ~arm ~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_compile() {
34         local myconf
35
36         if use threads; then
37                 myconf="$myconf THREADS=true"
38         fi
39
40         if use static; then
41                 myconf="$myconf STATIC=true"
42         fi
43
44         if use debug; then
45                 myconf="$myconf DEBUGGING=true"
46         fi
47
48         if use gtk; then
49                 myconf="$myconf UISTYLE=gtk2"
50         else
51                 myconf="$myconf UISTYLE=text"
52         fi
53
54         use ocamlopt || myconf="$myconf NATIVE=false"
55
56         # Discard cflags as it will try to pass them to ocamlc...
57         emake $myconf CFLAGS="" buildexecutable
58 }
59
60 src_test() {
61         emake selftest
62 }
63
64 src_install () {
65         # install manually, since it's just too much
66         # work to force the Makefile to do the right thing.
67         newbin unison unison-${SLOT}
68         dodoc BUGS.txt CONTRIB INSTALL NEWS \
69                   README ROADMAP.txt TODO.txt
70
71         if use doc; then
72                 dohtml "${DISTDIR}/${P}-manual.html"
73                 dodoc "${DISTDIR}/${P}-manual.pdf"
74         fi
75         use ocamlopt || export STRIP_MASK="*/bin/*"
76 }
77
78 pkg_postinst() {
79         elog "Unison now uses SLOTs, so you can specify servercmd=/usr/bin/unison-${SLOT}"
80         elog "in your profile files to access exactly this version over ssh."
81         elog "Or you can use 'eselect unison' to set the version."
82 }