Gentoo Archives: gentoo-commits

From: Sergei Trofimovich <slyfox@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-firmware/seabios/
Date: Fri, 30 Apr 2021 21:44:13
Message-Id: 1619819045.6478832ac59c19e71654f4bd65b8dbcb8670a32c.slyfox@gentoo
1 commit: 6478832ac59c19e71654f4bd65b8dbcb8670a32c
2 Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
3 AuthorDate: Fri Apr 30 21:43:47 2021 +0000
4 Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
5 CommitDate: Fri Apr 30 21:44:05 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6478832a
7
8 sys-firmware/seabios: use tool-prefixed strip and cpp
9
10 Package-Manager: Portage-3.0.18, Repoman-3.0.3
11 Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
12
13 sys-firmware/seabios/seabios-1.14.0-r1.ebuild | 168 ++++++++++++++++++++++++++
14 1 file changed, 168 insertions(+)
15
16 diff --git a/sys-firmware/seabios/seabios-1.14.0-r1.ebuild b/sys-firmware/seabios/seabios-1.14.0-r1.ebuild
17 new file mode 100644
18 index 00000000000..a8b5184144a
19 --- /dev/null
20 +++ b/sys-firmware/seabios/seabios-1.14.0-r1.ebuild
21 @@ -0,0 +1,168 @@
22 +# Copyright 1999-2021 Gentoo Authors
23 +# Distributed under the terms of the GNU General Public License v2
24 +
25 +EAPI="7"
26 +
27 +PYTHON_COMPAT=( python3_{7..9} )
28 +
29 +inherit toolchain-funcs python-any-r1
30 +
31 +# SeaBIOS maintainers sometimes don't release stable tarballs or stable
32 +# binaries to generate the stable tarball the following is necessary:
33 +# git clone git://git.seabios.org/seabios.git && cd seabios
34 +# git archive --output seabios-${PV}.tar.gz --prefix seabios-${PV}/ rel-${PV}
35 +
36 +if [[ ${PV} == *9999* || -n "${EGIT_COMMIT}" ]] ; then
37 + EGIT_REPO_URI="git://git.seabios.org/seabios.git"
38 + inherit git-r3
39 +else
40 + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86"
41 +
42 + SRC_URI="
43 + !binary? ( https://www.seabios.org/downloads/${P}.tar.gz )
44 + binary? ( https://dev.gentoo.org/~tamiko/distfiles/${P}-bin.tar.xz )"
45 +fi
46 +
47 +DESCRIPTION="Open Source implementation of a 16-bit x86 BIOS"
48 +HOMEPAGE="https://www.seabios.org/"
49 +
50 +LICENSE="LGPL-3 GPL-3"
51 +SLOT="0"
52 +IUSE="+binary debug +seavgabios"
53 +
54 +REQUIRED_USE="debug? ( !binary )"
55 +
56 +SOURCE_DEPEND="
57 + >=sys-power/iasl-20060912
58 + ${PYTHON_DEPS}"
59 +DEPEND="
60 + !binary? (
61 + ${SOURCE_DEPEND}
62 + )"
63 +RDEPEND=""
64 +
65 +choose_target_chost() {
66 + if [[ -n "${CC}" ]]; then
67 + ${CC} -dumpmachine
68 + return
69 + fi
70 +
71 + if use amd64 || use x86; then
72 + # Use the native compiler
73 + echo "${CHOST}"
74 + return
75 + fi
76 +
77 + local i
78 + for i in x86_64 i686 i586 i486 i386 ; do
79 + i=${i}-pc-linux-gnu
80 + type -P ${i}-gcc > /dev/null && echo ${i} && return
81 + done
82 +}
83 +
84 +pkg_pretend() {
85 + if ! use binary; then
86 + ewarn "You have decided to compile your own SeaBIOS. This is not"
87 + ewarn "supported by upstream unless you use their recommended"
88 + ewarn "toolchain (which you are not)."
89 + elog
90 + ewarn "If you are intending to use this build with QEMU, realize"
91 + ewarn "you will not receive any support if you have compiled your"
92 + ewarn "own SeaBIOS. Virtual machines subtly fail based on changes"
93 + ewarn "in SeaBIOS."
94 + if [[ -z "$(choose_target_chost)" ]]; then
95 + elog
96 + eerror "Before you can compile ${PN}[-binary], you need to install a x86 cross-compiler"
97 + eerror "Run the following commands:"
98 + eerror " emerge crossdev"
99 + eerror " crossdev --stable -t x86_64-pc-linux-gnu"
100 + die "cross-compiler is needed"
101 + fi
102 + fi
103 +}
104 +
105 +pkg_setup() {
106 + use binary || python-any-r1_pkg_setup
107 +}
108 +
109 +src_unpack() {
110 + default
111 +
112 + # This simplifies the logic between binary & source builds.
113 + mkdir -p "${S}"
114 +}
115 +
116 +src_prepare() {
117 + default
118 +
119 + # Ensure precompiled iasl files are never used
120 + find "${WORKDIR}" -name '*.hex' -delete || die
121 +}
122 +
123 +src_configure() {
124 + use binary && return
125 +
126 + tc-ld-disable-gold #438058
127 +
128 + if use debug ; then
129 + echo "CONFIG_DEBUG_LEVEL=8" >.config
130 + fi
131 + _emake config
132 +}
133 +
134 +_emake() {
135 + LANG=C \
136 + emake V=1 \
137 + CPP="$(tc-getPROG CPP cpp)" \
138 + CC="$(tc-getCC)" \
139 + LD="$(tc-getLD)" \
140 + AR="$(tc-getAR)" \
141 + AS="$(tc-getAS)" \
142 + OBJCOPY="$(tc-getOBJCOPY)" \
143 + RANLIB="$(tc-getRANLIB)" \
144 + OBJDUMP="$(tc-getOBJDUMP)" \
145 + STRIP="$(tc-getSTRIP)" \
146 + HOST_CC="$(tc-getBUILD_CC)" \
147 + VERSION="Gentoo/${EGIT_COMMIT:-${PVR}}" \
148 + "$@"
149 +}
150 +
151 +src_compile() {
152 + use binary && return
153 +
154 + local TARGET_CHOST=$(choose_target_chost)
155 +
156 + cp "${FILESDIR}/seabios/config.seabios-256k" .config || die
157 + _emake oldnoconfig
158 + CHOST="${TARGET_CHOST}" _emake iasl
159 + CHOST="${TARGET_CHOST}" _emake out/bios.bin
160 + mv out/bios.bin ../bios-256k.bin || die
161 +
162 + if use seavgabios ; then
163 + local config t targets=(
164 + cirrus
165 + isavga
166 + qxl
167 + stdvga
168 + virtio
169 + vmware
170 + )
171 + for t in "${targets[@]}" ; do
172 + _emake clean distclean
173 + cp "${FILESDIR}/seavgabios/config.vga-${t}" .config || die
174 + _emake oldnoconfig
175 + CHOST="${TARGET_CHOST}" _emake out/vgabios.bin
176 + cp out/vgabios.bin ../vgabios-${t}.bin || die
177 + done
178 + fi
179 +}
180 +
181 +src_install() {
182 + insinto /usr/share/seabios
183 + doins ../bios-256k.bin
184 +
185 + if use seavgabios ; then
186 + insinto /usr/share/seavgabios
187 + doins ../vgabios*.bin
188 + fi
189 +}