seabios-1.10.1.ebuild 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI="5"
  4. PYTHON_COMPAT=( python{2_7,3_{4,5}} )
  5. inherit eutils toolchain-funcs python-any-r1
  6. # SeaBIOS maintainers sometimes don't release stable tarballs or stable
  7. # binaries to generate the stable tarball the following is necessary:
  8. # git clone git://git.seabios.org/seabios.git && cd seabios
  9. # git archive --output seabios-${PV}.tar.gz --prefix seabios-${PV}/ rel-${PV}
  10. if [[ ${PV} == *9999* || -n "${EGIT_COMMIT}" ]] ; then
  11. EGIT_REPO_URI="git://git.seabios.org/seabios.git"
  12. inherit git-2
  13. else
  14. KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc x86 ~amd64-fbsd ~x86-fbsd"
  15. # Upstream hasn't released a new binary. We snipe ours from Fedora for now.
  16. # https://code.coreboot.org/p/seabios/downloads/get/bios.bin-${PV}.gz
  17. # http://fedora.mirror.lstn.net/
  18. # http://download.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/Packages/s/
  19. # seabios-bin-1.10.1-1.fc26.noarch.rpm
  20. # seavgabios-bin-1.10.1-1.fc26.noarch.rpm
  21. SRC_URI="!binary? ( https://code.coreboot.org/p/seabios/downloads/get/${P}.tar.gz )
  22. binary? (
  23. mirror://gentoo/bios.bin-${PV}.xz
  24. seavgabios? ( mirror://gentoo/seavgabios-bin-${PV}.tar.xz )
  25. )"
  26. fi
  27. DESCRIPTION="Open Source implementation of a 16-bit x86 BIOS"
  28. HOMEPAGE="https://www.seabios.org/"
  29. LICENSE="LGPL-3 GPL-3"
  30. SLOT="0"
  31. IUSE="+binary debug +seavgabios"
  32. REQUIRED_USE="debug? ( !binary )
  33. !amd64? ( !x86? ( binary ) )"
  34. # The amd64/x86 check is needed to workaround #570892.
  35. SOURCE_DEPEND="
  36. >=sys-power/iasl-20060912
  37. ${PYTHON_DEPS}"
  38. DEPEND="
  39. !binary? (
  40. amd64? ( ${SOURCE_DEPEND} )
  41. x86? ( ${SOURCE_DEPEND} )
  42. )"
  43. RDEPEND=""
  44. pkg_pretend() {
  45. if ! use binary; then
  46. ewarn "You have decided to compile your own SeaBIOS. This is not"
  47. ewarn "supported by upstream unless you use their recommended"
  48. ewarn "toolchain (which you are not)."
  49. elog
  50. ewarn "If you are intending to use this build with QEMU, realize"
  51. ewarn "you will not receive any support if you have compiled your"
  52. ewarn "own SeaBIOS. Virtual machines subtly fail based on changes"
  53. ewarn "in SeaBIOS."
  54. fi
  55. }
  56. pkg_setup() {
  57. use binary || python-any-r1_pkg_setup
  58. }
  59. src_unpack() {
  60. default
  61. # This simplifies the logic between binary & source builds.
  62. mkdir -p "${S}"
  63. }
  64. src_prepare() {
  65. use binary && return
  66. epatch_user
  67. }
  68. src_configure() {
  69. use binary && return
  70. tc-ld-disable-gold #438058
  71. if use debug ; then
  72. echo "CONFIG_DEBUG_LEVEL=8" >.config
  73. fi
  74. _emake config
  75. }
  76. _emake() {
  77. LANG=C \
  78. emake V=1 \
  79. CC="$(tc-getCC)" \
  80. LD="$(tc-getLD)" \
  81. AR="$(tc-getAR)" \
  82. OBJCOPY="$(tc-getOBJCOPY)" \
  83. RANLIB="$(tc-getRANLIB)" \
  84. OBJDUMP="$(tc-getOBJDUMP)" \
  85. HOST_CC="$(tc-getBUILD_CC)" \
  86. VERSION="Gentoo/${EGIT_COMMIT:-${PVR}}" \
  87. "$@"
  88. }
  89. src_compile() {
  90. use binary && return
  91. _emake out/bios.bin
  92. mv out/bios.bin ../bios.bin
  93. if use seavgabios ; then
  94. local config t targets=(
  95. cirrus
  96. isavga
  97. qxl
  98. stdvga
  99. virtio
  100. vmware
  101. )
  102. for t in "${targets[@]}" ; do
  103. emake clean distclean
  104. cp "${FILESDIR}/seavgabios/config.vga-${t}" .config || die
  105. _emake oldnoconfig
  106. _emake out/vgabios.bin
  107. cp out/vgabios.bin ../vgabios-${t}.bin || die
  108. done
  109. fi
  110. }
  111. src_install() {
  112. insinto /usr/share/seabios
  113. newins ../bios.bin* bios.bin
  114. if use seavgabios ; then
  115. insinto /usr/share/seavgabios
  116. doins ../vgabios*.bin
  117. fi
  118. }