summaryrefslogtreecommitdiff
path: root/libre/ovmf/PKGBUILD
blob: 88592d66261f30204191f857d01933bc94793b30 (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
# Maintainer (Arch): Thomas Bächler <thomas@archlinux.org>
# Maintainer: André Silva <emulatorman@parabola.nu>
pkgname=ovmf
pkgver=20856
pkgrel=1.parabola1
arch=('any')
pkgdesc="Tianocore UEFI firmware for qemu, with free FatPkg support"
url="http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=EDK2"
license=('custom')
makedepends=('git' 'python2' 'iasl' 'nasm' 'perl-libwww')
source=('edk2::git+https://github.com/tianocore/edk2#branch=UDK2017')
sha256sums=('SKIP')
options=(!makeflags)
_toolchain_opt=GCC49

pkgver() {
  cd "${srcdir}"/edk2
  printf "$(git rev-list --count HEAD)"
}

prepare() {
  cd "${srcdir}"
  # edk2 uses python everywhere, but expects python2
  mkdir bin
  ln -s /usr/bin/python2 bin/python
}

build() {
  if [ "$CARCH" != "x86_64" ]; then
    error "This package must be built under the x86_64 architecture."
    false
  fi
  export PATH="${srcdir}/bin:$PATH"
  cd "${srcdir}/"edk2
  make -C BaseTools
  export EDK_TOOLS_PATH="${srcdir}"/edk2/BaseTools
  . edksetup.sh BaseTools

  # Set RELEASE target, toolchain and number of build threads
  sed "s|^TARGET[ ]*=.*|TARGET = RELEASE|; \
       s|TOOL_CHAIN_TAG[ ]*=.*|TOOL_CHAIN_TAG = ${_toolchain_opt}|; \
       s|MAX_CONCURRENT_THREAD_NUMBER[ ]*=.*|MAX_CONCURRENT_THREAD_NUMBER = $(nproc)|;" -i Conf/target.txt
  # Build OVMF for ia32
  sed "s|^TARGET_ARCH[ ]*=.*|TARGET_ARCH = IA32|; \
       s|^ACTIVE_PLATFORM[ ]*=.*|ACTIVE_PLATFORM = OvmfPkg/OvmfPkgIa32.dsc|;" -i Conf/target.txt
  ./BaseTools/BinWrappers/PosixLike/build
  # Build OVMF for x64
  sed "s|^TARGET_ARCH[ ]*=.*|TARGET_ARCH = X64|; \
       s|^ACTIVE_PLATFORM[ ]*=.*|ACTIVE_PLATFORM = OvmfPkg/OvmfPkgX64.dsc|;" -i Conf/target.txt
  ./BaseTools/BinWrappers/PosixLike/build
}

package() {
  install -D -m644 "${srcdir}"/edk2/Build/OvmfIa32/RELEASE_${_toolchain_opt}/FV/OVMF.fd "${pkgdir}"/usr/share/ovmf/ovmf_ia32.bin
  install -D -m644 "${srcdir}"/edk2/Build/OvmfIa32/RELEASE_${_toolchain_opt}/FV/OVMF_CODE.fd "${pkgdir}"/usr/share/ovmf/ovmf_code_ia32.bin
  install -D -m644 "${srcdir}"/edk2/Build/OvmfIa32/RELEASE_${_toolchain_opt}/FV/OVMF_VARS.fd "${pkgdir}"/usr/share/ovmf/ovmf_vars_ia32.bin
  install -D -m644 "${srcdir}"/edk2/Build/OvmfX64/RELEASE_${_toolchain_opt}/FV/OVMF.fd "${pkgdir}"/usr/share/ovmf/ovmf_x64.bin
  install -D -m644 "${srcdir}"/edk2/Build/OvmfX64/RELEASE_${_toolchain_opt}/FV/OVMF_CODE.fd "${pkgdir}"/usr/share/ovmf/ovmf_code_x64.bin
  install -D -m644 "${srcdir}"/edk2/Build/OvmfX64/RELEASE_${_toolchain_opt}/FV/OVMF_VARS.fd "${pkgdir}"/usr/share/ovmf/ovmf_vars_x64.bin
  install -D -m644 "${srcdir}"/edk2/OvmfPkg/License.txt "${pkgdir}"/usr/share/licenses/ovmf/License.txt
}