Skip to content

Commit edcfeb7

Browse files
committed
Auto merge of #29878 - wthrowe:libdir2, r=brson
Rather than modifying the installer to disable directory rewriting, this patch modifies the directory structure passed to the installer so that the rewriting gives the correct results. This means that if a non-standard --libdir is passed to configure then the same --libdir option (relative to the --prefix) must be passed to the install script. In the `make install` case this is handled automatically. Binary distributions are generally generated using the default --libdir and then have paths optionally rewritten by the installer, which should continue to work. This has the advantage of not complicating the installer interface intended for end-user use. Fixes #29561
2 parents 22e31f1 + ea798b9 commit edcfeb7

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

mk/prepare.mk

+7-2
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,11 @@ prepare-host-tool-$(1)-$(2)-$(3)-$(4): prepare-maybe-clean-$(4) \
104104
$$(call PREPARE_MAN,$(1).1),),)
105105
endef
106106

107+
# Libraries are compiled using the --libdir provided to configure, but
108+
# we store them in the tarball using just "lib" so that the install
109+
# script can then rewrite them back to the correct path.
110+
PREPARE_TAR_LIB_DIR = $(patsubst $(CFG_LIBDIR_RELATIVE)%,lib%,$(1))
111+
107112
# For host libraries only install dylibs, not rlibs since the host libs are only
108113
# used to support rustc and rustc uses dynamic linking
109114
#
@@ -115,7 +120,7 @@ define DEF_PREPARE_HOST_LIB
115120
prepare-host-lib-$(1)-$(2)-$(3)-$(4): \
116121
PREPARE_WORKING_SOURCE_LIB_DIR=$$(HLIB$(2)_H_$(3))
117122
prepare-host-lib-$(1)-$(2)-$(3)-$(4): \
118-
PREPARE_WORKING_DEST_LIB_DIR=$$(PREPARE_DEST_DIR)/$$(HLIB_RELATIVE$(2)_H_$(3))
123+
PREPARE_WORKING_DEST_LIB_DIR=$$(PREPARE_DEST_DIR)/$$(call PREPARE_TAR_LIB_DIR,$$(HLIB_RELATIVE$(2)_H_$(3)))
119124
prepare-host-lib-$(1)-$(2)-$(3)-$(4): prepare-maybe-clean-$(4) \
120125
$$(foreach dep,$$(RUST_DEPS_$(1)),prepare-host-lib-$$(dep)-$(2)-$(3)-$(4)) \
121126
$$(HLIB$(2)_H_$(3))/stamp.$(1) \
@@ -195,7 +200,7 @@ define DEF_PREPARE
195200

196201
prepare-base-$(1)-%: PREPARE_SOURCE_MAN_DIR=$$(S)/man
197202
prepare-base-$(1)-%: PREPARE_DEST_BIN_DIR=$$(PREPARE_DEST_DIR)/bin
198-
prepare-base-$(1)-%: PREPARE_DEST_LIB_DIR=$$(PREPARE_DEST_DIR)/$$(CFG_LIBDIR_RELATIVE)
203+
prepare-base-$(1)-%: PREPARE_DEST_LIB_DIR=$$(PREPARE_DEST_DIR)/$$(call PREPARE_TAR_LIB_DIR,$$(CFG_LIBDIR_RELATIVE))
199204
prepare-base-$(1)-%: PREPARE_DEST_MAN_DIR=$$(PREPARE_DEST_DIR)/share/man/man1
200205

201206
prepare-base-$(1)-target: prepare-target-$(1)

0 commit comments

Comments
 (0)