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

EAPI=7

inherit flag-o-matic toolchain-funcs

DESCRIPTION="An embeddable Javascript interpreter in C."
HOMEPAGE="
	https://mujs.com/
	https://github.com/ccxvii/mujs/
"
SRC_URI="https://github.com/ccxvii/mujs/archive/${PV}.tar.gz -> ${P}.tar.gz"
# Not available right now.
#SRC_URI="https://mujs.com/downloads/${P}.tar.xz"

LICENSE="ISC"
# subslot matches SONAME
SLOT="0/${PV}"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ppc64 ~s390 sparc ~x86 ~amd64-linux ~ppc-macos ~x64-macos ~x86-macos"
IUSE="static-libs"

RDEPEND="sys-libs/readline:0="
DEPEND="${RDEPEND}"

PATCHES=(
	"${FILESDIR}/${PN}-1.0.5-flags.patch"
)

src_prepare() {
	default

	tc-export AR CC

	# library's ABI (and API) changes in ~each release:
	# diff 'usr/includemujs.h' across releases to validate
	append-cflags -fPIC -Wl,-soname=lib${PN}.so.${PV}
}

src_compile() {
	emake VERSION=${PV} prefix=/usr shared
}

src_install() {
	local myeconfargs=(
		DESTDIR="${ED}"
		install-shared
		libdir="/usr/$(get_libdir)"
		prefix="/usr"
		VERSION="${PV}"
		$(usex static-libs install-static '')
	)

	emake "${myeconfargs[@]}"

	mv -v "${ED}"/usr/$(get_libdir)/lib${PN}.so{,.${PV}} || die

	dosym lib${PN}.so.${PV} /usr/$(get_libdir)/lib${PN}.so
	dosym lib${PN}.so.${PV} /usr/$(get_libdir)/lib${PN}.so.${PV:0:1}
}