Diff iasl-20200717 with a iasl-20241212

/usr/portage/sys-power/iasl/iasl-20241212.ebuild 2025-07-29 16:22:17.944470274 +0300
1 1
# Copyright 1999-2025 Gentoo Authors
2 2
# Distributed under the terms of the GNU General Public License v2
3 3

  
4
EAPI=7
4
EAPI=8
5 5

  
6 6
inherit edos2unix toolchain-funcs
7 7

  
8 8
MY_PN=acpica-unix
9 9
MY_P="${MY_PN}-${PV}"
10 10
MY_TESTS_P="${MY_PN/ca/tests}-${PV}"
11
REL_TAG="R${PV:0:4}_${PV:4:2}_${PV:6:2}"
11 12

  
12 13
DESCRIPTION="Intel ACPI Source Language (ASL) compiler"
13 14
HOMEPAGE="https://www.acpica.org/downloads/"
14 15
SRC_URI="
15
	http://www.acpica.org/sites/acpica/files/${MY_P}.tar.gz
16
	test? ( http://www.acpica.org/sites/acpica/files/${MY_TESTS_P}.tar.gz )"
16
	https://github.com/acpica/acpica/releases/download/${REL_TAG}/${MY_P}.tar.gz
17
	test? ( https://github.com/acpica/acpica/releases/download/${REL_TAG}/${MY_TESTS_P}.tar.gz )"
18
S="${WORKDIR}/${MY_P}"
17 19

  
18 20
LICENSE="iASL"
19 21
SLOT="0"
20 22
KEYWORDS="~alpha amd64 arm arm64 ~loong ~mips ppc ppc64 ~riscv x86"
21
IUSE="test"
23
IUSE="examples test"
22 24
RESTRICT="!test? ( test )"
23 25

  
24 26
BDEPEND="
25 27
	app-alternatives/yacc
26 28
	app-alternatives/lex"
27 29

  
28
S="${WORKDIR}/${MY_P}"
29

  
30
PATCHES=( "${FILESDIR}"/${PN}-20200326-Makefile.patch )
30
PATCHES=(
31
	"${FILESDIR}"/${P}-Makefile-fixes.patch
32
	"${FILESDIR}"/${P}-Makefile-verbose.patch
33
)
31 34

  
32 35
pkg_setup() {
33
	if use test && has test ${FEATURES}; then
36
	if use test; then
34 37
		ewarn 'You have selected USE="test". This will install the test results'
35 38
		ewarn "into /usr/share/${PF}/, compressed as a tarball."
36 39
		ewarn 'The tests themselves will only rarely die, but the test results'
......
39 42
	fi
40 43
}
41 44

  
42
src_prepare() {
43
	default
44

  
45
	find "${S}" -type f -name 'Makefile*' -print0 | \
46
		xargs -0 -I '{}' \
47
		sed -r -e 's:-\<Werror\>::g' -e "s:/usr:${EPREFIX}/usr:g" \
48
		-i '{}' \
49
		|| die
50
}
51

  
52
src_configure() {
53
	tc-export CC
54

  
55
	# BITS is tied to ARCH - please set appropriately if you add new keywords
56
	if [[ $ARCH == @(amd64) ]] ; then
57
		export BITS=64
58
	else
59
		export BITS=32
60
	fi
61
}
62

  
63 45
src_compile() {
64
	emake -C generate/unix BITS="${BITS}"
65
}
66

  
67
src_test() {
68
	aslts_test
69
	#The aapits test currently fails, missing include probably.
70
	#aapits_test
71
}
72

  
73
src_install() {
74
	cd generate/unix || die
75
	emake install DESTDIR="${D}" BITS=${BITS}
76
	default
77
	#local bin
78
	#for bin in $(<"${T}"/binlist) ; do
79
	#	dobin "${T}"/${bin}
80
	#done
81
	dodoc "${S}"/changes.txt
82
	newdoc "${S}"/source/compiler/readme.txt compiler-readme.txt
83
	newdoc "${S}"/generate/unix/readme.txt unix-readme.txt
84
	newdoc "${S}"/generate/lint/readme.txt lint-readme.txt
85
	newdoc "${S}"/source/compiler/new_table.txt compiler-new_table.txt
86

  
87
	if use test && has test ${FEATURES}; then
88
		tb="${T}"/testresults.tar.bz2
89
		export ASLTSDIR="$(<"${T}"/asltdir)"
90
		ebegin "Creating Test Tarball"
91
		tar -cjf "${tb}" -C "${ASLTSDIR}"/tmp/RESULTS .  || die "tar failed"
92
		eend $?
93
		insinto /usr/share/${PF}
94
		doins ${tb}
95
	fi
46
	emake -C generate/unix \
47
	  CC="$(tc-getCC)" \
48
	  'YACC=LC_ALL=C yacc' \
49
	  'YFLAGS=' \
50
	  'LEX=LC_ALL=C lex' \
51
	  NOFORTIFY=TRUE \
52
	  NOWERROR=TRUE
96 53
}
97 54

  
98 55
aslts_test() {
......
104 61
	echo "$ASLTSDIR" >"${T}"/asltdir
105 62
	cd "${ASLTSDIR}" || die
106 63
	edos2unix $(find . -type 'f')
107
	make install || die "make install aslts test failed"
64
	emake install
108 65
	chmod +x $(find bin/ ! -regex 'ERROR_OPCODES|HOW_TO_USE|README' ) || die "chmod bin +x failed"
109 66

  
110 67
	#The below Do commands runs the tests twice and then dies if the results aren't
......
118 75
	cd "${S}/tools/aapits" || die "cannot find ${S}/tools/aapits"
119 76
	edos2unix $(find . -type 'f')
120 77
	chmod +x $(find bin/ | sed	-r -e '/\/[A-Z_]+$/d') || die "chmod bin +x failed"
121
	make || die "make in aapits failed"
122
	cd asl || die "cd asl failed"
123
	make || die "make in asl failed"
78
	emake
79
	emake -C asl
124 80
	cd ../bin || die
125 81
	./aapitsrun || die "aapitsrun failed"
126 82
}
83

  
84
src_test() {
85
	aslts_test
86
	#The aapits test currently fails, missing include probably.
87
	#aapits_test
88
}
89

  
90
src_install() {
91
	emake -C generate/unix install DESTDIR="${D}"
92

  
93
	if ! use examples; then
94
		rm "${ED}/usr/bin/acpiexamples" || die
95
	fi
96

  
97
	dodoc "${S}"/changes.txt
98
	newdoc "${S}"/source/compiler/readme.txt compiler-readme.txt
99
	newdoc "${S}"/generate/unix/readme.txt unix-readme.txt
100
	newdoc "${S}"/generate/lint/readme.txt lint-readme.txt
101
	newdoc "${S}"/source/compiler/new_table.txt compiler-new_table.txt
102

  
103
	if use test; then
104
		tb="${T}"/testresults.tar.bz2
105
		export ASLTSDIR="$(<"${T}"/asltdir)"
106
		ebegin "Creating Test Tarball"
107
		tar -cjf "${tb}" -C "${ASLTSDIR}"/tmp/RESULTS .  || die "tar failed"
108
		eend $?
109
		insinto /usr/share/${PF}
110
		doins ${tb}
111
	fi
112
}
Thank you!