]> git.bzium.org - embe/overlay.git/blob - sys-power/iasl/iasl-20121220.ebuild
6bf8200aad8238f4705b998568efe5c4a44ceeea
[embe/overlay.git] / sys-power / iasl / iasl-20121220.ebuild
1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/sys-power/iasl/iasl-20120816.ebuild,v 1.1 2012/09/07 23:11:29 robbat2 Exp $
4
5 EAPI=4
6
7 inherit toolchain-funcs flag-o-matic eutils
8
9 MY_PN=acpica-unix
10 MY_P=${MY_PN}-${PV}
11 MY_TESTS_P=${MY_PN/ca/tests}-${PV}
12 DESCRIPTION="Intel ACPI Source Language (ASL) compiler"
13 HOMEPAGE="https://www.acpica.org/downloads/index.php"
14 SRC_URI="http://www.acpica.org/download/${MY_P}.tar.gz
15         test? ( http://www.acpica.org/download/${MY_TESTS_P}.tar.gz )"
16
17 LICENSE="iASL"
18 SLOT="0"
19 KEYWORDS="~amd64 ~ppc ~x86 ~amd64-fbsd ~x86-fbsd"
20 IUSE="test"
21
22 DEPEND="sys-devel/bison
23         sys-devel/flex"
24 RDEPEND=""
25
26 S=${WORKDIR}/${MY_P}
27
28 pkg_setup() {
29         if use test && has test ${FEATURES}; then
30                 ewarn 'You have selected USE="test". This will install the test results'
31                 ewarn "into /usr/share/${PF}/, compressed as a tarball."
32                 ewarn 'The tests themselves will only rarely die, but the test results'
33                 ewarn 'are interesting for arch testing. The tests may take quite some'
34                 ewarn 'time to complete.'
35         fi
36 }
37
38 src_prepare() {
39         find "${S}" -type f -name 'Makefile*' -print0 | \
40                 xargs -0 -I '{}' \
41                 sed -r -e 's:-\<Werror\>::g' -i '{}' \
42                 || die
43
44         export BITS=64
45 }
46
47 src_configure() {
48         :
49 }
50
51 src_compile() {
52         cd acpica/generate/unix
53         emake BITS=${BITS}
54 }
55
56 src_test() {
57         aslts_test
58         #aapits_test
59         #The aapits test currently fails, missing include probably.
60 }
61
62 src_install() {
63         cd acpica/generate/unix
64         emake install DESTDIR="${D}" BITS=${BITS}
65         default_src_install
66         #local bin
67         #for bin in $(<"${T}"/binlist) ; do
68         #       dobin "${T}"/${bin}
69         #done
70         dodoc "${S}"/changes.txt
71         newdoc "${S}"/source/compiler/readme.txt compiler-readme.txt
72         newdoc "${S}"/generate/unix/readme.txt unix-readme.txt
73         newdoc "${S}"/generate/lint/readme.txt lint-readme.txt
74         newdoc "${S}"/source/compiler/new_table.txt compiler-new_table.txt
75
76         if use test && has test ${FEATURES}; then
77                 tb="${T}"/testresults.tar.bz2
78                 export ASLTSDIR="$(<"${T}"/asltdir)"
79                 ebegin "Creating Test Tarball"
80                 tar -cjf "${tb}" -C "${ASLTSDIR}"/tmp/RESULTS .  || die "tar failed"
81                 eend $?
82                 dodir /usr/share/${PF}
83                 insinto /usr/share/${PF}
84                 doins ${tb} || die "doins testresults.tar.bz2 failed"
85         fi
86
87 }
88
89 aslts_test() {
90         export  ASL="${S}"/generate/unix/bin${BITS}/iasl \
91                 acpiexec="${S}"/generate/unix/bin${BITS}/acpiexec \
92                 ASLTSDIR="${WORKDIR}/${MY_TESTS_P}"/tests/aslts
93         export  PATH="${PATH}:${ASLTSDIR}/bin"
94         echo "$ASLTSDIR" >"${T}"/asltdir
95         cd "${ASLTSDIR}"
96         edos2unix $(find . -type 'f')
97         make install || die "make install aslts test failed"
98         chmod +x $(find bin/ ! -regex 'ERROR_OPCODES|HOW_TO_USE|README' ) || die "chmod bin +x failed"
99
100         #The below Do commands runs the tests twice and then dies if the results aren't
101         #Identical.
102         Do 1 || die "failed Do 1"
103         Do 2 || die "failed Do 2"
104 }
105
106 aapits_test() {
107         mv "${WORKDIR}/${MY_TESTS_P}/tests/aapits" "${S}/tools/" || die "mv failed"
108         cd "${S}/tools/aapits" || die "cannot find ${S}/tools/aapits"
109         edos2unix $(find . -type 'f')
110         chmod +x $(find bin/ | sed  -r -e '/\/[A-Z_]+$/d') || die "chmod bin +x failed"
111         make || die "make in aapits failed"
112         cd asl || die "cd asl failed"
113         make || die "make in asl failed"
114         cd ../bin
115         ./aapitsrun || die "aapitsrun failed"
116 }