doc/manual/local.mk: handle DESTDIR= for inplace builds#6005
doc/manual/local.mk: handle DESTDIR= for inplace builds#6005trofi wants to merge 1 commit intoNixOS:masterfrom trofi:fix-DESTDIR
Conversation
Linux distributions usually install packages into sandboxed environments before moving packages into live system:
$ ./configure --prefix=/usr
$ make install DESTDIR=/sandbox
$ mv /sandbox/* /
`nix` fails at `make install` stage:
make: *** No rule to make target '/usr/bin/nix', needed by 'doc/manual/nix.json'. Stop.
make: *** Waiting for unfinished jobs....
The change sprinkles enough $(DESTDIR) prefixes to make it work.
To allow nix inplace execution LD_LIBRARY_PATH was added into $DESTDIR location.
Closes: #5781
|
Thank you for working on this, but please do not merge this PR, as it is not fixing the root cause. See instead this patch: The root cause is, that something (doc/manual/local.mk) in the build-phase has prerequisites on an install-phase target ($(bindir)/nix). The fix is to depend on a build-phase target instead. |
Heh, I think I tried it before and @edolstra rejected it in #5185. It was at time when nix did not require running itself during build process. I wonder how many more hour will people waste on it. Does it work for you as is? I would expect I suspect it works for you only because you already have nix installed with libraries in |
|
You can see the build log of my Debian package here: When you search for "src/nix/nix" you find invocations of the inplace-build nix binary. They work. There's definitely no nix preinstalled on these machines. I believe that this works because the nix build system is actually linking the nix binary two times for the inplace and the install target instead of linking it once and then copying it. See mk/programs.mk and these two rules: inplace linking: $$($(1)_PATH): $$($(1)_OBJS) $$(_libs) | $$(_d)/
$$(trace-ld) $(CXX) -o $$@ $$(LDFLAGS) $$(GLOBAL_LDFLAGS) $$($(1)_OBJS) $$($(1)_LDFLAGS) $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS_USE))install-place linking: $(DESTDIR)$$($(1)_INSTALL_PATH): $$($(1)_OBJS) $$(_libs_final) | $(DESTDIR)$$($(1)_INSTALL_DIR)/
$$(trace-ld) $(CXX) -o $$@ $$(LDFLAGS) $$(GLOBAL_LDFLAGS) $$($(1)_OBJS) $$($(1)_LDFLAGS) $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS_USE_INSTALLED)) |
|
Ah, good point! |
Linux distributions usually install packages into sandboxed environments before moving packages into live system:
nixfails atmake installstage:The change sprinkles enough $(DESTDIR) prefixes to make it work.
To allow nix inplace execution LD_LIBRARY_PATH was added into $DESTDIR location.
Closes: #5781