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