summaryrefslogtreecommitdiff
blob: a01db9b14ed8dea03ecda6f00ed9749cce8599b0 (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
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=6

inherit common-lisp-3 eutils flag-o-matic multilib toolchain-funcs

MY_P="${PN}_${PV}"

DESCRIPTION="Linedit is a readline-style library written in Common Lisp."
HOMEPAGE="http://www.common-lisp.net/project/linedit/"
SRC_URI="http://common-lisp.net/project/${PN}/files/${MY_P}.tar.gz"

LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~ppc ~sparc ~x86"
IUSE=""

RDEPEND="!dev-lisp/cl-${PN}
		dev-lisp/osicat
		dev-lisp/terminfo
		dev-lisp/uffi"

S="${WORKDIR}/${MY_P}"

@cc() {
	local cc=$(tc-getCC)
	echo "${cc}" "${@}"
	"${cc}" "${@}"
}

create_uffi_loader() {
	cat > uffi-loader.lisp <<-EOF
	;;;; -*- mode: lisp; syntax: common-lisp; indent-tabs-mode: nil; base: 10; package: linedit -*-
	(in-package :linedit)

	(uffi:load-foreign-library #p"/usr/$(get_libdir)/linedit/signals.so")
	(uffi:load-foreign-library #p"/usr/$(get_libdir)/linedit/terminal_glue.so")
	EOF
}

src_prepare() {
	default
	eapply "${FILESDIR}"/${PV}-${PN}.asd-uffi-glue-gentoo.patch
	create_uffi_loader
}

src_compile() {
	strip-flags
	for filename in signals terminal_glue ; do
		@cc "${filename}.c" ${CFLAGS} ${LDFLAGS} \
			-fPIC -DPIC -shared -Wl,-soname="${filename}" -o "${filename}.so" \
		|| die "Cannot compile ${filename}.c"
	done
}

src_install() {
	common-lisp-install-sources -t all *.lisp version.lisp-expr
	common-lisp-install-asdf
	exeinto "/usr/$(get_libdir)/${PN}"
	doexe *.so
}