aboutsummaryrefslogtreecommitdiff
blob: 3ab4b15f4d1934393cf0009bcb1ac6762450e129 (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
68
69
70
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

CMAKE_IN_SOURCE_BUILD="ON"

inherit cmake optfeature

DESCRIPTION="The Lean Theorem Prover"
HOMEPAGE="https://leanprover-community.github.io/"

if [[ "${PV}" == *9999* ]]; then
	MAJOR=3  # sync this periodically for the live version
	inherit git-r3
	EGIT_REPO_URI="https://github.com/leanprover-community/lean.git"
else
	MAJOR=$(ver_cut 1)
	SRC_URI="https://github.com/leanprover-community/lean/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz"
	KEYWORDS="~amd64"
fi
S="${WORKDIR}/lean-${PV}/src"

LICENSE="Apache-2.0"
SLOT="0/${MAJOR}"
IUSE="debug +json +threads"

RDEPEND="dev-libs/gmp"
DEPEND="${RDEPEND}"

PATCHES=( "${FILESDIR}/fix_flags.patch" )

src_configure() {
	local CMAKE_BUILD_TYPE
	if use debug; then
		CMAKE_BUILD_TYPE="Debug"
	else
		CMAKE_BUILD_TYPE="Release"
	fi

	local mycmakeargs=(
		-DALPHA=ON
		-DAUTO_THREAD_FINALIZATION=ON
		-DJSON=$(usex json)
		-DLEAN_EXTRA_CXX_FLAGS="${CXXFLAGS}"
		-DMULTI_THREAD=$(usex threads)
		-DUSE_GITHASH=OFF
	)
	cmake_src_configure
}

src_test() {
	local myctestargs=(
		# Disable problematic "style_check" cpplint test,
		# this also removes python test dependency
		--exclude-regex style_check
	)
	cmake_src_test
}

pkg_postinst() {
	elog "You probably want to use lean with mathlib, to install it you can either:"
	elog " - Do not install mathlib globally and use local versions"
	elog " - Use leanproject from sci-mathematics/mathlib-tools"
	elog "   $ leanproject global-install"
	elog " - Use leanpkg and compile mathlib (which will take long time)"
	elog "   $ leanpkg install https://github.com/leanprover-community/mathlib"

	optfeature "project management with leanproject" sci-mathematics/mathlib-tools
}