summaryrefslogtreecommitdiff
path: root/dev-ada/lal-refactor/lal-refactor-0_p20231027.ebuild
blob: fd2cdfac836aa0facdc23383e8a2761e8fbe8a35 (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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# Copyright 2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

ADA_COMPAT=( gnat_2021 gcc_12 gcc_13 )
inherit ada multiprocessing

commitId=a5997083efc0ae97ec089b18931c765d43301072

DESCRIPTION="Refactoring tools for the Ada programming language"
HOMEPAGE="https://github.com/AdaCore/lal-refactor"
SRC_URI="https://github.com/AdaCore/${PN}/archive/${commitId}.tar.gz
	-> ${P}.tar.gz"

LICENSE="Apache-2.0"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="+shared static-libs static-pic"
REQUIRED_USE="|| ( shared static-libs static-pic )
	${ADA_REQUIRED_USE}"

RDEPEND="${ADADEPS}
	dev-ada/libadalang-tools[${ADA_USEDEP},shared?,static-libs?,static-pic?]"
BDEPEND="dev-ada/gprbuild[${ADA_USEDEP}]"

S="${WORKDIR}"/${PN}-${commitId}

src_compile() {
	build () {
		gprbuild -v -k -XLIBRARY_TYPE=$1 -j$(makeopts_jobs) -p \
			-XLAL_REFACTOR_LIBRARY_TYPE=$1 \
			-XLAL_REFACTOR_BUILD_MODE=prod \
			-P gnat/lal_refactor.gpr \
			-largs ${LDFLAGS} \
			-cargs ${ADAFLAGS} || die

	}
	if use shared; then
		build relocatable
	fi
	if use static-libs; then
		build static
	fi
	if use static-pic; then
		build static-pic
	fi

	if use static-libs; then
		libtype='static'
	elif use static-pic; then
		libtype='static-pic'
	elif use shared; then
		libtype='relocatable'
	fi
	gprbuild -v -k -XLIBRARY_TYPE=${libtype} -j$(makeopts_jobs) -p \
		-XLAL_REFACTOR_LIBRARY_TYPE=${libtype} \
		-XLAL_REFACTOR_BUILD_MODE=prod \
		-Pgnat/lal_refactor_driver.gpr \
		-largs ${LDFLAGS} \
		-cargs ${ADAFLAGS} || die
}

src_install() {
	build () {
		gprinstall \
			-XLAL_REFACTOR_LIBRARY_TYPE=$1 \
			-XLIBRARY_TYPE=$1 \
			-XLAL_REFACTOR_BUILD_MODE=prod \
			--prefix="${D}"/usr \
			--sources-subdir=include/lal-refactor \
			--build-name=$1 \
			--build-var=LIBRARY_TYPE \
			-P gnat/lal_refactor.gpr -p -f || die
	}
	if use shared; then
		build relocatable
	fi
	if use static-libs; then
		build static
	fi
	if use static-pic; then
		build static-pic
	fi
	gprinstall \
		-XLAL_REFACTOR_LIBRARY_TYPE=${libtype} \
		-XLIBRARY_TYPE=${libtype} \
		-XBUILD_MODE=prod \
		--prefix="${D}"/usr \
		-P gnat/lal_refactor_driver.gpr \
		-p \
		-f || die

	einstalldocs
	rm -rf "${D}"/usr/share/gpr/manifests
}