dev-ml/lablgtk: took maintainership
[gentoo.git] / dev-ml / lablgl / lablgl-1.05-r1.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI="5"
5
6 inherit multilib eutils toolchain-funcs
7
8 IUSE="doc glut +ocamlopt tk"
9
10 DESCRIPTION="Objective CAML interface for OpenGL"
11 HOMEPAGE="http://wwwfun.kurims.kyoto-u.ac.jp/soft/olabl/lablgl.html"
12 LICENSE="BSD"
13
14 RDEPEND="
15         >=dev-lang/ocaml-3.10.2:=[ocamlopt?]
16         x11-libs/libXext
17         x11-libs/libXmu
18         x11-libs/libX11
19         virtual/opengl
20         virtual/glu
21         dev-ml/camlp4:=
22         glut? ( media-libs/freeglut )
23         tk? (
24                 >=dev-lang/tcl-8.3:0=
25                 >=dev-lang/tk-8.3:0=
26                 dev-ml/labltk:=
27         )
28         "
29
30 DEPEND="${RDEPEND}"
31
32 SRC_URI="http://wwwfun.kurims.kyoto-u.ac.jp/soft/olabl/dist/${P}.tar.gz"
33 SLOT="0/${PV}"
34 KEYWORDS="~alpha amd64 ~arm ~arm64 hppa ia64 ppc ppc64 sparc x86 ~amd64-linux ~x86-linux"
35
36 src_configure() {
37         # make configuration file
38         echo "BINDIR=/usr/bin" > Makefile.config
39         echo "GLLIBS = -lGL -lGLU" >> Makefile.config
40         if use glut; then
41                 echo "GLUTLIBS = -lglut" >> Makefile.config
42         else
43                 echo "GLUTLIBS = " >> Makefile.config
44         fi
45         echo "XLIBS = -lXext -lXmu -lX11" >> Makefile.config
46         echo "RANLIB = $(tc-getRANLIB)" >> Makefile.config
47         echo 'COPTS = -c -O $(CFLAGS)' >> Makefile.config
48         echo 'INCLUDES = $(TKINCLUDES) $(GLINCLUDES) $(XINCLUDES)' >> Makefile.config
49 }
50
51 src_compile() {
52         if use tk; then
53                 emake togl
54                 if use ocamlopt; then
55                         emake toglopt
56                 fi
57         fi
58
59         emake lib
60         if use ocamlopt; then
61                 emake libopt
62         fi
63
64         if use glut; then
65                 emake glut
66                 if use ocamlopt; then
67                         emake glutopt
68                 fi
69         fi
70 }
71
72 src_install () {
73         # Makefile do not use mkdir so the library is not installed
74         # but copied as a 'stublibs' file.
75         dodir /usr/$(get_libdir)/ocaml/stublibs
76
77         # Same for lablglut's toplevel
78         dodir /usr/bin
79
80         BINDIR=${ED}/usr/bin
81         BASE=${ED}/usr/$(get_libdir)/ocaml
82         emake BINDIR="${BINDIR}" INSTALLDIR="${BASE}/lablGL" DLLDIR="${BASE}/stublibs" install
83
84         dodoc README CHANGES
85
86         if use doc ; then
87                 insinto /usr/share/doc/${PF}
88                 mv Togl/examples{,.togl}
89                 doins -r Togl/examples.togl
90
91                 mv LablGlut/examples{,.glut}
92                 doins -r LablGlut/examples.glut
93         fi
94 }