blob: ba6dad259e550f5d6f32732df1c1e88c2e324f49 (
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
|
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit cmake
DESCRIPTION="The ANTLR 4 C++ Runtime"
HOMEPAGE="https://www.antlr.org/"
SRC_URI="https://www.antlr.org/download/antlr4-cpp-runtime-${PV}-source.zip"
LICENSE="BSD"
SLOT="4/${PV}"
KEYWORDS="~amd64 ~arm ~ppc ~x86"
IUSE="test"
RESTRICT="!test? ( test )"
DEPEND="test? ( dev-cpp/gtest )"
BDEPEND="app-arch/unzip"
src_unpack() {
mkdir "${S}" || die
cd "${S}" || die
unpack "antlr4-cpp-runtime-${PV}-source.zip"
}
src_prepare() {
cmake_src_prepare
sed -i -e "s|doc/libantlr$(ver_cut 1)|doc/${PF}|" CMakeLists.txt || die
# Give proper gtest find_package name
sed -i \
-e 's/gtest_main/GTest::gtest_main/' \
-e '/FetchContent_Declare/,/^$/ {
/\sURL https:\/\/github.com\/google\/googletest/aFIND_PACKAGE_ARGS NAMES GTest
}' runtime/CMakeLists.txt || die
}
src_configure() {
local mycmakeargs=(
-DANTLR_BUILD_CPP_TESTS=$(usex test)
-DANTLR_BUILD_SHARED=ON
-DANTLR_BUILD_STATIC=OFF
-DFETCHCONTENT_TRY_FIND_PACKAGE_MODE=ALWAYS
)
cmake_src_configure
}
|