iasl-20230628-r1.ebuild 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. # Copyright 1999-2023 Gentoo Authors
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=8
  4. inherit edos2unix toolchain-funcs
  5. MY_PN=acpica-unix
  6. #MY_PV=${PV:4:2}_${PV:6:2}_${PV:2:2}
  7. MY_PV="a97db76b5f1cd79b8a0f0dfdffca34ca60f8d735"
  8. MY_P="${MY_PN}-${PV}"
  9. DESCRIPTION="Intel ACPI Source Language (ASL) compiler"
  10. HOMEPAGE="https://www.acpica.org"
  11. #SRC_URI="https://github.com/acpica/acpica/archive/refs/tags/R${MY_PV}.tar.gz -> ${MY_P}.tar.gz"
  12. SRC_URI="https://github.com/acpica/acpica/archive/${MY_PV}.tar.gz -> ${MY_P}.tar.gz"
  13. LICENSE="iASL"
  14. SLOT="0"
  15. KEYWORDS="~alpha amd64 arm64 ~ia64 ~loong ~mips ppc ppc64 x86"
  16. IUSE="test"
  17. RESTRICT="!test? ( test ) mirror"
  18. BDEPEND="
  19. sys-devel/bison
  20. sys-devel/flex"
  21. #S="${WORKDIR}/acpica-R${MY_PV}"
  22. S="${WORKDIR}/acpica-${MY_PV}"
  23. PATCHES=( "${FILESDIR}"/${PN}-20230331-Makefile.patch )
  24. pkg_setup() {
  25. if use test && has test ${FEATURES}; then
  26. ewarn 'You have selected USE="test". This will install the test results'
  27. ewarn "into /usr/share/${PF}/, compressed as a tarball."
  28. ewarn 'The tests themselves will only rarely die, but the test results'
  29. ewarn 'are interesting for arch testing. The tests may take quite some'
  30. ewarn 'time to complete.'
  31. fi
  32. }
  33. src_prepare() {
  34. default
  35. find "${S}" -type f -name 'Makefile*' -print0 | \
  36. xargs -0 -I '{}' \
  37. sed -r -e 's:-\<Werror\>::g' -e "s:/usr:${EPREFIX}/usr:g" \
  38. -i '{}' \
  39. || die
  40. }
  41. src_configure() {
  42. tc-export CC
  43. # BITS is tied to ARCH - please set appropriately if you add new keywords
  44. if [[ $ARCH == @(amd64) ]] ; then
  45. export BITS=64
  46. else
  47. export BITS=32
  48. fi
  49. }
  50. src_compile() {
  51. emake -C generate/unix BITS="${BITS}"
  52. }
  53. src_test() {
  54. aslts_test
  55. #The aapits test currently fails, missing include probably.
  56. #aapits_test
  57. }
  58. src_install() {
  59. cd generate/unix || die
  60. emake install DESTDIR="${D}" BITS=${BITS}
  61. default
  62. #local bin
  63. #for bin in $(<"${T}"/binlist) ; do
  64. # dobin "${T}"/${bin}
  65. #done
  66. #dodoc "${S}"/changes.txt
  67. newdoc "${S}"/source/compiler/readme.txt compiler-readme.txt
  68. newdoc "${S}"/generate/unix/readme.txt unix-readme.txt
  69. newdoc "${S}"/generate/lint/readme.txt lint-readme.txt
  70. newdoc "${S}"/source/compiler/new_table.txt compiler-new_table.txt
  71. if use test && has test ${FEATURES}; then
  72. tb="${T}"/testresults.tar.bz2
  73. export ASLTSDIR="$(<"${T}"/asltdir)"
  74. ebegin "Creating Test Tarball"
  75. tar -cjf "${tb}" -C "${ASLTSDIR}"/tmp/RESULTS . || die "tar failed"
  76. eend $?
  77. insinto /usr/share/${PF}
  78. doins ${tb}
  79. fi
  80. }
  81. aslts_test() {
  82. export ASL="${S}"/generate/unix/bin/iasl \
  83. acpibin="${S}"/generate/unix/bin/acpibin \
  84. acpiexec="${S}"/generate/unix/bin/acpiexec \
  85. ASLTSDIR="${WORKDIR}/${MY_TESTS_P}"/tests/aslts
  86. export PATH="${PATH}:${ASLTSDIR}/bin"
  87. echo "$ASLTSDIR" >"${T}"/asltdir
  88. cd "${ASLTSDIR}" || die
  89. edos2unix $(find . -type 'f')
  90. make install || die "make install aslts test failed"
  91. chmod +x $(find bin/ ! -regex 'ERROR_OPCODES|HOW_TO_USE|README' ) || die "chmod bin +x failed"
  92. #The below Do commands runs the tests twice and then dies if the results aren't
  93. #Identical.
  94. Do 1 || die "failed Do 1"
  95. Do 2 || die "failed Do 2"
  96. }
  97. aapits_test() {
  98. mv "${WORKDIR}/${MY_TESTS_P}/tests/aapits" "${S}/tools/" || die "mv failed"
  99. cd "${S}/tools/aapits" || die "cannot find ${S}/tools/aapits"
  100. edos2unix $(find . -type 'f')
  101. chmod +x $(find bin/ | sed -r -e '/\/[A-Z_]+$/d') || die "chmod bin +x failed"
  102. make || die "make in aapits failed"
  103. cd asl || die "cd asl failed"
  104. make || die "make in asl failed"
  105. cd ../bin || die
  106. ./aapitsrun || die "aapitsrun failed"
  107. }