aboutsummaryrefslogtreecommitdiffstats
path: root/community/edk2/APKBUILD
blob: ec9f9ce7f390e77bf17b4f1519ff9f896390a8f2 (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
85
# Contributor: Timo Teräs <timo.teras@iki.fi>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>

pkgname=edk2
pkgver=0.0.20170624
_commitid=vUDK2017
pkgrel=0
pkgdesc="EFI Development Kit II"
url="https://github.com/tianocore/tianocore.github.io/wiki/EDK-II/"
arch="x86_64"
license="BSD"
depends=""
makedepends="bash python2 iasl nasm util-linux-dev"
install=""
subpackages="ovmf"
source="$pkgname-$pkgver.tar.gz::https://github.com/tianocore/$pkgname/archive/$_commitid.tar.gz
	build-hack.patch"
builddir="$srcdir/$pkgname-$_commitid"

case "$CARCH" in
x86)		TARGET_ARCH=IA32; OVMFPKG=OvmfPkgIa32.dsc;;
x86_64)		TARGET_ARCH=X64; OVMFPKG=OvmfPkgX64.dsc;;
esac

# use GCC49 instead of GCC5 until gcc 6.3 (see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70955)
TOOLCHAIN=GCC49
RELEASE=DEBUG

prepare() {
	cd "$builddir"
	# 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
	default_prepare
}

build() {
	cd "$builddir"
	bash -c ". edksetup.sh" || return 1
	make -j1 -C BaseTools || return 1

	export WORKSPACE=$PWD
	export PACKAGES_PATH=$PWD
	export EDK_TOOLS_PATH=$PWD/BaseTools/
	export PATH=$PWD/BaseTools/BinWrappers/PosixLike/:$PATH

	msg "Building OVMF"
	command build -b ${RELEASE} -a ${TARGET_ARCH} -p OvmfPkg/${OVMFPKG} -t ${TOOLCHAIN} -n ${JOBS:-2} || return 1
}

package() {
	cd "$builddir"
	mkdir -p "$pkgdir"/usr/bin \
		"$pkgdir"/usr/share/$pkgname/Conf \
		"$pkgdir"/usr/share/$pkgname/Scripts

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

	cp -R BaseTools/Source/Python "$pkgdir"/usr/share/$pkgname/Python
	for i in build BPDG Ecc GenDepex GenFds GenPatchPcdTable PatchPcdValue TargetTool Trim UPT; do
		echo '#!/bin/sh
export PYTHONPATH=/usr/share/$pkgname/Python
exec python '/usr/share/$pkgname/Python/$i/$i.py' "$@"' > "$pkgdir"/usr/bin/$i
		chmod +x "$pkgdir"/usr/bin/$i
	done
	install -d "$pkgdir"/usr/share/OVMF
	install Build/Ovmf${TARGET_ARCH}/${RELEASE}_${TOOLCHAIN}/FV/OVMF*.fd "$pkgdir"/usr/share/OVMF/
}

ovmf() {
	pkgdesc="Open Virtual Machine Firmware (OVMF) BIOS"
	license="BSD MIT"


	mkdir -p "$subpkgdir"/usr/share/$subpkgname
	mv "$pkgdir"/usr/share/OVMF "$subpkgdir"/usr/share/
	# compat symlink
	ln -s ../OVMF/OVMF.fd "$subpkgdir"/usr/share/ovmf/bios.bin
}

sha512sums="d941a661d570b0f69962105920b3524c4aac1f4883468914305eb68015148d70f6593c52872a79a6143cf87dc44e9ce2b8957834b4524cb8a04b12473c6d7d81  edk2-0.0.20170624.tar.gz
a7d4ab2c82b62ba01c86e59f53bd3896d661c9bfbb9db9598734155b66d5fe03eca4a2a9993a14d3bf555992c6d01ba5d7a15868ff9ec6ed98b8a9b3895bb7df  build-hack.patch"