dev-python/virtualenv: arm64 keyworded (bug #700918)
[gentoo.git] / dev-lang / teyjus / teyjus-2.1.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI="6"
5
6 inherit elisp-common multilib versionator
7
8 DESCRIPTION="Higher-order logic programming language Lambda Prolog"
9 HOMEPAGE="http://teyjus.cs.umn.edu/"
10 SRC_URI="https://github.com/teyjus/teyjus/archive/v${PV}.tar.gz -> ${P}.tar.gz"
11
12 SLOT="0/${PV}"
13 KEYWORDS="~amd64 ~x86"
14 LICENSE="GPL-3"
15 IUSE="emacs examples +ocamlopt"
16
17 RDEPEND=">=sys-devel/binutils-2.17:*
18         >=sys-devel/gcc-2.95.3:*
19         >=dev-lang/ocaml-3.10[ocamlopt?]
20         emacs? ( >=app-editors/emacs-23.1:* )"
21 DEPEND="${RDEPEND}
22         dev-util/omake"
23
24 SITEFILE=50${PN}-gentoo.el
25
26 src_prepare() {
27         default
28         local cflags=""
29         for i in ${CFLAGS}
30         do
31                 cflags="${cflags} -ccopt ${i}"
32         done
33         local lflags=""
34         for i in ${LDFLAGS}
35         do
36                 lflags="${lflags} -cclib ${i}"
37         done
38         sed     -e "s@\(OCAMLFLAGS= -w -A\)@\1 ${cflags}${lflags}@" \
39                 -e "s@\(CFLAGS +=\) -g@\1 ${CFLAGS}\nLDFLAGS += ${LDFLAGS}@" \
40                 -i "${S}/source/OMakefile" \
41                 || die "Could not set flags in ${S}/teyjus/source/OMakefile"
42         if has_version ">=dev-lang/ocaml-4.03.0"; then
43                 # bug 591368
44                 pushd "${S}/source" || die
45                 sed -e 's@$(FNT)/ccode_stubs@$(FNT)/ccode_stubs_c@' \
46                         -e 's@\(FNT_ML_TO_C\[\] =\)@\1\n    $(FNT)/ccode_stubs@' \
47                         -i OMakefile || die
48                 cd "${S}/source/front" || die
49                 mv ccode_stubs.mli ccode_stubs.ml || die
50                 mv ccode_stubs.c ccode_stubs_c.c || die
51                 popd || die
52         fi
53 }
54
55 src_compile() {
56         addpredict "/usr/$(get_libdir)/omake/Pervasives.omc"
57         addpredict "/usr/$(get_libdir)/omake/build/C.omc"
58         addpredict "/usr/$(get_libdir)/omake/build/Common.omc"
59         addpredict "/usr/$(get_libdir)/omake/configure/Configure.omc"
60         addpredict "/usr/$(get_libdir)/omake/build/OCaml.omc"
61         omake --verbose all || die "omake all failed"
62         if use emacs ; then
63                 pushd "${S}/emacs" || die "Could change directory to emacs"
64                 elisp-compile *.el || die "emacs elisp compile failed"
65                 popd
66         fi
67 }
68
69 ins_example_dir() {
70         dodir "/usr/share/${PN}/examples/${1}"
71         insinto "/usr/share/${PN}/examples/${1}"
72         cd "${S}/examples/${1}"
73         doins *
74 }
75
76 src_install() {
77         newbin source/tjcc.opt tjcc
78         newbin source/tjdepend.opt tjdepend
79         newbin source/tjdis.opt tjdis
80         newbin source/tjlink.opt tjlink
81         newbin source/tjsim.opt tjsim
82         dodoc README.md QUICKSTART
83         if use emacs ; then
84                 elisp-install ${PN} emacs/*.{el,elc}
85                 cp "${FILESDIR}"/${SITEFILE} "${S}"
86                 sed -e 's@/usr/bin/tjcc@'${EPREFIX}/usr/bin/tjcc'@' -i ${SITEFILE} \
87                         || die "Could not set tjcc executable path in emacs site file"
88                 elisp-site-file-install ${SITEFILE}
89         fi
90         if use examples; then
91                 ins_example_dir "handbook/logic"
92                 ins_example_dir "handbook/progs"
93                 ins_example_dir "misc"
94                 ins_example_dir "ndprover"
95                 ins_example_dir "pcf"
96         fi
97 }
98
99 pkg_postinst() {
100         if use emacs; then
101                 elisp-site-regen
102                 ewarn "For teyjus emacs, add this line to ~/.emacs"
103                 ewarn ""
104                 ewarn "(require 'teyjus)"
105         fi
106 }
107
108 pkg_postrm() {
109         use emacs && elisp-site-regen
110 }