summaryrefslogtreecommitdiff
path: root/sysutils/uefi-edk2-bhyve-devel/Makefile
blob: e27de64f9452cdb256d0b262c851dae7496d8c04 (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
# $FreeBSD$

PORTNAME=	uefi-edk2-bhyve-devel
DISTVERSION=	g20190424
CATEGORIES=	sysutils

MAINTAINER=	araujo@FreeBSD.org
COMMENT=	UEFI-EDK2 firmware for bhyve

LICENSE=	BSD2CLAUSE

ONLY_FOR_ARCHS=	amd64

BUILD_DEPENDS=	${BASH_CMD}:shells/bash \
		nasm:devel/nasm \
		${PYTHON_LIBDIR}/lib-dynload/_sqlite3.so:databases/py-sqlite3@${PY_FLAVOR}

USES=		gmake \
		python:2.7,build
USE_GCC=	8+
USE_GITHUB=	yes
GH_ACCOUNT=	freebsd
GH_PROJECT=	uefi-edk2
GH_TAGNAME=	0613ec3
GH_TUPLE=	openssl:openssl:OpenSSL_1_1_0j:openssl/src/github.com/openssl/openssl

PLIST_FILES=	share/uefi-firmware/BHYVE_UEFI_CODE${PLIST_SUFFIX}-devel.fd \
		share/uefi-firmware/BHYVE_UEFI_VARS${PLIST_SUFFIX}-devel.fd

OPTIONS_DEFINE=	DEBUG HTTP_BOOT
OPTIONS_DEFAULT=	HTTP_BOOT

DEBUG_DESC=	Build a debug configuration
HTTP_BOOT_DESC=	Build with HTTP(S) boot support

DEBUG_VARS=	uefi_target=DEBUG
DEBUG_VARS_OFF=	uefi_target=RELEASE
HTTP_BOOT_VARS=	build_args+=-DHTTP_BOOT_ENABLE=TRUE

BASH_CMD=	${LOCALBASE}/bin/bash

MAKE_ARGS+=	EXTRA_LDFLAGS=-static
MAKE_ARGS+=	SHELL=${BASH_CMD}
MAKE_ENV+=	PYTHON_COMMAND=${PYTHON_CMD}
BUILD_ARGS=	-DDEBUG_ON_SERIAL_PORT=TRUE

post-extract:
	@${RMDIR} ${WRKSRC}/CryptoPkg/Library/OpensslLib/openssl
	@${MV} ${WRKSRC}/src/github.com/openssl/openssl \
		${WRKSRC}/CryptoPkg/Library/OpensslLib/openssl
do-build:
	${MKDIR} ${BUILD_WRKSRC}/BaseTools/Bin/FreeBSD-${MACHINE};
	${LN} -sf ${LOCALBASE}/bin/gcc${GCC_DEFAULT} ${BUILD_WRKSRC}/BaseTools/Bin/FreeBSD-${MACHINE}/gcc
	${LN} -sf ${LOCALBASE}/bin/gcc${GCC_DEFAULT} ${BUILD_WRKSRC}/BaseTools/Bin/FreeBSD-${MACHINE}/cc
	${LN} -sf ${LOCALBASE}/bin/g++${GCC_DEFAULT} ${BUILD_WRKSRC}/BaseTools/Bin/FreeBSD-${MACHINE}/g++
	${LN} -sf ${LOCALBASE}/bin/ld ${BUILD_WRKSRC}/BaseTools/Bin/FreeBSD-${MACHINE}/ld
	${LN} -sf ${LOCALBASE}/bin/gmake ${BUILD_WRKSRC}/BaseTools/Bin/FreeBSD-${MACHINE}/make
	${LN} -sf ${LOCALBASE}/bin/gcc-ar${GCC_DEFAULT} ${BUILD_WRKSRC}/BaseTools/Bin/FreeBSD-${MACHINE}/gcc-ar
	${LN} -sf ${LOCALBASE}/bin/gcc-nm${GCC_DEFAULT} ${BUILD_WRKSRC}/BaseTools/Bin/FreeBSD-${MACHINE}/gcc-nm
	${LN} -sf ${LOCALBASE}/bin/objcopy ${BUILD_WRKSRC}/BaseTools/Bin/FreeBSD-${MACHINE}/objcopy
	${LN} -sf ${LOCALBASE}/bin/nasm ${BUILD_WRKSRC}/BaseTools/Bin/FreeBSD-${MACHINE}/nasm
	unset ARCH; unset MAKEFLAGS
	${SETENV} ${MAKE_ENV} ${BASH_CMD} -c "cd ${WRKSRC}; . ./edksetup.sh; ${MAKE_CMD} ${MAKE_ARGS} -C ${WRKSRC}/BaseTools"
	${SETENV} ${MAKE_ENV} ${BASH_CMD} -c " \
		cd ${BUILD_WRKSRC}; \
		unset ARCH; unset MAKEFLAGS; \
		. ./edksetup.sh; \
		build -t GCC5 -a X64 -b ${UEFI_TARGET} -p OvmfPkg/OvmfPkgX64.dsc ${BUILD_ARGS} \
	"

do-install:
	${MKDIR} ${STAGEDIR}${PREFIX}/share/uefi-firmware/
	${INSTALL} ${BUILD_WRKSRC}/Build/OvmfX64/${UEFI_TARGET}_GCC5/FV/OVMF_CODE.fd \
		${STAGEDIR}${PREFIX}/share/uefi-firmware/BHYVE_UEFI_CODE${PLIST_SUFFIX}-devel.fd
	${INSTALL} ${BUILD_WRKSRC}/Build/OvmfX64/${UEFI_TARGET}_GCC5/FV/OVMF_VARS.fd \
		${STAGEDIR}${PREFIX}/share/uefi-firmware/BHYVE_UEFI_VARS${PLIST_SUFFIX}-devel.fd

.include <bsd.port.mk>
RUN_DEPENDS:=	${RUN_DEPENDS:Ngcc*}