Use https by default
[gentoo.git] / sys-firmware / seabios / seabios-1.7.5-r1.ebuild
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI=5
6
7 PYTHON_COMPAT=( python2_7 )
8
9 inherit eutils toolchain-funcs python-any-r1
10
11 #BACKPORTS=1
12
13 # SeaBIOS maintainers sometimes don't release stable tarballs or stable
14 # binaries to generate the stable tarball the following is necessary:
15 # git clone git://git.seabios.org/seabios.git && cd seabios
16 # git archive --output seabios-${PV}.tar.gz --prefix seabios-${PV}/ rel-${PV}
17
18 if [[ ${PV} = *9999* || ! -z "${EGIT_COMMIT}" ]]; then
19         EGIT_REPO_URI="git://git.seabios.org/seabios.git"
20         inherit git-2
21 else
22         KEYWORDS="~amd64 ~ppc ~ppc64 ~x86 ~amd64-fbsd ~x86-fbsd"
23         SRC_URI="!binary? ( http://code.coreboot.org/p/seabios/downloads/get/${P}.tar.gz )
24                 binary? (
25                         http://code.coreboot.org/p/seabios/downloads/get/bios.bin-${PV}.gz
26                         seavgabios? (
27                                 mirror://debian/pool/main/s/${PN}/${PN}_${PV}-1_all.deb
28                         )
29                 )
30                 ${BACKPORTS:+https://dev.gentoo.org/~cardoe/distfiles/${P}-${BACKPORTS}.tar.xz}"
31 fi
32
33 DESCRIPTION="Open Source implementation of a 16-bit x86 BIOS"
34 HOMEPAGE="http://www.seabios.org"
35
36 LICENSE="LGPL-3 GPL-3"
37 SLOT="0"
38 IUSE="+binary +seavgabios"
39
40 REQUIRED_USE="ppc? ( binary )
41         ppc64? ( binary )"
42
43 DEPEND="
44         !binary? (
45                 >=sys-power/iasl-20060912
46                 ${PYTHON_DEPS}
47         )"
48 RDEPEND=""
49
50 pkg_pretend() {
51         if ! use binary; then
52                 ewarn "You have decided to compile your own SeaBIOS. This is not"
53                 ewarn "supported by upstream unless you use their recommended"
54                 ewarn "toolchain (which you are not)."
55                 elog
56                 ewarn "If you are intending to use this build with QEMU, realize"
57                 ewarn "you will not receive any support if you have compiled your"
58                 ewarn "own SeaBIOS. Virtual machines subtly fail based on changes"
59                 ewarn "in SeaBIOS."
60         fi
61 }
62
63 pkg_setup() {
64         use binary || python-any-r1_pkg_setup
65 }
66
67 src_unpack() {
68         default
69         if use binary && use seavgabios ; then
70                 unpack ./data.tar.xz
71                 mv usr/share/seabios/vgabios*.bin ./ || die
72         fi
73
74         # This simplifies the logic between binary & source builds.
75         mkdir -p "${S}"
76 }
77
78 src_prepare() {
79         use binary && return
80
81         if [[ -z "${EGIT_COMMIT}" ]]; then
82                 sed -e "s/VERSION=.*/VERSION=${PV}/" \
83                         -i Makefile || die
84         else
85                 sed -e "s/VERSION=.*/VERSION=${PV}_pre${EGIT_COMMIT}/" \
86                         -i Makefile || die
87         fi
88
89         epatch_user
90 }
91
92 src_configure() {
93         use binary || tc-ld-disable-gold #438058
94 }
95
96 _emake() {
97         LANG=C \
98         emake V=1 \
99                 CC="$(tc-getCC)" \
100                 LD="$(tc-getLD)" \
101                 AR="$(tc-getAR)" \
102                 OBJCOPY="$(tc-getOBJCOPY)" \
103                 RANLIB="$(tc-getRANLIB)" \
104                 OBJDUMP="$(tc-getOBJDUMP)" \
105                 HOST_CC="$(tc-getBUILD_CC)" \
106                 "$@"
107 }
108
109 src_compile() {
110         use binary && return
111
112         _emake out/bios.bin
113         mv out/bios.bin ../bios.bin
114
115         if use seavgabios ; then
116                 local config t targets=(
117                         cirrus
118                         isavga
119                         qxl
120                         stdvga
121                         vmware
122                 )
123                 for t in "${targets[@]}" ; do
124                         emake clean distclean
125                         cp "${FILESDIR}/seavgabios/config.vga-${t}" .config || die
126                         _emake oldnoconfig
127                         _emake out/vgabios.bin
128                         cp out/vgabios.bin ../vgabios-${t}.bin || die
129                 done
130         fi
131 }
132
133 src_install() {
134         insinto /usr/share/seabios
135         newins ../bios.bin* bios.bin
136
137         if use seavgabios ; then
138                 insinto /usr/share/seavgabios
139                 doins ../vgabios*.bin
140         fi
141 }