summaryrefslogtreecommitdiff
blob: 29ed1611a7a0cfd4fd150c827605a6c1a88d4918 (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
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit flag-o-matic toolchain-funcs

DESCRIPTION="A UNIX Shell with a simplified Scheme syntax"
HOMEPAGE="http://slon.ttk.ru/esh/"
SRC_URI="http://slon.ttk.ru/esh/${P}.tar.gz"
S="${WORKDIR}"/${PN}

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="amd64 ppc x86"
IUSE="debug"

DEPEND=">=sys-libs/readline-4.1:="
RDEPEND="${DEPEND}"
BDEPEND="virtual/pkgconfig"

PATCHES=(
	"${FILESDIR}"/${P}-fix-build-for-clang16.patch
)

src_prepare() {

	# For some reason, this tarball has binary files in it for x86.
	# Make clean so we can rebuild for our arch and optimization.
	emake clean

	default

	sed -i \
		-e 's|-g ||' \
		-e 's|-DMEM_DEBUG ||' \
		-e 's|^CFLAGS|&+|g' \
		-e 's|$(CC) |&$(CFLAGS) $(CPPFLAGS) $(INC) $(LDFLAGS) $(LIB) $(LIBS)|g' \
		-e 's:-ltermcap::' \
		-e "s:/usr/include/readline:${ESYSROOT}/usr/include/readline:" \
		-e "s:LIB=-readline:$($(tc-getPKG_CONFIG) --libs readline):" \
		Makefile || die
}

src_compile() {
	use debug && append-flags -DMEM_DEBUG

	append-cppflags "$($(tc-getPKG_CONFIG) --cflags readline)"

	emake \
		CC="$(tc-getCC)" \
		CFLAGS="${CFLAGS} \$(INC)" \
		CPPFLAGS="${CPPFLAGS}" \
		LDFLAGS="${LDFLAGS}"
}

src_install() {
	dobin esh
	doinfo doc/esh.info
	dodoc CHANGELOG CREDITS GC_README HEADER READLINE-HACKS TODO

	docinto html
	dodoc doc/*.html

	docinto examples
	dodoc examples/*
}