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

EAPI=8

inherit cmake

DESCRIPTION="A interpreted language mainly used for games"
HOMEPAGE="http://squirrel-lang.org/"
# Missing file in the tarball, do the same as Mageia
SRC_URI="https://download.sourceforge.net/squirrel/${PN}_${PV/./_}_stable.tar.gz -> ${P}.tar.gz
	https://raw.githubusercontent.com/albertodemichelis/squirrel/v${PV}/squirrel-config.cmake.in -> squirrel-config.cmake.in_${PV}"

LICENSE="ZLIB"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="examples static-libs"

RDEPEND=""
DEPEND="${RDEPEND}"

S="${WORKDIR}/${PN}3"

PATCHES=(
	# Fixed in master
	"${FILESDIR}/${P}-CVE-2022-30292.patch"
)

src_prepare() {
	cp "${DISTDIR}/squirrel-config.cmake.in_${PV}" "${S}/squirrel-config.cmake.in" || die
	cmake_src_prepare
}

src_configure() {
	local mycmakeargs=(
		$(usex static-libs '' -DDISABLE_STATIC=YES)
		# /usr/bin/sq is used by app-text/ispell
		# /usr/lib/libsquirrel.so is used by app-shells/squirrelsh
		-DLONG_OUTPUT_NAMES=YES
	)

	cmake_src_configure
}

src_install() {
	cmake_src_install

	dodoc HISTORY

	if use examples; then
		docompress -x /usr/share/doc/${PF}/samples
		dodoc -r samples
	fi

	# Add pkgconfig file, needed for some reverse deps (follows Mageia
	# one)
	# https://github.com/albertodemichelis/squirrel/issues/259
	dodir /usr/$(get_libdir)/pkgconfig
	sed \
		-e "s/@libdir@/$(get_libdir)/" \
		-e "s/@version@/${PV}/" \
		"${FILESDIR}/${PN}.pc.in" > "${ED}/usr/$(get_libdir)/pkgconfig/${PN}.pc" || die
}