1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
7 inherit eutils multilib
10 MY_P=mercury-srcdist-${PV}
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"
17 LICENSE="GPL-2 LGPL-2"
19 KEYWORDS="~amd64 ~x86"
21 IUSE="X cairo examples glut iodbc ncurses odbc opengl ssl tcl tk xml"
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 )
38 S="${WORKDIR}"/${MY_P}/extras
45 epatch "${WORKDIR}"/${PV}
48 epatch "${WORKDIR}"/${PV}-odbc/${P}-odbc.patch
50 epatch "${WORKDIR}"/${PV}-odbc/${P}-iodbc.patch
54 sed -i -e "s:references:references solver_types/library:" \
55 -e "s:windows_installer_generator::" \
56 Mmakefile || die "sed default packages failed"
59 sed -i -e "s:lex[ \t]*\\\\:graphics/mercury_cairo lex \\\\:" Mmakefile \
60 || die "sed cairo failed"
64 sed -i -e "s:lex[ \t]*\\\\:graphics/mercury_glut lex \\\\:" Mmakefile \
65 || die "sed glut failed"
69 sed -i -e "s:lex[ \t]*\\\\:graphics/mercury_opengl lex \\\\:" Mmakefile \
70 || die "sed opengl failed"
73 if use tcl && use tk; then
74 sed -i -e "s:lex[ \t]*\\\\:graphics/mercury_tcltk lex \\\\:" Mmakefile \
75 || die "sed tcltk failed"
78 if use odbc || use iodbc; then
79 sed -i -e "s:moose:moose odbc:" Mmakefile \
80 || die "sed odbc failed"
84 sed -i -e "s:complex_numbers:complex_numbers curs curses:" Mmakefile \
85 || die "sed ncurses failed"
89 sed -i -e "s:xml::" Mmakefile \
90 || die "sed xml failed"
93 sed -i -e "s:@libdir@:$(get_libdir):" \
94 dynamic_linking/Mmakefile \
95 || die "sed libdir failed"
97 # disable broken packages
98 sed -i -e "s:references::" Mmakefile \
99 || die "sed broken packages failed"
103 # Mercury dependency generation must be run single-threaded
105 -j1 depend || die "mmake depend failed"
107 # Compiling Mercury submodules is not thread-safe
109 EXTRA_MLFLAGS=--no-strip \
110 EXTRA_LDFLAGS="${LDFLAGS}" \
111 EXTRA_LD_LIBFLAGS="${LDFLAGS}" \
112 || die "mmake failed"
116 # Compiling Mercury submodules is not thread-safe
118 EXTRA_LD_LIBFLAGS="${LDFLAGS}" \
119 INSTALL_PREFIX="${D}"/usr \
120 install || die "mmake install failed"
122 find "${D}"/usr/$(get_libdir)/mercury -type l | xargs rm
125 if use examples; then
126 insinto /usr/share/doc/${PF}/samples/base64
127 doins base64/*.m || die
129 insinto /usr/share/doc/${PF}/samples/complex_numbers
130 doins complex_numbers/samples/* || die
132 insinto /usr/share/doc/${PF}/samples/dynamic_linking
133 doins dynamic_linking/hello.m || die
135 insinto /usr/share/doc/${PF}/samples/error
138 insinto /usr/share/doc/${PF}/samples/fixed
139 doins fixed/*.m || die
141 insinto /usr/share/doc/${PF}/samples/gator
142 doins -r gator/* || die
144 insinto /usr/share/doc/${PF}/samples/lex
145 doins lex/samples/* || die
147 insinto /usr/share/doc/${PF}/samples/log4m
148 doins log4m/*.m || die
150 insinto /usr/share/doc/${PF}/samples/monte
151 doins monte/*.m || die
153 insinto /usr/share/doc/${PF}/samples/moose
154 doins moose/samples/* || die
156 insinto /usr/share/doc/${PF}/samples/net
160 insinto /usr/share/doc/${PF}/samples/curs
161 doins curs/samples/* || die
163 insinto /usr/share/doc/${PF}/samples/curses
164 doins curses/sample/* || die
168 insinto /usr/share/doc/${PF}/samples/graphics
169 doins graphics/easyx/samples/*.m || die
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
180 if use opengl && use tcl && use tk; then
181 insinto /usr/share/doc/${PF}/samples/graphics
182 doins graphics/samples/pent/*.m || die
186 insinto /usr/share/doc/${PF}/samples/mopenssl
187 doins mopenssl/*.m || die