iasl-20140828.ebuild 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. # Copyright 1999-2015 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  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. src_prepare() {
  30. epatch "${FILESDIR}/${PN}-20140828-locale.patch" \
  31. "${FILESDIR}/${PN}-20140214-nostrip.patch"
  32. find "${S}" -type f -name 'Makefile*' -print0 | \
  33. xargs -0 -I '{}' \
  34. sed -r -e 's:-\<Werror\>::g' -i '{}' \
  35. || die
  36. # BITS is tied to ARCH - please set appropriately if you add new keywords
  37. if [[ $ARCH == @(amd64|amd64-fbsd) ]] ; then
  38. export BITS=64
  39. else
  40. export BITS=32
  41. fi
  42. }
  43. src_configure() {
  44. :
  45. }
  46. src_compile() {
  47. cd acpica/generate/unix
  48. emake BITS=${BITS}
  49. }
  50. src_test() {
  51. aslts_test
  52. #aapits_test
  53. #The aapits test currently fails, missing include probably.
  54. }
  55. src_install() {
  56. cd acpica/generate/unix
  57. emake install DESTDIR="${D}" BITS=${BITS}
  58. default_src_install
  59. #local bin
  60. #for bin in $(<"${T}"/binlist) ; do
  61. # dobin "${T}"/${bin}
  62. #done
  63. dodoc "${S}"/changes.txt
  64. newdoc "${S}"/source/compiler/readme.txt compiler-readme.txt
  65. newdoc "${S}"/generate/unix/readme.txt unix-readme.txt
  66. newdoc "${S}"/generate/lint/readme.txt lint-readme.txt
  67. newdoc "${S}"/source/compiler/new_table.txt compiler-new_table.txt
  68. if use test && has test ${FEATURES}; then
  69. tb="${T}"/testresults.tar.bz2
  70. export ASLTSDIR="$(<"${T}"/asltdir)"
  71. ebegin "Creating Test Tarball"
  72. tar -cjf "${tb}" -C "${ASLTSDIR}"/tmp/RESULTS . || die "tar failed"
  73. eend $?
  74. dodir /usr/share/${PF}
  75. insinto /usr/share/${PF}
  76. doins ${tb}
  77. fi
  78. }
  79. aslts_test() {
  80. export ASL="${S}"/generate/unix/bin/iasl \
  81. acpiexec="${S}"/generate/unix/bin/acpiexec \
  82. ASLTSDIR="${WORKDIR}/${MY_TESTS_P}"/tests/aslts
  83. export PATH="${PATH}:${ASLTSDIR}/bin"
  84. echo "$ASLTSDIR" >"${T}"/asltdir
  85. cd "${ASLTSDIR}"
  86. edos2unix $(find . -type 'f')
  87. make install || die "make install aslts test failed"
  88. chmod +x $(find bin/ ! -regex 'ERROR_OPCODES|HOW_TO_USE|README' ) || die "chmod bin +x failed"
  89. #The below Do commands runs the tests twice and then dies if the results aren't
  90. #Identical.
  91. Do 1 || die "failed Do 1"
  92. Do 2 || die "failed Do 2"
  93. }
  94. aapits_test() {
  95. mv "${WORKDIR}/${MY_TESTS_P}/tests/aapits" "${S}/tools/" || die "mv failed"
  96. cd "${S}/tools/aapits" || die "cannot find ${S}/tools/aapits"
  97. edos2unix $(find . -type 'f')
  98. chmod +x $(find bin/ | sed -r -e '/\/[A-Z_]+$/d') || die "chmod bin +x failed"
  99. make || die "make in aapits failed"
  100. cd asl || die "cd asl failed"
  101. make || die "make in asl failed"
  102. cd ../bin
  103. ./aapitsrun || die "aapitsrun failed"
  104. }