aboutsummaryrefslogtreecommitdiffstats
path: root/community/edk2/APKBUILD
blob: 50ed180f4ef33a2dbb1d9779e9e9df476b22a39e (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.20161115
_commitid=e242cdfb307a6dfe2c0f75c4719f5c1f6b418625
pkgrel=1
pkgdesc="EFI Development Kit II"
url="http://www.tianocore.org/edk2/"
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
}

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

	cd "$builddir"
	mkdir -p "$subpkgdir"/usr/share/$subpkgname/
	install Build/Ovmf${TARGET_ARCH}/${RELEASE}_${TOOLCHAIN}/FV/OVMF.fd "$subpkgdir"/usr/share/$subpkgname/bios.bin
}

md5sums="6e6a28fbdcc4062108da9df348d69240  edk2-0.0.20161115.tar.gz
63def07e68b1fad4062c99406bde7c0a  build-hack.patch"
sha256sums="e71586a0f335412a834b6720d88ec9d0a5d33621bbb6d87decdc2ee84b8d6e0e  edk2-0.0.20161115.tar.gz
d493fd3d711a96229b9fba8de81ba42c236af14e508f8090d3e9dd74d90e2371  build-hack.patch"
sha512sums="7b1de6c5aa08ba6ab0897b59c5f0eab654062c01c0a9bcdf182a5fd695eb8639b8cc418b2d2e0ebb35855b2bf7294947335d49c0c790fa05830f783ddaea6414  edk2-0.0.20161115.tar.gz
29158db1d54922f32215892bec0542176d64de4501fcdb1535508bb48b25e1f364ccd57b58aca07f2415c4654f76409dd64e40f5066db3fb9284a7217bbc2230  build-hack.patch"