www-client/google-chrome-beta: automated update (84.0.4147.30)
[gentoo.git] / sys-firmware / seabios / seabios-1.10.2.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI="6"
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.10.2-1.fc27.noarch.rpm
24         #   seavgabios-bin-1.10.2-1.fc27.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_configure() {
76         use binary && return
77
78         tc-ld-disable-gold #438058
79
80         if use debug ; then
81                 echo "CONFIG_DEBUG_LEVEL=8" >.config
82         fi
83         _emake config
84 }
85
86 _emake() {
87         LANG=C \
88         emake V=1 \
89                 CC="$(tc-getCC)" \
90                 LD="$(tc-getLD)" \
91                 AR="$(tc-getAR)" \
92                 OBJCOPY="$(tc-getOBJCOPY)" \
93                 RANLIB="$(tc-getRANLIB)" \
94                 OBJDUMP="$(tc-getOBJDUMP)" \
95                 HOST_CC="$(tc-getBUILD_CC)" \
96                 VERSION="Gentoo/${EGIT_COMMIT:-${PVR}}" \
97                 "$@"
98 }
99
100 src_compile() {
101         use binary && return
102
103         for t in 128k 256k ; do
104                 cp "${FILESDIR}/seabios/config.seabios-${t}" .config || die
105                 _emake oldnoconfig
106                 _emake out/bios.bin
107                 mv out/bios.bin ../bios-${t}.bin || die
108         done
109
110         if use seavgabios ; then
111                 local config t targets=(
112                         cirrus
113                         isavga
114                         qxl
115                         stdvga
116                         virtio
117                         vmware
118                 )
119                 for t in "${targets[@]}" ; do
120                         emake clean distclean
121                         cp "${FILESDIR}/seavgabios/config.vga-${t}" .config || die
122                         _emake oldnoconfig
123                         _emake out/vgabios.bin
124                         cp out/vgabios.bin ../vgabios-${t}.bin || die
125                 done
126         fi
127 }
128
129 src_install() {
130
131         insinto /usr/share/seabios
132         use binary && doins ../bios.bin
133         use !binary && newins ../bios-128k.bin bios.bin
134         doins ../bios-256k.bin
135
136         if use seavgabios ; then
137                 insinto /usr/share/seavgabios
138                 doins ../vgabios*.bin
139         fi
140 }