Skip to content

Commit bdd30e6

Browse files
authored
feat(make): support Windows (#134)
Issue #, if available: *Description of changes:* add rules to download rootfs for WSL support on Windows, group other rules (download Finch OS, vmnet_socket) by operating system *Testing done:* Building `finch` on a Windows EC2, I've set my submodules to be ``` [submodule "deps/finch-core"] path = deps/finch-core url = https://github.com/ginglis13/finch-core.git branch = windev ``` and successfully made `finch` / `finch-core`. I also `make` and `make clean` `finch-core` on macOS - [x] I've reviewed the guidance in CONTRIBUTING.md #### License Acceptance By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. Signed-off-by: Gavin Inglis <[email protected]>
1 parent 08a4ca2 commit bdd30e6

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

Makefile

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ HASH_DIR ?= $(CURDIR)/hashes
66
DOWNLOAD_DIR := $(CURDIR)/downloads
77
OS_DOWNLOAD_DIR := $(DOWNLOAD_DIR)/os
88
LIMA_DOWNLOAD_DIR := $(DOWNLOAD_DIR)/dependencies
9+
ROOTFS_DOWNLOAD_DIR := $(DOWNLOAD_DIR)/rootfs
910
DEPENDENCIES_DOWNLOAD_DIR := $(DOWNLOAD_DIR)/dependencies
1011
SOCKET_VMNET_TEMP_PREFIX ?= $(OUTDIR)/dependencies/lima-socket_vmnet/opt/finch
1112
UNAME := $(shell uname -m)
@@ -34,6 +35,7 @@ ifneq (,$(findstring arm64,$(ARCH)))
3435

3536
# TODO: Use Finch rootfs in Finch on Windows testing
3637
FINCH_ROOTFS_URL ?= https://deps.runfinch.com/common/aarch64/finch-rootfs-production-arm64-1690920104.tar.zst
38+
FINCH_ROOTFS_BASENAME := $(notdir $(FINCH_ROOTFS_URL))
3739
else ifneq (,$(findstring x86_64,$(ARCH)))
3840
LIMA_ARCH = x86_64
3941
LIMA_URL ?= https://deps.runfinch.com/x86-64/lima-and-qemu.macos-x86_64.1689037160.tar.gz
@@ -44,6 +46,7 @@ else ifneq (,$(findstring x86_64,$(ARCH)))
4446

4547
# TODO: Use Finch rootfs in Finch on Windows testing
4648
FINCH_ROOTFS_URL ?= https://deps.runfinch.com/common/x86-64/finch-rootfs-production-amd64-1690920103.tar.zst
49+
FINCH_ROOTFS_BASENAME := $(notdir $(FINCH_ROOTFS_URL))
4750
endif
4851

4952
FINCH_OS_IMAGE_LOCATION ?= $(OUTDIR)/os/$(FINCH_OS_BASENAME)
@@ -53,18 +56,33 @@ FINCH_OS_IMAGE_INSTALLATION_LOCATION ?= $(DEST)/os/$(FINCH_OS_BASENAME)
5356
all: binaries
5457

5558
.PHONY: binaries
59+
.PHONY: download
60+
61+
# Rootfs required for Windows, require full OS for Linux and Mac
62+
63+
BUILD_OS ?= $(OS)
64+
ifeq ($(BUILD_OS), Windows_NT)
65+
binaries: rootfs lima-template
66+
download: download.rootfs
67+
else
5668
binaries: os lima-socket-vmnet lima-template
69+
download: download.os
70+
endif
5771

5872
$(OS_DOWNLOAD_DIR)/$(FINCH_OS_BASENAME):
5973
mkdir -p $(OS_DOWNLOAD_DIR)
6074
curl -L --fail $(FINCH_OS_IMAGE_URL) > "$(OS_DOWNLOAD_DIR)/$(FINCH_OS_BASENAME)"
6175
cd $(OS_DOWNLOAD_DIR) && shasum -a 512 --check $(HASH_DIR)/$(FINCH_OS_BASENAME).sha512 || exit 1
6276

77+
$(ROOTFS_DOWNLOAD_DIR)/$(FINCH_ROOTFS_BASENAME):
78+
mkdir -p $(ROOTFS_DOWNLOAD_DIR)
79+
curl -L --fail $(FINCH_ROOTFS_URL) > "$(ROOTFS_DOWNLOAD_DIR)/$(FINCH_ROOTFS_BASENAME)"
80+
6381
.PHONY: download.os
6482
download.os: $(OS_DOWNLOAD_DIR)/$(FINCH_OS_BASENAME)
6583

66-
.PHONY: download
67-
download: download.os
84+
.PHONY: download.rootfs
85+
download.rootfs: $(ROOTFS_DOWNLOAD_DIR)/$(FINCH_ROOTFS_BASENAME)
6886

6987
$(LIMA_DOWNLOAD_DIR)/$(LIMA_DEPENDENCY_FILE_NAME):
7088
mkdir -p $(DEPENDENCIES_DOWNLOAD_DIR)
@@ -104,6 +122,9 @@ os: download
104122
mkdir -p $(OUTDIR)/os
105123
lz4 -dcf $(DOWNLOAD_DIR)/os/$(FINCH_OS_BASENAME) > "$(OUTDIR)/os/$(FINCH_OS_BASENAME)"
106124

125+
.PHONY: rootfs
126+
rootfs: download
127+
107128
.PHONY: install
108129
install: uninstall
109130
mkdir -p $(DEST)

0 commit comments

Comments
 (0)