void-packages/srcpkgs/nix/patches/0002-manual-support-cross-c...

59 lines
2.5 KiB
Diff

From 1908b63a6296d24d9b97c6d615b81759812f572e Mon Sep 17 00:00:00 2001
Message-Id: <1908b63a6296d24d9b97c6d615b81759812f572e.1662107347.git.congdanhqx@gmail.com>
In-Reply-To: <68959b8b92b4bb6fd47cd80aafd9a76c1a50cf37.1662107347.git.congdanhqx@gmail.com>
References: <68959b8b92b4bb6fd47cd80aafd9a76c1a50cf37.1662107347.git.congdanhqx@gmail.com>
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
<congdanhqx@gmail.com>
Date: Fri, 2 Sep 2022 12:05:18 +0700
Subject: [PATCH 2/2] manual: support cross-compilation with qemu
---
doc/manual/local.mk | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/doc/manual/local.mk b/doc/manual/local.mk
index 6fad1c594..1e8bd8e47 100644
--- a/doc/manual/local.mk
+++ b/doc/manual/local.mk
@@ -24,7 +24,13 @@ dummy-env = env -i \
NIX_STATE_DIR=/dummy \
NIX_CONFIG='cores = 0'
-nix-eval = $(dummy-env) $(nix_DIR)/nix eval --experimental-features nix-command -I nix/corepkgs=corepkgs --store dummy:// --impure --raw
+ifneq (,$(findstring qemu,$(CROSS_EMULATOR)))
+ _nix-emu := QEMU_LD_PREFIX=${QEMU_LD_PREFIX} $(CROSS_EMULATOR)
+else
+ _nix-emu := $(CROSS_EMULATOR)
+endif
+
+nix-eval = $(dummy-env) $(_nix-emu) $(nix_DIR)/nix eval --experimental-features nix-command -I nix/corepkgs=corepkgs --store dummy:// --impure --raw
$(d)/%.1: $(d)/src/command-ref/%.md
@printf "Title: %s\n\n" "$$(basename $@ .1)" > $^.tmp
@@ -58,11 +64,11 @@ $(d)/src/command-ref/conf-file.md: $(d)/conf-file.json $(d)/generate-options.nix
@mv $@.tmp $@
$(d)/nix.json: $(nix_DIR)/nix
- $(trace-gen) $(dummy-env) $(nix_DIR)/nix __dump-args > $@.tmp
+ $(trace-gen) $(dummy-env) $(_nix-emu) $(nix_DIR)/nix __dump-args > $@.tmp
@mv $@.tmp $@
$(d)/conf-file.json: $(nix_DIR)/nix
- $(trace-gen) $(dummy-env) $(nix_DIR)/nix show-config --json --experimental-features nix-command > $@.tmp
+ $(trace-gen) $(dummy-env) $(_nix-emu) $(nix_DIR)/nix show-config --json --experimental-features nix-command > $@.tmp
@mv $@.tmp $@
$(d)/src/language/builtins.md: $(d)/builtins.json $(d)/generate-builtins.nix $(d)/src/language/builtins-prefix.md $(nix_DIR)/nix
@@ -72,7 +78,7 @@ $(d)/src/language/builtins.md: $(d)/builtins.json $(d)/generate-builtins.nix $(d
@mv $@.tmp $@
$(d)/builtins.json: $(nix_DIR)/nix
- $(trace-gen) $(dummy-env) NIX_PATH=nix/corepkgs=corepkgs $(nix_DIR)/nix __dump-builtins > $@.tmp
+ $(trace-gen) $(dummy-env) NIX_PATH=nix/corepkgs=corepkgs $(_nix-emu) $(nix_DIR)/nix __dump-builtins > $@.tmp
@mv $@.tmp $@
# Generate the HTML manual.
--
2.37.2.587.g219fe53025.dirty