-
Notifications
You must be signed in to change notification settings - Fork 16
/
Makefile.darwin
62 lines (48 loc) · 2.45 KB
/
Makefile.darwin
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
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
OS_OUTDIR := $(OUTDIR)/os
LIMA_TEMPLATE_OUTDIR := $(OUTDIR)/lima-template
OUTPUT_DIRECTORIES += $(OS_OUTDIR) $(LIMA_TEMPLATE_OUTDIR)
SOCKET_VMNET_TEMP_PREFIX ?= $(OUTDIR)/dependencies/lima-socket_vmnet/opt/finch
include $(CURDIR)/deps/full-os.conf
ifeq ($(ARCH),x86_64)
FINCH_OS_BASENAME ?= $(X86_64_ARTIFACT)
FINCH_OS_DIGEST ?= $(X86_64_512_DIGEST)
LIMA_ARCH = x86_64
else
FINCH_OS_BASENAME ?= $(AARCH64_ARTIFACT)
FINCH_OS_DIGEST ?= $(AARCH64_512_DIGEST)
LIMA_ARCH = aarch64
endif
FINCH_IMAGE_LOCATION := $(OS_OUTDIR)/$(FINCH_OS_BASENAME)
FINCH_IMAGE_DIGEST := "sha512:$(FINCH_OS_DIGEST)"
# Virtualization framework is the default virtual machine type on Finch on macOS
# This is only used for testing of Finch core bundles.
FINCH_VM_TYPE ?= vz
install.dependencies: install.os install.lima-dependencies install.lima-socket-vmnet
.PHONY: install.os
install.os: $(OS_OUTDIR)/$(FINCH_OS_BASENAME)
$(OS_OUTDIR)/$(FINCH_OS_BASENAME): $(OS_OUTDIR) $(CURDIR)/deps/full-os.conf
bash deps/install.sh --arch $(ARCH) --output $@ $(CURDIR)/deps/full-os.conf
.PHONY: install.lima-dependencies
install.lima-dependencies: download.lima-dependencies $(LIMA_OUTDIR)
tar -xvzf ${LIMA_DOWNLOAD_DIR}/${LIMA_DEPENDENCY_FILE_NAME} -C $(LIMA_OUTDIR)
.PHONY: download.lima-dependencies
download.lima-dependencies: $(LIMA_DOWNLOAD_DIR)/$(LIMA_DEPENDENCY_FILE_NAME)
$(LIMA_DOWNLOAD_DIR)/$(LIMA_DEPENDENCY_FILE_NAME): $(LIMA_DOWNLOAD_DIR) $(CURDIR)/deps/lima-bundles.conf
bash deps/install.sh --arch $(ARCH) --output $@ $(CURDIR)/deps/lima-bundles.conf
.PHONY: install.lima-socket-vmnet
install.lima-socket-vmnet:
git submodule update --init --recursive src/socket_vmnet
cd src/socket_vmnet && git clean -f -d
cd src/socket_vmnet && PREFIX=$(SOCKET_VMNET_TEMP_PREFIX) "$(MAKE)" install.bin
$(LIMA_TEMPLATE_OUTDIR)/fedora.yaml: $(LIMA_TEMPLATE_OUTDIR)
cp lima-template/fedora.yaml $@.template
# using -i.bak is very intentional, it allows the following commands to succeed for both GNU / BSD sed
# this sed command uses the alternative separator of "|" because the image location uses "/"
sed -i.bak -e "s|<image_location>|$(FINCH_IMAGE_LOCATION)|g" $@.template
sed -i.bak -e "s/<image_arch>/$(LIMA_ARCH)/g" $@.template
sed -i.bak -e "s/<image_digest>/$(FINCH_IMAGE_DIGEST)/g" $@.template
# Replace was successful, so cleanup .bak files
rm $(LIMA_TEMPLATE_OUTDIR)/*.yaml.template.bak
mv $@.template $@