virtual/udev: ia64 stable wrt bug #601934
[gentoo.git] / sys-firmware / seabios / seabios-1.7.5.ebuild
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=5
5
6 PYTHON_COMPAT=( python{2_7,3_{4,5}} )
7
8 inherit eutils toolchain-funcs python-any-r1
9
10 #BACKPORTS=1
11
12 # SeaBIOS maintainers sometimes don't release stable tarballs or stable
13 # binaries to generate the stable tarball the following is necessary:
14 # git clone git://git.seabios.org/seabios.git && cd seabios
15 # git archive --output seabios-${PV}.tar.gz --prefix seabios-${PV}/ rel-${PV}
16
17 if [[ ${PV} = *9999* || ! -z "${EGIT_COMMIT}" ]]; then
18         EGIT_REPO_URI="git://git.seabios.org/seabios.git"
19         inherit git-2
20 else
21         KEYWORDS="amd64 ~ppc ~ppc64 x86 ~amd64-fbsd ~x86-fbsd"
22         SRC_URI="!binary? ( https://code.coreboot.org/p/seabios/downloads/get/${P}.tar.gz )
23                 binary? ( https://code.coreboot.org/p/seabios/downloads/get/bios.bin-${PV}.gz )
24                 ${BACKPORTS:+https://dev.gentoo.org/~cardoe/distfiles/${P}-${BACKPORTS}.tar.xz}"
25 fi
26
27 DESCRIPTION="Open Source implementation of a 16-bit x86 BIOS"
28 HOMEPAGE="https://www.seabios.org/"
29
30 LICENSE="LGPL-3 GPL-3"
31 SLOT="0"
32 IUSE="+binary"
33
34 REQUIRED_USE="ppc? ( binary )
35         ppc64? ( binary )"
36
37 DEPEND="
38         !binary? (
39                 >=sys-power/iasl-20060912
40                 ${PYTHON_DEPS}
41         )"
42 RDEPEND=""
43
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
57 pkg_setup() {
58         use binary || python-any-r1_pkg_setup
59 }
60
61 src_unpack() {
62         default
63
64         # This simplifies the logic between binary & source builds.
65         mkdir -p "${S}"
66 }
67
68 src_prepare() {
69         use binary && return
70
71         if [[ -z "${EGIT_COMMIT}" ]]; then
72                 sed -e "s/VERSION=.*/VERSION=${PV}/" \
73                         -i Makefile || die
74         else
75                 sed -e "s/VERSION=.*/VERSION=${PV}_pre${EGIT_COMMIT}/" \
76                         -i Makefile || die
77         fi
78
79         epatch_user
80 }
81
82 src_configure() {
83         use binary || tc-ld-disable-gold #438058
84 }
85
86 src_compile() {
87         if ! use binary ; then
88                 LANG=C emake \
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                         out/bios.bin
97         fi
98 }
99
100 src_install() {
101         insinto /usr/share/seabios
102         if ! use binary ; then
103                 doins out/bios.bin
104         else
105                 newins ../bios.bin-${PV} bios.bin
106         fi
107 }