iasl-20160729.ebuild 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=6
  4. inherit toolchain-funcs flag-o-matic eutils
  5. MY_PN=acpica-unix
  6. MY_P=${MY_PN}-${PV}
  7. MY_TESTS_P=${MY_PN/ca/tests}-${PV}
  8. DESCRIPTION="Intel ACPI Source Language (ASL) compiler"
  9. HOMEPAGE="https://www.acpica.org/downloads/"
  10. SRC_URI="http://www.acpica.org/sites/acpica/files/${MY_P}.tar.gz
  11. test? ( http://www.acpica.org/sites/acpica/files/${MY_TESTS_P}.tar.gz )"
  12. LICENSE="iASL"
  13. SLOT="0"
  14. KEYWORDS="amd64 ppc x86 ~amd64-fbsd ~x86-fbsd"
  15. IUSE="test"
  16. DEPEND="sys-devel/bison
  17. sys-devel/flex"
  18. RDEPEND=""
  19. S=${WORKDIR}/${MY_P}
  20. pkg_setup() {
  21. if use test && has test ${FEATURES}; then
  22. ewarn 'You have selected USE="test". This will install the test results'
  23. ewarn "into /usr/share/${PF}/, compressed as a tarball."
  24. ewarn 'The tests themselves will only rarely die, but the test results'
  25. ewarn 'are interesting for arch testing. The tests may take quite some'
  26. ewarn 'time to complete.'
  27. fi
  28. }
  29. PATCHES=(
  30. "${FILESDIR}/${PN}-20140828-locale.patch"
  31. "${FILESDIR}/${PN}-20140214-nostrip.patch"
  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' -i '{}' \
  38. || die
  39. # BITS is tied to ARCH - please set appropriately if you add new keywords
  40. if [[ $ARCH == @(amd64|amd64-fbsd) ]] ; then
  41. export BITS=64
  42. else
  43. export BITS=32
  44. fi
  45. }
  46. src_configure() {
  47. :
  48. }
  49. src_compile() {
  50. cd generate/unix || die
  51. emake BITS=${BITS}
  52. }
  53. src_test() {
  54. aslts_test
  55. #aapits_test
  56. #The aapits test currently fails, missing include probably.
  57. }
  58. src_install() {
  59. cd generate/unix || die
  60. emake install DESTDIR="${D}" BITS=${BITS}
  61. default_src_install
  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. dodir /usr/share/${PF}
  78. insinto /usr/share/${PF}
  79. doins ${tb}
  80. fi
  81. }
  82. aslts_test() {
  83. export ASL="${S}"/generate/unix/bin/iasl \
  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. }