6c313c38b06b127f6aed2960645fbb2626f3a534
[gentoo.git] / dev-scheme / racket / racket-7.3.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 inherit pax-utils
7
8 DESCRIPTION="General purpose, multi-paradigm Lisp-Scheme programming language"
9 HOMEPAGE="https://racket-lang.org/"
10 SRC_URI="minimal? ( https://download.racket-lang.org/installers/${PV}/${PN}-minimal-${PV}-src-builtpkgs.tgz ) !minimal? ( https://download.racket-lang.org/installers/${PV}/${P}-src-builtpkgs.tgz )"
11 LICENSE="GPL-3+ LGPL-3"
12 SLOT="0"
13 KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~x86"
14 IUSE="doc +futures +jit minimal +places +readline +threads +X"
15 REQUIRED_USE="futures? ( jit )"
16
17 RDEPEND="dev-db/sqlite:3
18         media-libs/libpng:0
19         x11-libs/cairo[X?]
20         x11-libs/pango[X?]
21         virtual/libffi
22         virtual/jpeg:0
23         readline? ( dev-libs/libedit )
24         X? ( x11-libs/gtk+[X?] )"
25 RDEPEND="${RDEPEND} !dev-tex/slatex"
26
27 DEPEND="${RDEPEND}"
28
29 S="${WORKDIR}/${P}/src"
30
31 src_prepare() {
32         default
33         rm -r foreign/libffi || die 'failed to remove bundled libffi'
34 }
35
36 src_configure() {
37         # According to vapier, we should use the bundled libtool
38         # such that we don't preclude cross-compile. Thus don't use
39         # --enable-lt=/usr/bin/libtool
40         econf \
41                 --docdir="${EPREFIX}"/usr/share/doc/${PF} \
42                 --enable-shared \
43                 --enable-float \
44                 --enable-libffi \
45                 --enable-foreign \
46                 --disable-libs \
47                 --disable-strip \
48                 $(use_enable X gracket) \
49                 $(use_enable doc docs) \
50                 $(use_enable jit) \
51                 $(use_enable places) \
52                 $(use_enable futures) \
53                 $(use_enable threads pthread)
54 }
55
56 src_compile() {
57         if use jit; then
58                 # When the JIT is enabled, a few binaries need to be pax-marked
59                 # on hardened systems (bug 613634). The trick is to pax-mark
60                 # them before they're used later in the build system. The
61                 # following order for racketcgc and racket3m was determined by
62                 # digging through the Makefile in src/racket to find out which
63                 # targets would build those binaries but not use them.
64                 pushd racket
65                 emake cgc-core
66                 pax-mark m .libs/racketcgc
67                 pushd gc2
68                 emake all
69                 popd
70                 pax-mark m .libs/racket3m
71                 popd
72         fi
73
74         default
75 }
76
77 src_install() {
78         default
79
80         if use jit; then
81                 # The final binaries need to be pax-marked, too, if you want to
82                 # actually use them. The src_compile marking get lost somewhere
83                 # in the install process.
84                 for f in mred mzscheme racket; do
85                         pax-mark m "${D}/usr/bin/${f}"
86                 done
87
88                 use X && pax-mark m "${D}/usr/$(get_libdir)/racket/gracket"
89         fi
90         # raco needs decompressed files for packages doc installation bug 662424
91         if use doc; then
92                 docompress -x /usr/share/doc/${PF}
93         fi
94         find "${ED}" \( -name "*.a" -o -name "*.la" \) -delete || die
95 }