summaryrefslogtreecommitdiff
path: root/sysutils
diff options
context:
space:
mode:
authormaya <maya@pkgsrc.org>2017-10-23 14:21:57 +0000
committermaya <maya@pkgsrc.org>2017-10-23 14:21:57 +0000
commit73da575a9a8022c893088ab9aa0247624a0d4226 (patch)
treea6f2673e743475a99c4a835ca41c4b726d87211c /sysutils
parentda3150dfa81259853be1304e3b8c50b328d9e04d (diff)
downloadpkgsrc-73da575a9a8022c893088ab9aa0247624a0d4226.tar.gz
Add package OVMF from UDK2017
Open Virtual Machine Firmware is a build of EDK II for virtual machines. It includes full support for UEFI allowing use of UEFI in place of a traditional BIOS in your VM.
Diffstat (limited to 'sysutils')
-rw-r--r--sysutils/ovmf/DESCR3
-rw-r--r--sysutils/ovmf/Makefile43
-rw-r--r--sysutils/ovmf/PLIST2
-rw-r--r--sysutils/ovmf/distinfo9
-rw-r--r--sysutils/ovmf/patches/patch-BaseTools_Conf_tools__def.template268
-rw-r--r--sysutils/ovmf/patches/patch-EmulatorPkg_build.sh31
-rw-r--r--sysutils/ovmf/patches/patch-OvmfPkg_build.sh45
7 files changed, 401 insertions, 0 deletions
diff --git a/sysutils/ovmf/DESCR b/sysutils/ovmf/DESCR
new file mode 100644
index 00000000000..8cd605c3a79
--- /dev/null
+++ b/sysutils/ovmf/DESCR
@@ -0,0 +1,3 @@
+Open Virtual Machine Firmware is a build of EDK II for virtual machines.
+It includes full support for UEFI allowing use of UEFI in place of a
+traditional BIOS in your VM.
diff --git a/sysutils/ovmf/Makefile b/sysutils/ovmf/Makefile
new file mode 100644
index 00000000000..bc17d5aa97a
--- /dev/null
+++ b/sysutils/ovmf/Makefile
@@ -0,0 +1,43 @@
+# $NetBSD: Makefile,v 1.1 2017/10/23 14:21:57 maya Exp $
+
+GITHUB_PROJECT= edk2
+PKGNAME= OVMF-0.0.2017624
+DISTNAME= vUDK2017
+CATEGORIES= sysutils
+MASTER_SITES= ${MASTER_SITE_GITHUB:=tianocore/}
+DIST_SUBDIR= ${GITHUB_PROJECT}
+GITHUB_TAG= ${DISTNAME}
+
+MAINTAINER= pkgsrc-users@NetBSD.org
+HOMEPAGE= https://github.com/tianocore/edk2/
+COMMENT= Sample UEFI firmware for virtual machines
+LICENSE= modified-bsd
+
+WRKSRC= ${WRKDIR}/${GITHUB_PROJECT}-${GITHUB_TAG}
+
+USETOOLS+= gmake bash
+USE_LANGUAGES= c c++
+
+PYTHON_VERSIONS_ACCEPTED= 27
+SUBST_CLASSES+= python
+SUBST_STAGE.python= pre-configure
+SUBST_MESSAGE.python= Fix python binary
+SUBST_FILES.python= BaseTools/Tests/GNUmakefile
+SUBST_FILES.python+= BaseTools/BinWrappers/PosixLike/*
+SUBST_SED.python= -e 's,python2,${PYTHONBIN},g'
+
+PKGSRC_USE_SSP= no
+
+do-build:
+ cd ${WRKSRC}/OvmfPkg && \
+ export MAKE=gmake && \
+ ${MAKE_BUILD_ENV} ./build.sh
+
+do-install:
+ ${INSTALL_PROGRAM} ${WRKSRC}/Build/Ovmf*/*/FV/OVMF.fd ${DESTDIR}${PREFIX}/share
+
+BUILD_DEPENDS+= nasm-[0-9]*:../../devel/nasm
+
+.include "../../lang/python/application.mk"
+.include "../../devel/libuuid/buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/sysutils/ovmf/PLIST b/sysutils/ovmf/PLIST
new file mode 100644
index 00000000000..290112cf5bf
--- /dev/null
+++ b/sysutils/ovmf/PLIST
@@ -0,0 +1,2 @@
+@comment $NetBSD: PLIST,v 1.1 2017/10/23 14:21:57 maya Exp $
+share
diff --git a/sysutils/ovmf/distinfo b/sysutils/ovmf/distinfo
new file mode 100644
index 00000000000..07cbaaf751e
--- /dev/null
+++ b/sysutils/ovmf/distinfo
@@ -0,0 +1,9 @@
+$NetBSD: distinfo,v 1.1 2017/10/23 14:21:57 maya Exp $
+
+SHA1 (edk2/vUDK2017.tar.gz) = 5bfb90aedb958d747eb8803b2a60d416842a39d6
+RMD160 (edk2/vUDK2017.tar.gz) = f8260ec115b2db0816cd9eb012b7ded77b151840
+SHA512 (edk2/vUDK2017.tar.gz) = d941a661d570b0f69962105920b3524c4aac1f4883468914305eb68015148d70f6593c52872a79a6143cf87dc44e9ce2b8957834b4524cb8a04b12473c6d7d81
+Size (edk2/vUDK2017.tar.gz) = 38737483 bytes
+SHA1 (patch-BaseTools_Conf_tools__def.template) = a6486b74d0e9e39738e2979a6940a051e9d4521a
+SHA1 (patch-EmulatorPkg_build.sh) = 3ad9cc36a05d5763b1b6eba75ae58ac16751a6fe
+SHA1 (patch-OvmfPkg_build.sh) = 7555880aaadfda4954b0bf8beab9a5441cc8374c
diff --git a/sysutils/ovmf/patches/patch-BaseTools_Conf_tools__def.template b/sysutils/ovmf/patches/patch-BaseTools_Conf_tools__def.template
new file mode 100644
index 00000000000..d9756e81045
--- /dev/null
+++ b/sysutils/ovmf/patches/patch-BaseTools_Conf_tools__def.template
@@ -0,0 +1,268 @@
+$NetBSD: patch-BaseTools_Conf_tools__def.template,v 1.1 2017/10/23 14:21:57 maya Exp $
+
+Avoid -flto (causes issues on netbsd)
+invoke 'gmake' rather than 'make'
+call 'ar' rather than 'gcc-ar'
+
+
+--- BaseTools/Conf/tools_def.template.orig 2017-06-13 08:26:05.000000000 +0000
++++ BaseTools/Conf/tools_def.template
+@@ -4503,7 +4503,7 @@ DEFINE GCC5_AARCH64_ASLDLINK_FLAGS = D
+ *_UNIXGCC_*_*_FAMILY = GCC
+ *_UNIXGCC_*_*_BUILDRULEFAMILY = GCCLD
+
+-*_UNIXGCC_*_MAKE_PATH = make
++*_UNIXGCC_*_MAKE_PATH = gmake
+ *_UNIXGCC_*_ASL_PATH = DEF(UNIX_IASL_BIN)
+
+ *_UNIXGCC_IA32_DLINK_FLAGS = DEF(GCC_IA32_X64_DLINK_FLAGS) --image-base=0
+@@ -4590,7 +4590,7 @@ DEFINE GCC5_AARCH64_ASLDLINK_FLAGS = D
+ ####################################################################################
+ *_GCC44_*_*_FAMILY = GCC
+
+-*_GCC44_*_MAKE_PATH = DEF(GCC44_IA32_PREFIX)make
++*_GCC44_*_MAKE_PATH = DEF(GCC44_IA32_PREFIX)gmake
+ *_GCC44_*_*_DLL = ENV(GCC44_DLL)
+ *_GCC44_*_ASL_PATH = DEF(UNIX_IASL_BIN)
+
+@@ -4666,7 +4666,7 @@ RELEASE_GCC44_X64_CC_FLAGS = DEF(G
+ ####################################################################################
+ *_GCC45_*_*_FAMILY = GCC
+
+-*_GCC45_*_MAKE_PATH = DEF(GCC45_IA32_PREFIX)make
++*_GCC45_*_MAKE_PATH = DEF(GCC45_IA32_PREFIX)gmake
+ *_GCC45_*_*_DLL = ENV(GCC45_DLL)
+ *_GCC45_*_ASL_PATH = DEF(UNIX_IASL_BIN)
+
+@@ -4742,7 +4742,7 @@ RELEASE_GCC45_X64_CC_FLAGS = DEF(G
+ ####################################################################################
+ *_GCC46_*_*_FAMILY = GCC
+
+-*_GCC46_*_MAKE_PATH = DEF(GCC46_IA32_PREFIX)make
++*_GCC46_*_MAKE_PATH = DEF(GCC46_IA32_PREFIX)gmake
+ *_GCC46_*_*_DLL = ENV(GCC46_DLL)
+ *_GCC46_*_ASL_PATH = DEF(UNIX_IASL_BIN)
+
+@@ -4851,7 +4851,7 @@ RELEASE_GCC46_ARM_CC_FLAGS = DEF(G
+ ####################################################################################
+ *_GCC47_*_*_FAMILY = GCC
+
+-*_GCC47_*_MAKE_PATH = DEF(GCC47_IA32_PREFIX)make
++*_GCC47_*_MAKE_PATH = DEF(GCC47_IA32_PREFIX)gmake
+ *_GCC47_*_*_DLL = ENV(GCC47_DLL)
+ *_GCC47_*_ASL_PATH = DEF(UNIX_IASL_BIN)
+
+@@ -4988,7 +4988,7 @@ RELEASE_GCC47_AARCH64_CC_FLAGS = DEF(G
+ ####################################################################################
+ *_GCC48_*_*_FAMILY = GCC
+
+-*_GCC48_*_MAKE_PATH = DEF(GCC48_IA32_PREFIX)make
++*_GCC48_*_MAKE_PATH = DEF(GCC48_IA32_PREFIX)gmake
+ *_GCC48_*_*_DLL = ENV(GCC48_DLL)
+ *_GCC48_*_ASL_PATH = DEF(UNIX_IASL_BIN)
+
+@@ -5125,7 +5125,7 @@ RELEASE_GCC48_AARCH64_CC_FLAGS = DEF(G
+ ####################################################################################
+ *_GCC49_*_*_FAMILY = GCC
+
+-*_GCC49_*_MAKE_PATH = DEF(GCC49_IA32_PREFIX)make
++*_GCC49_*_MAKE_PATH = DEF(GCC49_IA32_PREFIX)gmake
+ *_GCC49_*_*_DLL = ENV(GCC49_DLL)
+ *_GCC49_*_ASL_PATH = DEF(UNIX_IASL_BIN)
+
+@@ -5268,7 +5268,7 @@ RELEASE_GCC49_AARCH64_DLINK_FLAGS = DEF
+ ####################################################################################
+ *_GCC5_*_*_FAMILY = GCC
+
+-*_GCC5_*_MAKE_PATH = DEF(GCC5_IA32_PREFIX)make
++*_GCC5_*_MAKE_PATH = DEF(GCC5_IA32_PREFIX)gmake
+ *_GCC5_*_*_DLL = ENV(GCC5_DLL)
+ *_GCC5_*_ASL_PATH = DEF(UNIX_IASL_BIN)
+
+@@ -5285,7 +5285,7 @@ RELEASE_GCC49_AARCH64_DLINK_FLAGS = DEF
+ ##################
+ *_GCC5_IA32_OBJCOPY_PATH = DEF(GCC5_IA32_PREFIX)objcopy
+ *_GCC5_IA32_CC_PATH = DEF(GCC5_IA32_PREFIX)gcc
+-*_GCC5_IA32_SLINK_PATH = DEF(GCC5_IA32_PREFIX)gcc-ar
++*_GCC5_IA32_SLINK_PATH = DEF(GCC5_IA32_PREFIX)ar
+ *_GCC5_IA32_DLINK_PATH = DEF(GCC5_IA32_PREFIX)gcc
+ *_GCC5_IA32_ASLDLINK_PATH = DEF(GCC5_IA32_PREFIX)gcc
+ *_GCC5_IA32_ASM_PATH = DEF(GCC5_IA32_PREFIX)gcc
+@@ -5303,11 +5303,11 @@ RELEASE_GCC49_AARCH64_DLINK_FLAGS = DEF
+ *_GCC5_IA32_OBJCOPY_FLAGS =
+ *_GCC5_IA32_NASM_FLAGS = -f elf32
+
+- DEBUG_GCC5_IA32_CC_FLAGS = DEF(GCC5_IA32_CC_FLAGS) -flto -Os
+- DEBUG_GCC5_IA32_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -flto -Os -Wl,-m,elf_i386,--oformat=elf32-i386
++ DEBUG_GCC5_IA32_CC_FLAGS = DEF(GCC5_IA32_CC_FLAGS) -Os
++ DEBUG_GCC5_IA32_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -Os -Wl,-m,elf_i386,--oformat=elf32-i386
+
+-RELEASE_GCC5_IA32_CC_FLAGS = DEF(GCC5_IA32_CC_FLAGS) -flto -Os -Wno-unused-but-set-variable
+-RELEASE_GCC5_IA32_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -flto -Os -Wl,-m,elf_i386,--oformat=elf32-i386
++RELEASE_GCC5_IA32_CC_FLAGS = DEF(GCC5_IA32_CC_FLAGS) -Os -Wno-unused-but-set-variable
++RELEASE_GCC5_IA32_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -Os -Wl,-m,elf_i386,--oformat=elf32-i386
+
+ NOOPT_GCC5_IA32_CC_FLAGS = DEF(GCC5_IA32_CC_FLAGS) -O0
+ NOOPT_GCC5_IA32_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -Wl,-m,elf_i386,--oformat=elf32-i386 -O0
+@@ -5317,7 +5317,7 @@ RELEASE_GCC5_IA32_DLINK_FLAGS = DEF(G
+ ##################
+ *_GCC5_X64_OBJCOPY_PATH = DEF(GCC5_X64_PREFIX)objcopy
+ *_GCC5_X64_CC_PATH = DEF(GCC5_X64_PREFIX)gcc
+-*_GCC5_X64_SLINK_PATH = DEF(GCC5_X64_PREFIX)gcc-ar
++*_GCC5_X64_SLINK_PATH = DEF(GCC5_X64_PREFIX)ar
+ *_GCC5_X64_DLINK_PATH = DEF(GCC5_X64_PREFIX)gcc
+ *_GCC5_X64_ASLDLINK_PATH = DEF(GCC5_X64_PREFIX)gcc
+ *_GCC5_X64_ASM_PATH = DEF(GCC5_X64_PREFIX)gcc
+@@ -5335,11 +5335,11 @@ RELEASE_GCC5_IA32_DLINK_FLAGS = DEF(G
+ *_GCC5_X64_OBJCOPY_FLAGS =
+ *_GCC5_X64_NASM_FLAGS = -f elf64
+
+- DEBUG_GCC5_X64_CC_FLAGS = DEF(GCC5_X64_CC_FLAGS) -flto -DUSING_LTO -Os
+- DEBUG_GCC5_X64_DLINK_FLAGS = DEF(GCC5_X64_DLINK_FLAGS) -flto -Os
++ DEBUG_GCC5_X64_CC_FLAGS = DEF(GCC5_X64_CC_FLAGS) -DUSING_LTO -Os
++ DEBUG_GCC5_X64_DLINK_FLAGS = DEF(GCC5_X64_DLINK_FLAGS) -Os
+
+-RELEASE_GCC5_X64_CC_FLAGS = DEF(GCC5_X64_CC_FLAGS) -flto -DUSING_LTO -Os -Wno-unused-but-set-variable
+-RELEASE_GCC5_X64_DLINK_FLAGS = DEF(GCC5_X64_DLINK_FLAGS) -flto -Os
++RELEASE_GCC5_X64_CC_FLAGS = DEF(GCC5_X64_CC_FLAGS) -DUSING_LTO -Os -Wno-unused-but-set-variable
++RELEASE_GCC5_X64_DLINK_FLAGS = DEF(GCC5_X64_DLINK_FLAGS) -Os
+
+ NOOPT_GCC5_X64_CC_FLAGS = DEF(GCC5_X64_CC_FLAGS) -O0
+ NOOPT_GCC5_X64_DLINK_FLAGS = DEF(GCC5_X64_DLINK_FLAGS) -O0
+@@ -5348,7 +5348,7 @@ RELEASE_GCC5_X64_DLINK_FLAGS = DEF(G
+ # GCC5 ARM definitions
+ ##################
+ *_GCC5_ARM_CC_PATH = ENV(GCC5_ARM_PREFIX)gcc
+-*_GCC5_ARM_SLINK_PATH = ENV(GCC5_ARM_PREFIX)gcc-ar
++*_GCC5_ARM_SLINK_PATH = ENV(GCC5_ARM_PREFIX)ar
+ *_GCC5_ARM_DLINK_PATH = ENV(GCC5_ARM_PREFIX)gcc
+ *_GCC5_ARM_ASLDLINK_PATH = ENV(GCC5_ARM_PREFIX)gcc
+ *_GCC5_ARM_ASM_PATH = ENV(GCC5_ARM_PREFIX)gcc
+@@ -5372,8 +5372,8 @@ RELEASE_GCC5_X64_DLINK_FLAGS = DEF(G
+ DEBUG_GCC5_ARM_CC_FLAGS = DEF(GCC5_ARM_CC_FLAGS) -O0
+ DEBUG_GCC5_ARM_DLINK_FLAGS = DEF(GCC5_ARM_DLINK_FLAGS)
+
+-RELEASE_GCC5_ARM_CC_FLAGS = DEF(GCC5_ARM_CC_FLAGS) -flto -Wno-unused-but-set-variable
+-RELEASE_GCC5_ARM_DLINK_FLAGS = DEF(GCC5_ARM_DLINK_FLAGS) -flto -Os -L$(WORKSPACE)/ArmPkg/Library/GccLto -llto-arm -Wl,-plugin-opt=-pass-through=-llto-arm
++RELEASE_GCC5_ARM_CC_FLAGS = DEF(GCC5_ARM_CC_FLAGS) -Wno-unused-but-set-variable
++RELEASE_GCC5_ARM_DLINK_FLAGS = DEF(GCC5_ARM_DLINK_FLAGS) -Os -L$(WORKSPACE)/ArmPkg/Library/GccLto -llto-arm -Wl,-plugin-opt=-pass-through=-llto-arm
+
+ NOOPT_GCC5_ARM_CC_FLAGS = DEF(GCC5_ARM_CC_FLAGS) -O0
+ NOOPT_GCC5_ARM_DLINK_FLAGS = DEF(GCC5_ARM_DLINK_FLAGS) -O0
+@@ -5382,7 +5382,7 @@ RELEASE_GCC5_ARM_DLINK_FLAGS = DEF(G
+ # GCC5 AARCH64 definitions
+ ##################
+ *_GCC5_AARCH64_CC_PATH = ENV(GCC5_AARCH64_PREFIX)gcc
+-*_GCC5_AARCH64_SLINK_PATH = ENV(GCC5_AARCH64_PREFIX)gcc-ar
++*_GCC5_AARCH64_SLINK_PATH = ENV(GCC5_AARCH64_PREFIX)ar
+ *_GCC5_AARCH64_DLINK_PATH = ENV(GCC5_AARCH64_PREFIX)gcc
+ *_GCC5_AARCH64_ASLDLINK_PATH = ENV(GCC5_AARCH64_PREFIX)gcc
+ *_GCC5_AARCH64_ASM_PATH = ENV(GCC5_AARCH64_PREFIX)gcc
+@@ -5406,8 +5406,8 @@ RELEASE_GCC5_ARM_DLINK_FLAGS = DEF(G
+ DEBUG_GCC5_AARCH64_DLINK_FLAGS = DEF(GCC5_AARCH64_DLINK_FLAGS) -z common-page-size=0x1000
+ DEBUG_GCC5_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20
+
+-RELEASE_GCC5_AARCH64_CC_FLAGS = DEF(GCC5_AARCH64_CC_FLAGS) -flto -Wno-unused-but-set-variable -mcmodel=tiny -fomit-frame-pointer
+-RELEASE_GCC5_AARCH64_DLINK_FLAGS = DEF(GCC5_AARCH64_DLINK_FLAGS) -flto -Os -L$(WORKSPACE)/ArmPkg/Library/GccLto -llto-aarch64 -Wl,-plugin-opt=-pass-through=-llto-aarch64
++RELEASE_GCC5_AARCH64_CC_FLAGS = DEF(GCC5_AARCH64_CC_FLAGS) -Wno-unused-but-set-variable -mcmodel=tiny -fomit-frame-pointer
++RELEASE_GCC5_AARCH64_DLINK_FLAGS = DEF(GCC5_AARCH64_DLINK_FLAGS) -Os -L$(WORKSPACE)/ArmPkg/Library/GccLto -llto-aarch64 -Wl,-plugin-opt=-pass-through=-llto-aarch64
+
+ NOOPT_GCC5_AARCH64_CC_FLAGS = DEF(GCC5_AARCH64_CC_FLAGS) -O0 -mcmodel=small
+ NOOPT_GCC5_AARCH64_DLINK_FLAGS = DEF(GCC5_AARCH64_DLINK_FLAGS) -z common-page-size=0x1000 -O0
+@@ -5422,7 +5422,7 @@ RELEASE_GCC5_AARCH64_DLINK_FLAGS = DEF(G
+ ####################################################################################
+ *_CLANG35_*_*_FAMILY = GCC
+
+-*_CLANG35_*_MAKE_PATH = make
++*_CLANG35_*_MAKE_PATH = gmake
+ *_CLANG35_*_*_DLL = ENV(CLANG35_DLL)
+ *_CLANG35_*_ASL_PATH = DEF(UNIX_IASL_BIN)
+
+@@ -5498,7 +5498,7 @@ RELEASE_CLANG35_AARCH64_CC_FLAGS = DEF(C
+ #
+ ####################################################################################
+ *_CLANG38_*_*_FAMILY = GCC
+-*_CLANG38_*_MAKE_PATH = make
++*_CLANG38_*_MAKE_PATH = gmake
+ *_CLANG38_*_*_DLL = ENV(CLANG38_DLL)
+ *_CLANG38_*_ASL_PATH = DEF(UNIX_IASL_BIN)
+
+@@ -5539,12 +5539,12 @@ DEFINE CLANG38_ALL_CC_FLAGS = DE
+ *_CLANG38_IA32_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS) DEF(CLANG38_IA32_TARGET)
+ *_CLANG38_IA32_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS) DEF(CLANG38_IA32_TARGET)
+
+-DEBUG_CLANG38_IA32_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m32 -Oz -flto -march=i586 DEF(CLANG38_IA32_TARGET) -g
+-DEBUG_CLANG38_IA32_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -flto -Wl,-Oz -Wl,-melf_i386 -Wl,--oformat=elf32-i386
++DEBUG_CLANG38_IA32_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m32 -Oz -march=i586 DEF(CLANG38_IA32_TARGET) -g
++DEBUG_CLANG38_IA32_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -Wl,-Oz -Wl,-melf_i386 -Wl,--oformat=elf32-i386
+ DEBUG_CLANG38_IA32_DLINK2_FLAGS = DEF(GCC5_IA32_DLINK2_FLAGS) -O3
+
+-RELEASE_CLANG38_IA32_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m32 -Oz -flto -march=i586 DEF(CLANG38_IA32_TARGET)
+-RELEASE_CLANG38_IA32_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -flto -Wl,-Oz -Wl,-melf_i386 -Wl,--oformat=elf32-i386
++RELEASE_CLANG38_IA32_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m32 -Oz -march=i586 DEF(CLANG38_IA32_TARGET)
++RELEASE_CLANG38_IA32_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -Wl,-Oz -Wl,-melf_i386 -Wl,--oformat=elf32-i386
+ RELEASE_CLANG38_IA32_DLINK2_FLAGS = DEF(GCC5_IA32_DLINK2_FLAGS) -O3
+
+ NOOPT_CLANG38_IA32_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m32 -O0 -march=i586 DEF(CLANG38_IA32_TARGET) -g
+@@ -5576,12 +5576,12 @@ NOOPT_CLANG38_IA32_DLINK2_FLAGS = DE
+ *_CLANG38_X64_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS) DEF(CLANG38_X64_TARGET)
+ *_CLANG38_X64_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS) DEF(CLANG38_X64_TARGET)
+
+-DEBUG_CLANG38_X64_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m64 "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -mcmodel=small -fpie -Oz -flto DEF(CLANG38_X64_TARGET) -g
+-DEBUG_CLANG38_X64_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -flto -Wl,-Oz -Wl,-melf_x86_64 -Wl,--oformat=elf64-x86-64 -Wl,-pie -mcmodel=small
++DEBUG_CLANG38_X64_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m64 "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -mcmodel=small -fpie -Oz DEF(CLANG38_X64_TARGET) -g
++DEBUG_CLANG38_X64_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -Wl,-Oz -Wl,-melf_x86_64 -Wl,--oformat=elf64-x86-64 -Wl,-pie -mcmodel=small
+ DEBUG_CLANG38_X64_DLINK2_FLAGS = DEF(GCC5_X64_DLINK2_FLAGS) -O3
+
+-RELEASE_CLANG38_X64_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m64 "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -mcmodel=small -fpie -Oz -flto DEF(CLANG38_X64_TARGET)
+-RELEASE_CLANG38_X64_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -flto -Wl,-Oz -Wl,-melf_x86_64 -Wl,--oformat=elf64-x86-64 -Wl,-pie -mcmodel=small
++RELEASE_CLANG38_X64_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m64 "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -mcmodel=small -fpie -Oz DEF(CLANG38_X64_TARGET)
++RELEASE_CLANG38_X64_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -Wl,-Oz -Wl,-melf_x86_64 -Wl,--oformat=elf64-x86-64 -Wl,-pie -mcmodel=small
+ RELEASE_CLANG38_X64_DLINK2_FLAGS = DEF(GCC5_X64_DLINK2_FLAGS) -O3
+
+ NOOPT_CLANG38_X64_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m64 "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -mcmodel=small -fpie -O0 DEF(CLANG38_X64_TARGET) -g
+@@ -5809,7 +5809,7 @@ NOOPT_CLANG38_X64_DLINK2_FLAGS = DEF
+ # ELFGCC - Linux ELF GCC
+ *_ELFGCC_*_*_FAMILY = GCC
+ *_ELFGCC_*_*_BUILDRULEFAMILY = GCCLD
+-*_ELFGCC_*_MAKE_PATH = make
++*_ELFGCC_*_MAKE_PATH = gmake
+
+ *_ELFGCC_*_PP_FLAGS = -E -x assembler-with-cpp -include AutoGen.h
+ *_ELFGCC_*_VFRPP_FLAGS = -x c -E -P -DVFRCOMPILE --include $(MODULE_NAME)StrDefs.h
+@@ -7264,7 +7264,7 @@ NOOPT_MYTOOLS_IPF_DLINK_FLAGS
+
+ *_XCODE32_*_ASL_PATH = /usr/bin/iasl
+
+-*_XCODE32_*_MAKE_PATH = make
++*_XCODE32_*_MAKE_PATH = gmake
+
+ *_XCODE32_*_DSYMUTIL_PATH = /usr/bin/dsymutil
+
+@@ -7373,7 +7373,7 @@ RELEASE_XCODE32_ARM_CC_FLAGS = $(ARCHC
+
+ *_XCLANG_*_ASL_PATH = /usr/bin/iasl
+
+-*_XCLANG_*_MAKE_PATH = make
++*_XCLANG_*_MAKE_PATH = gmake
+ *_XCLANG_*_DSYMUTIL_PATH = /usr/bin/dsymutil
+
+ *_*_*_MTOC_PATH = /usr/local/bin/mtoc
+@@ -7438,7 +7438,7 @@ RELEASE_XCLANG_X64_CC_FLAGS = -ccc-hos
+ #
+ # use xcode-select to change Xcode version of command line tools
+ #
+-*_XCODE5_*_MAKE_PATH = make
++*_XCODE5_*_MAKE_PATH = gmake
+ *_XCODE5_*_CC_PATH = clang
+ *_XCODE5_*_SLINK_PATH = libtool
+ *_XCODE5_*_DLINK_PATH = ld
+@@ -7565,7 +7565,7 @@ RELEASE_RVCT_ARM_CC_FLAGS = $(ARCHCC_FL
+ *_RVCTLINUX_*_*_FAMILY = RVCT
+ *_RVCTLINUX_*_*_BUILDRULEFAMILY = RVCTLINUX
+
+-*_RVCTLINUX_*_MAKE_PATH = make
++*_RVCTLINUX_*_MAKE_PATH = gmake
+
+ #
+ # Use default values, or override in DSC file
diff --git a/sysutils/ovmf/patches/patch-EmulatorPkg_build.sh b/sysutils/ovmf/patches/patch-EmulatorPkg_build.sh
new file mode 100644
index 00000000000..c25498cce30
--- /dev/null
+++ b/sysutils/ovmf/patches/patch-EmulatorPkg_build.sh
@@ -0,0 +1,31 @@
+$NetBSD: patch-EmulatorPkg_build.sh,v 1.1 2017/10/23 14:21:57 maya Exp $
+
+treat other operating systems as linux
+invoke gmake, not make
+
+--- EmulatorPkg/build.sh.orig 2017-06-13 08:26:05.000000000 +0000
++++ EmulatorPkg/build.sh
+@@ -78,7 +78,7 @@ case `uname` in
+ BUILD_NEW_SHELL="-D BUILD_NEW_SHELL"
+ BUILD_FAT="-D BUILD_FAT"
+ ;;
+- Linux*)
++ *)
+ case `uname -m` in
+ i386)
+ HOST_PROCESSOR=IA32
+@@ -206,12 +206,12 @@ if [[ ! -f `which build` || ! -f `which
+ then
+ # build the tools if they don't yet exist. Bin scheme
+ echo Building tools as they are not in the path
+- make -C $WORKSPACE/BaseTools
++ gmake -C $WORKSPACE/BaseTools
+ elif [[ ( -f `which build` || -f `which GenFv` ) && ! -d $EDK_TOOLS_PATH/Source/C/bin ]];
+ then
+ # build the tools if they don't yet exist. BinWrapper scheme
+ echo Building tools no $EDK_TOOLS_PATH/Source/C/bin directory
+- make -C $WORKSPACE/BaseTools
++ gmake -C $WORKSPACE/BaseTools
+ else
+ echo using prebuilt tools
+ fi
diff --git a/sysutils/ovmf/patches/patch-OvmfPkg_build.sh b/sysutils/ovmf/patches/patch-OvmfPkg_build.sh
new file mode 100644
index 00000000000..73abf2d232e
--- /dev/null
+++ b/sysutils/ovmf/patches/patch-OvmfPkg_build.sh
@@ -0,0 +1,45 @@
+$NetBSD: patch-OvmfPkg_build.sh,v 1.1 2017/10/23 14:21:57 maya Exp $
+
+treat other operating systems as linux
+invoke gmake, not make
+Avoid GCC5 target tool due to errors appearing in the build
+
+--- OvmfPkg/build.sh.orig 2017-06-13 08:26:05.000000000 +0000
++++ OvmfPkg/build.sh
+@@ -80,7 +80,7 @@ case `uname` in
+ ;;
+ esac
+ ;;
+- Linux*)
++ *)
+ gcc_version=$(gcc -v 2>&1 | tail -1 | awk '{print $3}')
+ case $gcc_version in
+ [1-3].*|4.[0-3].*)
+@@ -102,11 +102,8 @@ case `uname` in
+ 4.8.*)
+ TARGET_TOOLS=GCC48
+ ;;
+- 4.9.*|6.[0-2].*)
+- TARGET_TOOLS=GCC49
+- ;;
+ *)
+- TARGET_TOOLS=GCC5
++ TARGET_TOOLS=GCC49
+ ;;
+ esac
+ esac
+@@ -264,12 +261,12 @@ if [[ ! -f `which build` || ! -f `which
+ then
+ # build the tools if they don't yet exist. Bin scheme
+ echo Building tools as they are not in the path
+- make -C $WORKSPACE/BaseTools
++ gmake -C $WORKSPACE/BaseTools
+ elif [[ ( -f `which build` || -f `which GenFv` ) && ! -d $EDK_TOOLS_PATH/Source/C/bin ]];
+ then
+ # build the tools if they don't yet exist. BinWrapper scheme
+ echo Building tools no $EDK_TOOLS_PATH/Source/C/bin directory
+- make -C $WORKSPACE/BaseTools
++ gmake -C $WORKSPACE/BaseTools
+ else
+ echo using prebuilt tools
+ fi