1 |
1 |
# Copyright 1999-2023 Gentoo Authors
|
2 |
2 |
# Distributed under the terms of the GNU General Public License v2
|
3 |
3 |
|
4 |
|
EAPI=7
|
|
4 |
EAPI=8
|
5 |
5 |
|
6 |
6 |
PYTHON_REQ_USE="sqlite"
|
7 |
7 |
PYTHON_COMPAT=( python3_{10..11} )
|
... | ... | |
11 |
11 |
DESCRIPTION="UEFI firmware for 64-bit x86 virtual machines"
|
12 |
12 |
HOMEPAGE="https://github.com/tianocore/edk2"
|
13 |
13 |
|
14 |
|
BUNDLED_OPENSSL_SUBMODULE_SHA="e2e09d9fba1187f8d6aafaa34d4172f56f1ffb72"
|
15 |
|
BUNDLED_BROTLI_SUBMODULE_SHA="666c3280cc11dc433c303d79a83d4ffbdd12cc8d"
|
|
14 |
BUNDLED_OPENSSL_SUBMODULE_SHA="d82e959e621a3d597f1e0d50ff8c2d8b96915fd7"
|
|
15 |
BUNDLED_BROTLI_SUBMODULE_SHA="f4153a09f87cbb9c826d8fc12c74642bb2d879ea"
|
16 |
16 |
|
17 |
17 |
# TODO: talk with tamiko about unbundling (mva)
|
18 |
18 |
|
19 |
19 |
# TODO: the binary 202105 package currently lacks the preseeded
|
20 |
20 |
# OVMF_VARS.secboot.fd file (that we typically get from fedora)
|
21 |
21 |
|
22 |
|
SRC_URI="
|
23 |
|
!binary? (
|
24 |
|
https://github.com/tianocore/edk2/archive/edk2-stable${PV}.tar.gz -> ${P}.tar.gz
|
25 |
|
https://github.com/openssl/openssl/archive/${BUNDLED_OPENSSL_SUBMODULE_SHA}.tar.gz -> openssl-${BUNDLED_OPENSSL_SUBMODULE_SHA}.tar.gz
|
26 |
|
https://github.com/google/brotli/archive/${BUNDLED_BROTLI_SUBMODULE_SHA}.tar.gz -> brotli-${BUNDLED_BROTLI_SUBMODULE_SHA}.tar.gz
|
27 |
|
)
|
28 |
|
binary? ( https://dev.gentoo.org/~tamiko/distfiles/${P}-r1-bin.tar.xz )
|
29 |
|
https://dev.gentoo.org/~tamiko/distfiles/${P}-qemu-firmware.tar.xz
|
30 |
|
"
|
|
22 |
SRC_URI="https://github.com/tianocore/edk2/archive/edk2-stable${PV}.tar.gz -> ${P}.tar.gz
|
|
23 |
https://github.com/openssl/openssl/archive/${BUNDLED_OPENSSL_SUBMODULE_SHA}.tar.gz -> openssl-${BUNDLED_OPENSSL_SUBMODULE_SHA}.tar.gz
|
|
24 |
https://github.com/google/brotli/archive/${BUNDLED_BROTLI_SUBMODULE_SHA}.tar.gz -> brotli-${BUNDLED_BROTLI_SUBMODULE_SHA}.tar.gz
|
|
25 |
https://dev.gentoo.org/~ajak/distfiles/${P}-qemu-firmware.tar.xz"
|
31 |
26 |
|
32 |
27 |
LICENSE="BSD-2 MIT"
|
33 |
28 |
SLOT="0"
|
34 |
|
KEYWORDS="amd64 arm64 ~loong ~ppc ppc64 ~riscv x86"
|
|
29 |
KEYWORDS="-* amd64"
|
35 |
30 |
|
36 |
|
IUSE="+binary"
|
37 |
|
REQUIRED_USE+="
|
38 |
|
!amd64? ( binary )
|
39 |
|
"
|
40 |
|
|
41 |
|
NON_BINARY_DEPEND="
|
42 |
|
app-emulation/qemu
|
|
31 |
BDEPEND="app-emulation/qemu
|
43 |
32 |
>=dev-lang/nasm-2.0.7
|
44 |
33 |
>=sys-power/iasl-20160729
|
45 |
|
${PYTHON_DEPS}
|
46 |
|
"
|
47 |
|
|
48 |
|
DEPEND+="
|
49 |
|
!binary? (
|
50 |
|
amd64? (
|
51 |
|
${NON_BINARY_DEPEND}
|
52 |
|
)
|
53 |
|
)"
|
54 |
|
RDEPEND=""
|
|
34 |
${PYTHON_DEPS}"
|
|
35 |
RDEPEND="!sys-firmware/edk2-ovmf-bin"
|
55 |
36 |
|
56 |
37 |
PATCHES=(
|
57 |
38 |
"${FILESDIR}/${PN}-202105-werror.patch"
|
|
39 |
"${FILESDIR}/${PN}-202202-lld-textrels.patch"
|
|
40 |
"${FILESDIR}/${PN}-202202-binutils-2.41-textrels.patch"
|
58 |
41 |
)
|
59 |
42 |
|
60 |
43 |
S="${WORKDIR}/edk2-edk2-stable${PV}"
|
... | ... | |
89 |
72 |
..."
|
90 |
73 |
|
91 |
74 |
pkg_setup() {
|
92 |
|
[[ ${PV} != "999999" ]] && use binary || python-any-r1_pkg_setup
|
|
75 |
python-any-r1_pkg_setup
|
93 |
76 |
secureboot_pkg_setup
|
94 |
77 |
}
|
95 |
78 |
|
96 |
79 |
src_prepare() {
|
97 |
|
if use binary; then
|
98 |
|
eapply_user
|
99 |
|
else
|
100 |
|
# Bundled submodules
|
101 |
|
cp -rl "${WORKDIR}/openssl-${BUNDLED_OPENSSL_SUBMODULE_SHA}"/* "CryptoPkg/Library/OpensslLib/openssl/"
|
102 |
|
cp -rl "${WORKDIR}/brotli-${BUNDLED_BROTLI_SUBMODULE_SHA}"/* "BaseTools/Source/C/BrotliCompress/brotli/"
|
103 |
|
cp -rl "${WORKDIR}/brotli-${BUNDLED_BROTLI_SUBMODULE_SHA}"/* "MdeModulePkg/Library/BrotliCustomDecompressLib/brotli/"
|
104 |
|
|
105 |
|
sed -i -r \
|
106 |
|
-e "/function SetupPython3/,/\}/{s,\\\$\(whereis python3\),${EPYTHON},g}" \
|
107 |
|
"${S}"/edksetup.sh || die "Fixing for correct Python3 support failed"
|
|
80 |
# Bundled submodules
|
|
81 |
cp -rl "${WORKDIR}/openssl-${BUNDLED_OPENSSL_SUBMODULE_SHA}"/* "CryptoPkg/Library/OpensslLib/openssl/"
|
|
82 |
cp -rl "${WORKDIR}/brotli-${BUNDLED_BROTLI_SUBMODULE_SHA}"/* "BaseTools/Source/C/BrotliCompress/brotli/"
|
|
83 |
cp -rl "${WORKDIR}/brotli-${BUNDLED_BROTLI_SUBMODULE_SHA}"/* "MdeModulePkg/Library/BrotliCustomDecompressLib/brotli/"
|
|
84 |
|
|
85 |
sed -i -r \
|
|
86 |
-e "/function SetupPython3/,/\}/{s,\\\$\(whereis python3\),${EPYTHON},g}" \
|
|
87 |
"${S}"/edksetup.sh || die "Fixing for correct Python3 support failed"
|
108 |
88 |
|
109 |
|
default
|
110 |
|
fi
|
|
89 |
default
|
111 |
90 |
}
|
112 |
91 |
|
113 |
92 |
src_compile() {
|
... | ... | |
127 |
106 |
-D SMM_REQUIRE \
|
128 |
107 |
-D EXCLUDE_SHELL_FROM_FD"
|
129 |
108 |
|
130 |
|
[[ ${PV} != "999999" ]] && use binary && return
|
|
109 |
export LDFLAGS="-z notext"
|
|
110 |
export EXTRA_LDFLAGS="-z notext"
|
|
111 |
export DLINK_FLAGS="-z notext"
|
131 |
112 |
|
132 |
113 |
emake ARCH=${TARGET_ARCH} -C BaseTools
|
133 |
114 |
|