mirror of
https://codeberg.org/armin/wavetable.git
synced 2026-10-11 16:02:19 +02:00
apply gin local changes as patches at build time
modules/ is gitignored, so local Gin edits cannot live in the submodule. They are stored in patches/ and re-applied (idempotently) before every configure and build via 'make apply-patches'. Also improve the submodule guard: git submodule update is a no-op here, so print concrete restore instructions instead.
This commit is contained in:
parent
70c2b83798
commit
7efcd527cf
2 changed files with 146 additions and 3 deletions
27
Makefile
27
Makefile
|
|
@ -3,7 +3,7 @@
|
|||
# bundles into ~/Library/Audio/Plug-Ins and the factory resources into
|
||||
# /Library/Audio/Presets (see the PRESET_ROOT note below).
|
||||
|
||||
.PHONY: all configure check-submodules build clean install uninstall uninstall-system pkg
|
||||
.PHONY: all configure check-submodules apply-patches build clean install uninstall uninstall-system pkg
|
||||
|
||||
PRESET ?= $(shell \
|
||||
if command -v xcodebuild >/dev/null 2>&1 && xcodebuild -version >/dev/null 2>&1; then \
|
||||
|
|
@ -26,8 +26,27 @@ SUBMODULE_FILES = modules/gin/ci/toolchains/base.json \
|
|||
modules/juce/CMakeLists.txt
|
||||
|
||||
# CMakePresets.json includes the gin toolchain presets, so configuring dies with
|
||||
# a bare "File not found" if the submodules are missing or mid-update.
|
||||
SUBMODULE_GUARD = for f in $(SUBMODULE_FILES); do test -e "$$f" || { echo "Missing $$f"; echo "Run: git submodule update --init --recursive"; exit 1; }; done
|
||||
# a bare "File not found" if a module directory is missing or half-deleted.
|
||||
# modules/ is gitignored and has no gitlink entries in the index, so
|
||||
# "git submodule update" is a no-op here and cannot restore anything.
|
||||
SUBMODULE_GUARD = for f in $(SUBMODULE_FILES); do test -e "$$f" || { m=`echo $$f | cut -d/ -f1-2`; r=`echo $$f | sed 's|^[^/]*/[^/]*/||'`; echo "Missing $$f"; echo " restore one file: git -C $$m checkout -- $$r"; echo " whole module: git clone <url from .gitmodules> $$m"; echo " note: 'git submodule update' is a no-op, modules/ is gitignored"; exit 1; }; done
|
||||
|
||||
# Local modifications to Gin live in patches/ (modules/ is gitignored, so the
|
||||
# changes cannot be committed as submodule edits). Re-applied on every build;
|
||||
# idempotent - patches already in the tree are skipped.
|
||||
PATCHES = $(wildcard patches/*.patch)
|
||||
|
||||
apply-patches:
|
||||
@test -d modules/gin/.git || { echo "modules/gin missing - see 'make check-submodules'"; exit 1; }
|
||||
@for p in $(PATCHES); do \
|
||||
if git -C modules/gin apply --reverse --check "$(CURDIR)/$$p" >/dev/null 2>&1; then \
|
||||
echo "Patch already applied: $$p"; \
|
||||
elif git -C modules/gin apply --check "$(CURDIR)/$$p" >/dev/null 2>&1; then \
|
||||
git -C modules/gin apply "$(CURDIR)/$$p" && echo "Applied: $$p"; \
|
||||
else \
|
||||
echo "Cannot apply $$p to modules/gin (upstream changed?)"; exit 1; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
# Bundles go in the user directory so no sudo is needed and hosts prefer them.
|
||||
PLUGIN_ROOT = $(HOME)/Library/Audio/Plug-Ins
|
||||
|
|
@ -48,9 +67,11 @@ check-submodules:
|
|||
|
||||
$(CACHE):
|
||||
@$(SUBMODULE_GUARD)
|
||||
@$(MAKE) --no-print-directory apply-patches
|
||||
cmake --preset $(PRESET)
|
||||
|
||||
build: $(CACHE)
|
||||
@$(MAKE) --no-print-directory apply-patches
|
||||
cmake --build --preset $(PRESET) --config $(CONFIG)
|
||||
|
||||
clean:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue