dev-lang/mono: generic cleanup
[gentoo.git] / dev-lang / mercury-extras / mercury-extras-13.05.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 multilib
8
9 PATCHSET_VER="0"
10 MY_P=mercury-srcdist-${PV}
11
12 DESCRIPTION="Additional libraries and tools that are not part of the Mercury standard library"
13 HOMEPAGE="http://www.mercurylang.org/index.html"
14 SRC_URI="http://dl.mercurylang.org/release/${MY_P}.tar.gz
15         mirror://gentoo/${P}-gentoo-patchset-${PATCHSET_VER}.tar.gz"
16
17 LICENSE="GPL-2 LGPL-2"
18 SLOT="0"
19 KEYWORDS="~amd64 ~x86"
20
21 IUSE="X cairo examples glut iodbc ncurses odbc opengl ssl tcl tk xml"
22
23 RDEPEND="~dev-lang/mercury-${PV}
24         cairo? ( >=x11-libs/cairo-1.10.0 )
25         glut? ( media-libs/freeglut )
26         odbc? ( dev-db/unixODBC )
27         iodbc? ( !odbc? ( dev-db/libiodbc ) )
28         ncurses? ( sys-libs/ncurses )
29         opengl? ( virtual/opengl )
30         tcl? ( tk? (
31                         dev-lang/tcl:0
32                         dev-lang/tk:0
33                         x11-libs/libX11
34                         x11-libs/libXmu ) )"
35
36 DEPEND="${RDEPEND}"
37
38 S="${WORKDIR}"/${MY_P}/extras
39
40 src_prepare() {
41         cd "${WORKDIR}"
42
43         EPATCH_FORCE=yes
44         EPATCH_SUFFIX=patch
45         epatch "${WORKDIR}"/${PV}
46
47         if use odbc; then
48                 epatch "${WORKDIR}"/${PV}-odbc/${P}-odbc.patch
49         elif use iodbc; then
50                 epatch "${WORKDIR}"/${PV}-odbc/${P}-iodbc.patch
51         fi
52
53         cd "${S}"
54         sed -i  -e "s:references:references solver_types/library:" \
55                 -e "s:windows_installer_generator::" \
56                 Mmakefile || die "sed default packages failed"
57
58         if use cairo; then
59                 sed -i -e "s:lex[ \t]*\\\\:graphics/mercury_cairo lex \\\\:" Mmakefile \
60                         || die "sed cairo failed"
61         fi
62
63         if use glut; then
64                 sed -i -e "s:lex[ \t]*\\\\:graphics/mercury_glut lex \\\\:" Mmakefile \
65                         || die "sed glut failed"
66         fi
67
68         if use opengl; then
69                 sed -i -e "s:lex[ \t]*\\\\:graphics/mercury_opengl lex \\\\:" Mmakefile \
70                         || die "sed opengl failed"
71         fi
72
73         if use tcl && use tk; then
74                 sed -i -e "s:lex[ \t]*\\\\:graphics/mercury_tcltk lex \\\\:" Mmakefile \
75                         || die "sed tcltk failed"
76         fi
77
78         if use odbc || use iodbc; then
79                 sed -i -e "s:moose:moose odbc:" Mmakefile \
80                         || die "sed odbc failed"
81         fi
82
83         if use ncurses; then
84                 sed -i -e "s:complex_numbers:complex_numbers curs curses:" Mmakefile \
85                         || die "sed ncurses failed"
86         fi
87
88         if ! use xml; then
89                 sed -i -e "s:xml::" Mmakefile \
90                         || die "sed xml failed"
91         fi
92
93         sed -i -e "s:@libdir@:$(get_libdir):" \
94                 dynamic_linking/Mmakefile \
95                 || die "sed libdir failed"
96
97         # disable broken packages
98         sed -i -e "s:references::" Mmakefile \
99                 || die "sed broken packages failed"
100 }
101
102 src_compile() {
103         # Mercury dependency generation must be run single-threaded
104         mmake \
105                 -j1 depend || die "mmake depend failed"
106
107         # Compiling Mercury submodules is not thread-safe
108         mmake -j1 \
109                 EXTRA_MLFLAGS=--no-strip \
110                 EXTRA_LDFLAGS="${LDFLAGS}" \
111                 EXTRA_LD_LIBFLAGS="${LDFLAGS}" \
112                 || die "mmake failed"
113 }
114
115 src_install() {
116         # Compiling Mercury submodules is not thread-safe
117         mmake -j1 \
118                 EXTRA_LD_LIBFLAGS="${LDFLAGS}" \
119                 INSTALL_PREFIX="${D}"/usr \
120                 install || die "mmake install failed"
121
122         find "${D}"/usr/$(get_libdir)/mercury -type l | xargs rm
123
124         cd "${S}"
125         if use examples; then
126                 insinto /usr/share/doc/${PF}/samples/base64
127                 doins base64/*.m || die
128
129                 insinto /usr/share/doc/${PF}/samples/complex_numbers
130                 doins complex_numbers/samples/* || die
131
132                 insinto /usr/share/doc/${PF}/samples/dynamic_linking
133                 doins dynamic_linking/hello.m || die
134
135                 insinto /usr/share/doc/${PF}/samples/error
136                 doins error/* || die
137
138                 insinto /usr/share/doc/${PF}/samples/fixed
139                 doins fixed/*.m || die
140
141                 insinto /usr/share/doc/${PF}/samples/gator
142                 doins -r gator/* || die
143
144                 insinto /usr/share/doc/${PF}/samples/lex
145                 doins lex/samples/* || die
146
147                 insinto /usr/share/doc/${PF}/samples/log4m
148                 doins log4m/*.m || die
149
150                 insinto /usr/share/doc/${PF}/samples/monte
151                 doins monte/*.m || die
152
153                 insinto /usr/share/doc/${PF}/samples/moose
154                 doins moose/samples/* || die
155
156                 insinto /usr/share/doc/${PF}/samples/net
157                 doins net/*.m || die
158
159                 if use ncurses; then
160                         insinto /usr/share/doc/${PF}/samples/curs
161                         doins curs/samples/* || die
162
163                         insinto /usr/share/doc/${PF}/samples/curses
164                         doins curses/sample/* || die
165                 fi
166
167                 if use X; then
168                         insinto /usr/share/doc/${PF}/samples/graphics
169                         doins graphics/easyx/samples/*.m || die
170                 fi
171
172                 if use glut && use opengl; then
173                         insinto /usr/share/doc/${PF}/samples/graphics
174                         doins graphics/samples/calc/* || die
175                         doins graphics/samples/gears/* || die
176                         doins graphics/samples/maze/* || die
177                         doins graphics/samples/pent/* || die
178                 fi
179
180                 if use opengl && use tcl && use tk; then
181                         insinto /usr/share/doc/${PF}/samples/graphics
182                         doins graphics/samples/pent/*.m || die
183                 fi
184
185                 if use ssl; then
186                         insinto /usr/share/doc/${PF}/samples/mopenssl
187                         doins mopenssl/*.m || die
188                 fi
189
190                 ecvs_clean
191         fi
192
193         dodoc README || die
194 }