sys-firmware/alsa-firmware-1.2.1: ppc64 stable, bug 705758
[gentoo.git] / sys-firmware / ipxe / ipxe-1.0.0_p20190728.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI="6"
5
6 inherit toolchain-funcs eutils savedconfig
7
8 GIT_REV="a4f8c6e31f6c62522cfc633bbbffa81b22f9d6f3"
9 GIT_SHORT=${GIT_REV:0:7}
10
11 DESCRIPTION="Open source network boot (PXE) firmware"
12 HOMEPAGE="http://ipxe.org/"
13 SRC_URI="
14         !binary? ( https://git.ipxe.org/ipxe.git/snapshot/${GIT_REV}.tar.bz2 -> ${P}-${GIT_SHORT}.tar.bz2 )
15         binary? ( https://dev.gentoo.org/~tamiko/distfiles/${P}-${GIT_SHORT}-bin.tar.xz )"
16
17 LICENSE="GPL-2"
18 SLOT="0"
19 KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 x86"
20 IUSE="+binary efi ipv6 iso lkrn +qemu undi usb vmware"
21
22 REQUIRED_USE="!amd64? ( !x86? ( binary ) )"
23
24 SOURCE_DEPEND="app-arch/xz-utils
25         dev-lang/perl
26         sys-libs/zlib
27         iso? (
28                 sys-boot/syslinux
29                 virtual/cdrtools
30         )"
31 DEPEND="
32         !binary? (
33                 amd64? ( ${SOURCE_DEPEND} )
34                 x86? ( ${SOURCE_DEPEND} )
35         )"
36 RDEPEND=""
37
38 S="${WORKDIR}/ipxe-${GIT_SHORT}/src"
39
40 src_configure() {
41         use binary && return
42
43         cat <<-EOF > "${S}"/config/local/general.h
44 #undef BANNER_TIMEOUT
45 #define BANNER_TIMEOUT 0
46 EOF
47
48         use ipv6 && echo "#define NET_PROTO_IPV6" >> "${S}"/config/local/general.h
49
50         if use vmware; then
51                 cat <<-EOF >> "${S}"/config/local/general.h
52 #define VMWARE_SETTINGS
53 #define CONSOLE_VMWARE
54 EOF
55         fi
56
57         restore_config config/local/general.h
58
59         tc-ld-disable-gold
60 }
61
62 ipxemake() {
63         # Q='' makes the build verbose since that's what everyone loves now
64         emake Q='' \
65                 CC="$(tc-getCC)" \
66                 LD="$(tc-getLD)" \
67                 AS="$(tc-getAS)" \
68                 AR="$(tc-getAR)" \
69                 NM="$(tc-getNM)" \
70                 OBJCOPY="$(tc-getOBJCOPY)" \
71                 RANLIB="$(tc-getRANLIB)" \
72                 OBJDUMP="$(tc-getOBJDUMP)" \
73                 HOST_CC="$(tc-getBUILD_CC)" \
74                 "$@"
75 }
76
77 src_compile() {
78         use binary && return
79
80         export NO_WERROR=1
81         if use qemu; then
82                 ipxemake bin/808610de.rom # pxe-e1000.rom (old)
83                 ipxemake bin/8086100e.rom # pxe-e1000.rom
84                 ipxemake bin/80861209.rom # pxe-eepro100.rom
85                 ipxemake bin/10500940.rom # pxe-ne2k_pci.rom
86                 ipxemake bin/10222000.rom # pxe-pcnet.rom
87                 ipxemake bin/10ec8139.rom # pxe-rtl8139.rom
88                 ipxemake bin/1af41000.rom # pxe-virtio.rom
89         fi
90
91         if use vmware; then
92                 ipxemake bin/8086100f.mrom # e1000
93                 ipxemake bin/808610d3.mrom # e1000e
94                 ipxemake bin/10222000.mrom # vlance
95                 ipxemake bin/15ad07b0.rom # vmxnet3
96         fi
97
98         use efi && ipxemake PLATFORM=efi BIN=bin-efi bin-efi/ipxe.efi
99         use iso && ipxemake bin/ipxe.iso
100         use undi && ipxemake bin/undionly.kpxe
101         use usb && ipxemake bin/ipxe.usb
102         use lkrn && ipxemake bin/ipxe.lkrn
103 }
104
105 src_install() {
106         insinto /usr/share/ipxe/
107
108         if use qemu || use vmware; then
109                 doins bin/*.rom
110         fi
111         use vmware && doins bin/*.mrom
112         use efi && doins bin-efi/*.efi
113         use iso && doins bin/*.iso
114         use undi && doins bin/*.kpxe
115         use usb && doins bin/*.usb
116         use lkrn && doins bin/*.lkrn
117
118         save_config config/local/general.h
119 }