Files
RedBear-OS/mk/fstools.mk
T
vasilito b67697918e build: fix fstools host compile path + bison spawn.h cross-compile
fstools.mk: Use canonical local/sources/ paths for installer and redoxfs
cargo install --path. The recipes/ symlink chain caused cargo to resolve
path dependencies (../libredox, ../redoxfs, ../syscall) relative to the
recipe directory instead of the canonical source location, breaking
the host build.

bison: Add cross-compilation cache variables for POSIX spawn support.
Gnulib's configure couldn't detect the system spawn.h during cross-compile,
causing generated lib/spawn.h to omit #include_next, leaving
POSIX_SPAWN_* constants undefined.
2026-07-10 11:34:09 +03:00

65 lines
1.8 KiB
Makefile

# Configuration file for the Red Bear OS installer, Cookbook and RedoxFS FUSE
fstools: $(FSTOOLS_TAG) $(FSTOOLS)
GOING_TO_PODMAN_AGAIN?=0
# These tools run inside Podman if it is used, or on the host if Podman is not used
$(FSTOOLS): | prefix $(CONTAINER_TAG) $(FSTOOLS_TAG)
ifeq ($(PODMAN_BUILD),1)
ifeq ($(FSTOOLS_IN_PODMAN),1)
$(PODMAN_RUN) make $@
else
$(MAKE) $@ PODMAN_BUILD=0 SKIP_CHECK_TOOLS=1 GOING_TO_PODMAN_AGAIN=1
endif
else
rm -rf $@ $@.partial
mkdir -p $@.partial
ln -s ../../recipes $@.partial/recipes
ln -s ../../local $@.partial/local
$(MAKE) fstools_fetch PODMAN_BUILD=$(GOING_TO_PODMAN_AGAIN)
# Compile installer and redoxfs for host (may be outside of podman container)
# Use canonical local fork paths so cargo resolves path dependencies correctly.
# When source is accessed via recipes/ symlinks, cargo resolves "../dep" paths
# from the symlink location, not the canonical location, breaking path deps.
cd $@.partial && \
export CARGO_TARGET_DIR=../$@-target && \
$(HOST_CARGO) install --root . --path local/sources/installer --locked $(INSTALLER_FEATURES) && \
$(HOST_CARGO) install --root . --path local/sources/redoxfs --locked $(REDOXFS_FEATURES)
mv $@.partial $@
touch $@
endif
fstools_fetch: $(FSTOOLS_TAG) FORCE
ifeq ($(PODMAN_BUILD),1)
$(PODMAN_RUN) make $@
else
ifneq ($(REDBEAR_RELEASE),)
./local/scripts/restore-sources.sh --release=$(REDBEAR_RELEASE) core/installer core/redoxfs
else
$(REPO_BIN) fetch installer redoxfs
endif
endif
CARGO_OFFLINE_FLAG=
ifeq ($(REPO_OFFLINE),1)
CARGO_OFFLINE_FLAG=--offline
endif
$(FSTOOLS_TAG): $(CONTAINER_TAG)
ifeq ($(PODMAN_BUILD),1)
$(PODMAN_RUN) make $@
else
$(HOST_CARGO) build --manifest-path Cargo.toml --release --locked $(CARGO_OFFLINE_FLAG)
mkdir -p $(@D)
touch $@
endif
fstools_clean: FORCE
rm -rf target
rm -rf $(FSTOOLS)
rm -rf $(FSTOOLS)-target
rm -f $(FSTOOLS_TAG)