summaryrefslogtreecommitdiff
path: root/repo/edk2/edk2.xibuild
blob: 619461e43fb53e378330914f78dca2819062ed2e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/sh

NAME="edk2"
DESC="EFI Development Kit II"

MAKEDEPS="bash python iasl nasm util-linux"

PKG_VER=0.0.202202
_realver=edk2-stable${PKG_VER##*.}
_sslver=1.1.1n
_sfver=3e
SOURCE="https://github.com/tianocore/edk2/archive/$_realver.tar.gz"

ADDITIONAL="
https://www.openssl.org/source/openssl-$_sslver.tar.gz
http://www.jhauser.us/arithmetic/SoftFloat-$_sfver.zip
0008-BaseTools-do-not-build-BrotliCompress-RH-only.patch
0009-MdeModulePkg-remove-package-private-Brotli-include-p.patch
build-hack.patch
disable-werror.patch
"

TARGET_ARCH=X64
PLATFORM=OvmfPkg/OvmfPkgX64.dsc

TOOLCHAIN=GCC5
RELEASE=RELEASE


prepare() {
	# unix line endings for the files to be patched
	sed -e 's/\r$//' -i BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp \
		BaseTools/Source/C/VolInfo/VolInfo.c
	rm -rf CryptoPkg/Library/OpensslLib/openssl
	ln -s "$BUILD_ROOT"/openssl-$_sslver CryptoPkg/Library/OpensslLib/openssl
	rm -rf ArmPkg/Library/ArmSoftFloatLib/berkeley-softfloat-3
	ln -s "$BUILD_ROOT"/SoftFloat-$_sfver \
		ArmPkg/Library/ArmSoftFloatLib/berkeley-softfloat-3
	apply_patches
}

build() {
	export WORKSPACE=$PWD
	export PACKAGES_PATH=$PWD
	export EDK_TOOLS_PATH=$PWD/BaseTools/
	export PATH=$PWD/BaseTools/BinWrappers/PosixLike/:$PATH
	# parallel build fails
	unset MAKEFLAGS

	bash -c ". edksetup.sh"
	make -C BaseTools

	msg "Building Plaform Files"
	command build -b $RELEASE \
		-a $TARGET_ARCH  \
		-t $TOOLCHAIN \
		-p $PLATFORM \
		-n ${JOBS:-2}
}

package() {
	mkdir -p "$PKG_DEST"/usr/bin \
		"$PKG_DEST"/usr/share/edk2/Conf \
		"$PKG_DEST"/usr/share/edk2/Scripts

	install BaseTools/Source/C/bin/* BaseTools/BinWrappers/PosixLike/LzmaF86Compress \
		"$PKG_DEST"/usr/bin
	install BaseTools/BuildEnv "$PKG_DEST"/usr/share/edk2/
	install BaseTools/Conf/*.template "$PKG_DEST"/usr/share/edk2/Conf
	install BaseTools/Scripts/GccBase.lds "$PKG_DEST"/usr/share/edk2/Scripts

	for i in $(find BaseTools/Source/Python -type d -maxdepth 1); do
		local mod=${i##*/}
		test -f "$i/$mod.py" || continue
		cp -R BaseTools/Source/Python/"$mod" "$PKG_DEST"/usr/share/edk2/Python/
		cat <<- EOF > "$PKG_DEST"/usr/bin/"$mod".py
		#!/bin/sh
		export PYTHONPATH=/usr/share/edk2/Python
		exec $PYTHON_COMMAND /usr/share/edk2/Python/$mod/$mod.py "\$@"
		EOF
		chmod +x "$PKG_DEST"/usr/bin/"$mod".py
	done
}