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

EAPI=7

inherit meson multilib

MY_PN="Box2D"
DESCRIPTION="A C++ engine for simulating rigid bodies in 2D games"
HOMEPAGE="https://box2d.org/"
SRC_URI="https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/${PN}/${MY_PN}_v${PV}.zip"
LICENSE="ZLIB"
SLOT="$(ver_cut 1-2).0"
KEYWORDS="~amd64 ~x86"

BDEPEND="app-arch/unzip"

S="${WORKDIR}/${MY_PN}_v${PV}"

src_prepare() {
	# This version supports CMake but upstream has dropped it since this
	# release. They now use Premake but this Meson file is actually
	# simpler! Installation is manual but that's true for Premake too.
	cat > meson.build <<EOF || die
project('${MY_PN}', 'cpp')
shared_library(
	'${MY_PN}',
	$(find ${MY_PN} -name "*.cpp" -printf "'%p', ")
	soversion: '${SLOT}', install : true
)
EOF

	default
}

src_install() {
	dodoc Readme.txt
	dolib.so "${BUILD_DIR}"/lib${MY_PN}$(get_libname ${SLOT})

	local FILE
	for FILE in $(find ${MY_PN} -name *.h); do
		insinto "/usr/include/${MY_PN}-${SLOT}/${FILE%/*}"
		doins "${FILE}"
	done
}