Skip to content

Commit

Permalink
build: add finch daemon (#424)
Browse files Browse the repository at this point in the history
* feat: build finch-daemon from source and add it to the output

Signed-off-by: Justin Alvarez <[email protected]>
  • Loading branch information
pendo324 authored Nov 14, 2024
1 parent c06ec0c commit 3b25881
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 2 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/submodulesync.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
fetch-depth: 0
submodules: recursive
token: ${{ secrets.GITHUB_TOKEN }}
- name: Update sub modules
- name: Update submodules
run: |
git submodule update --remote
# pin submodule to a commit, https://github.com/lima-vm/lima/commit/bd7442e34ebdccb4945828a007b5d102781bea92
Expand All @@ -24,6 +24,11 @@ jobs:
TAG=`cd src/lima && git describe --tags $(git rev-list --tags --max-count=1)`
echo "Pulling changes from release: $TAG"
(cd src/lima && git checkout $TAG)
# finch-daemon
(cd src/finch-daemon && git fetch --tags)
FINCH_DAEMON_TAG=`cd src/finch-daemon && git describe --tags $(git rev-list --tags --max-count=1)`
echo "Pulling changes from release: $FINCH_DAEMON_TAG"
(cd src/finch-daemon && git checkout $FINCH_DAEMON_TAG)
- name: Create PR
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7.0.5
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "src/socket_vmnet"]
path = src/socket_vmnet
url = https://github.com/lima-vm/socket_vmnet
[submodule "src/finch-daemon"]
path = src/finch-daemon
url = https://github.com/runfinch/finch-daemon.git
19 changes: 18 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ OUTDIR ?= $(CURDIR)/_output
DOWNLOAD_DIR := $(CURDIR)/downloads
LIMA_DOWNLOAD_DIR := $(DOWNLOAD_DIR)/dependencies
LIMA_OUTDIR ?= $(OUTDIR)/lima
FINCH_DAEMON_OUTDIR ?= $(OUTDIR)/finch-daemon
UNAME := $(shell uname -m)
ARCH ?= $(UNAME)
BUILD_TS := $(shell date +%s)

OUTPUT_DIRECTORIES=$(OUTDIR) $(DOWNLOAD_DIR) $(LIMA_DOWNLOAD_DIR) $(LIMA_OUTDIR)
OUTPUT_DIRECTORIES=$(OUTDIR) $(DOWNLOAD_DIR) $(LIMA_DOWNLOAD_DIR) $(LIMA_OUTDIR) $(FINCH_DAEMON_OUTDIR)

LIMA_DEPENDENCY_FILE_NAME ?= lima-and-qemu.tar.gz
.DEFAULT_GOAL := all
Expand All @@ -20,6 +21,7 @@ all: install.dependencies
# install.dependencies is a make target defined by the respective platform makefile
# pull the required finch core dependencies for the platform.
.PHONY: install.dependencies
install.dependencies: $(FINCH_DAEMON_OUTDIR)/finch-daemon

# Rootfs required for Windows, require full OS for Mac
FINCH_IMAGE_LOCATION ?=
Expand All @@ -32,13 +34,27 @@ else
include Makefile.darwin
endif

# transform some common results of uname -m to be compatible with Go
GOARCH ?= $(ARCH)
ifeq ($(GOARCH), x86_64)
GOARCH = amd64
else ifeq ($(GOARCH), aarch64)
GOARCH = arm64
endif

$(OUTPUT_DIRECTORIES):
@mkdir -p $@

.PHONY: download-sources
download-sources:
./bin/download-sources.pl

$(FINCH_DAEMON_OUTDIR)/finch-daemon: $(OUTPUT_DIRECTORIES)
git submodule update --init --recursive src/finch-daemon
cd src/finch-daemon && git clean -f -d
cd src/finch-daemon && STATIC=1 GOOS=linux GOARCH=$(GOARCH) "$(MAKE)"
cp src/finch-daemon/bin/finch-daemon $@

.PHONY: install
install: uninstall
mkdir -p $(DEST)
Expand All @@ -58,6 +74,7 @@ clean:
-@rm -rf $(OUTDIR) 2>/dev/null || true
-@rm -rf $(DOWNLOAD_DIR) 2>/dev/null || true
-@rm ./*.tar.gz 2>/dev/null || true
-@cd src/finch-daemon && make clean 2>/dev/null || true

.PHONY: test-e2e
test-e2e: $(LIMA_TEMPLATE_OUTDIR)/fedora.yaml
Expand Down
1 change: 1 addition & 0 deletions src/finch-daemon
Submodule finch-daemon added at 818fdd

0 comments on commit 3b25881

Please sign in to comment.