summaryrefslogtreecommitdiff
path: root/dev-scheme/chicken/chicken-5.4.0.ebuild
blob: 3cae349459d02baa042b9a733c9bca27c2fd63bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit toolchain-funcs

DESCRIPTION="Scheme interpreter and native Scheme to C compiler"
HOMEPAGE="https://www.call-cc.org/"
SRC_URI="https://code.call-cc.org/releases/${PV}/${P}.tar.gz"

LICENSE="BSD"
SLOT="0"
KEYWORDS="~alpha amd64 ~mips ppc ppc64 ~riscv x86"
IUSE="doc"

src_prepare() {
	default

	# because chicken's upstream is in the habit of using variables that
	# portage also uses :( eg. $ARCH and $A
	sed -i \
		-e "s/A\([[:space:]]*?=\|)\)/z&/" \
		-e "s/ARCH/z&/" \
		-e "/LICENSE /d" \
		Makefile.* {defaults,rules}.make || die

	sed -i \
		-e "s|/lib|/$(get_libdir)|" \
		-e "s|\$(DATADIR)/doc|\$(SHAREDIR)/doc/${PF}|" \
		defaults.make || die

	sed -i \
		-e "/\$(CHICKEN_DO_PROGRAM)\$(EXE):/,/^$/s/\(\$<\)/\$(LINKER_OPTIONS) \1/" \
		rules.make || die

	use doc || sed -i "/\$(SEP)manual/d" rules.make || die
}

src_compile() {
	emake -j1										\
		PLATFORM="linux"							\
		PREFIX="${EPREFIX}/usr"						\
		C_COMPILER="$(tc-getCC)"					\
		C_COMPILER_OPTIMIZATION_OPTIONS="${CFLAGS}"	\
		CXX_COMPILER="$(tc-getCXX)"					\
		HOSTSYSTEM="${CBUILD}"						\
		LINKER_OPTIONS="${LDFLAGS}"
}

src_test() {
	cd tests && ./runtests.sh || die
}

src_install() {
	emake -j1 \
		PLATFORM="linux" \
		PREFIX="${EPREFIX}/usr" \
		C_COMPILER="$(tc-getCC)" \
		C_COMPILER_OPTIMIZATION_OPTIONS="${CFLAGS}" \
		CXX_COMPILER="$(tc-getCXX)" \
		HOSTSYSTEM="${CBUILD}" \
		LINKER_OPTIONS="${LDFLAGS}" \
		DESTDIR="${D}" \
		install
	einstalldocs
	find "${ED}" -name '*.a' -delete || die

	# let portage track this file (created later)
	touch "${ED}"/usr/$(get_libdir)/${PN}/11/modules.db || die
}

pkg_postinst() {
	# create modules.db file in ${ROOT}
	chicken-install -update-db || die
}