mirror of
https://github.com/rust-lang/rust
synced 2024-10-14 04:23:37 +00:00
auto merge of #16552 : jauhien/rust/fix-libdir, r=alexcrichton
Fixies #11671 This commit changes default relative libdir 'lib' to a relative libdir calculated using LIBDIR provided by --libdir configuration option. In case if no option was provided behavior does not change.
This commit is contained in:
commit
2fcbf90d68
23
configure
vendored
23
configure
vendored
|
@ -550,9 +550,19 @@ CFG_LIBDIR_RELATIVE=lib
|
||||||
if [ "$CFG_OSTYPE" = "pc-windows-gnu" ]
|
if [ "$CFG_OSTYPE" = "pc-windows-gnu" ]
|
||||||
then
|
then
|
||||||
CFG_LIBDIR_RELATIVE=bin
|
CFG_LIBDIR_RELATIVE=bin
|
||||||
fi
|
CFG_LIBDIR="${CFG_PREFIX}/${CFG_LIBDIR_RELATIVE}"
|
||||||
|
else
|
||||||
|
valopt libdir "${CFG_PREFIX}/${CFG_LIBDIR_RELATIVE}" "install libraries (ignored on windows platform)"
|
||||||
|
|
||||||
valopt libdir "${CFG_PREFIX}/${CFG_LIBDIR_RELATIVE}" "install libraries"
|
case "$CFG_LIBDIR" in
|
||||||
|
"$CFG_PREFIX"/*) CAT_INC=2;;
|
||||||
|
"$CFG_PREFIX"*) CAT_INC=1;;
|
||||||
|
*)
|
||||||
|
err "libdir must begin with the prefix. Use --prefix to set it accordingly.";;
|
||||||
|
esac
|
||||||
|
|
||||||
|
CFG_LIBDIR_RELATIVE=`echo ${CFG_LIBDIR} | cut -c$((${#CFG_PREFIX}+${CAT_INC}))-`
|
||||||
|
fi
|
||||||
|
|
||||||
if [ $HELP -eq 1 ]
|
if [ $HELP -eq 1 ]
|
||||||
then
|
then
|
||||||
|
@ -989,6 +999,15 @@ for h in $CFG_HOST
|
||||||
do
|
do
|
||||||
for t in $CFG_TARGET
|
for t in $CFG_TARGET
|
||||||
do
|
do
|
||||||
|
# host lib dir stage0
|
||||||
|
make_dir $h/stage0/lib
|
||||||
|
|
||||||
|
# target bin dir stage0
|
||||||
|
make_dir $h/stage0/lib/rustlib/$t/bin
|
||||||
|
|
||||||
|
# target lib dir stage0
|
||||||
|
make_dir $h/stage0/lib/rustlib/$t/lib
|
||||||
|
|
||||||
for i in 0 1 2 3
|
for i in 0 1 2 3
|
||||||
do
|
do
|
||||||
# host bin dir
|
# host bin dir
|
||||||
|
|
|
@ -332,7 +332,15 @@ define SREQ
|
||||||
# Destinations of artifacts for the host compiler
|
# Destinations of artifacts for the host compiler
|
||||||
HROOT$(1)_H_$(3) = $(3)/stage$(1)
|
HROOT$(1)_H_$(3) = $(3)/stage$(1)
|
||||||
HBIN$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/bin
|
HBIN$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/bin
|
||||||
|
ifeq ($$(CFG_WINDOWSY_$(3)),1)
|
||||||
HLIB$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/$$(CFG_LIBDIR_RELATIVE)
|
HLIB$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/$$(CFG_LIBDIR_RELATIVE)
|
||||||
|
else
|
||||||
|
ifeq ($(1),0)
|
||||||
|
HLIB$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/lib
|
||||||
|
else
|
||||||
|
HLIB$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/$$(CFG_LIBDIR_RELATIVE)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
# Destinations of artifacts for target architectures
|
# Destinations of artifacts for target architectures
|
||||||
TROOT$(1)_T_$(2)_H_$(3) = $$(HLIB$(1)_H_$(3))/rustlib/$(2)
|
TROOT$(1)_T_$(2)_H_$(3) = $$(HLIB$(1)_H_$(3))/rustlib/$(2)
|
||||||
|
|
|
@ -301,9 +301,16 @@ fi
|
||||||
flag uninstall "only uninstall from the installation prefix"
|
flag uninstall "only uninstall from the installation prefix"
|
||||||
opt verify 1 "verify that the installed binaries run correctly"
|
opt verify 1 "verify that the installed binaries run correctly"
|
||||||
valopt prefix "/usr/local" "set installation prefix"
|
valopt prefix "/usr/local" "set installation prefix"
|
||||||
# NB This isn't quite the same definition as in `configure`.
|
# NB This is exactly the same definition as in `configure`.
|
||||||
# just using 'lib' instead of CFG_LIBDIR_RELATIVE
|
|
||||||
valopt libdir "${CFG_PREFIX}/${CFG_LIBDIR_RELATIVE}" "install libraries"
|
valopt libdir "${CFG_PREFIX}/${CFG_LIBDIR_RELATIVE}" "install libraries"
|
||||||
|
case "$CFG_LIBDIR" in
|
||||||
|
"$CFG_PREFIX"/*) CAT_INC=2;;
|
||||||
|
"$CFG_PREFIX"*) CAT_INC=1;;
|
||||||
|
*)
|
||||||
|
err "libdir must begin with the prefix. Use --prefix to set it accordingly.";;
|
||||||
|
esac
|
||||||
|
CFG_LIBDIR_RELATIVE=`echo ${CFG_LIBDIR} | cut -c$((${#CFG_PREFIX}+${CAT_INC}))-`
|
||||||
|
|
||||||
valopt mandir "${CFG_PREFIX}/share/man" "install man pages in PATH"
|
valopt mandir "${CFG_PREFIX}/share/man" "install man pages in PATH"
|
||||||
|
|
||||||
if [ $HELP -eq 1 ]
|
if [ $HELP -eq 1 ]
|
||||||
|
@ -428,9 +435,9 @@ while read p; do
|
||||||
# Decide the destination of the file
|
# Decide the destination of the file
|
||||||
FILE_INSTALL_PATH="${CFG_PREFIX}/$p"
|
FILE_INSTALL_PATH="${CFG_PREFIX}/$p"
|
||||||
|
|
||||||
if echo "$p" | grep "^lib/" > /dev/null
|
if echo "$p" | grep "^${CFG_LIBDIR_RELATIVE}/" > /dev/null
|
||||||
then
|
then
|
||||||
pp=`echo $p | sed 's/^lib\///'`
|
pp=`echo $p | sed "s%^${CFG_LIBDIR_RELATIVE}/%%"`
|
||||||
FILE_INSTALL_PATH="${CFG_LIBDIR}/$pp"
|
FILE_INSTALL_PATH="${CFG_LIBDIR}/$pp"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -257,11 +257,16 @@ fn find_libdir(sysroot: &Path) -> String {
|
||||||
// to lib64/lib32. This would be more foolproof by basing the sysroot off
|
// to lib64/lib32. This would be more foolproof by basing the sysroot off
|
||||||
// of the directory where librustc is located, rather than where the rustc
|
// of the directory where librustc is located, rather than where the rustc
|
||||||
// binary is.
|
// binary is.
|
||||||
|
//If --libdir is set during configuration to the value other than
|
||||||
|
// "lib" (i.e. non-default), this value is used (see issue #16552).
|
||||||
|
|
||||||
if sysroot.join(primary_libdir_name()).join(rustlibdir()).exists() {
|
match option_env!("CFG_LIBDIR_RELATIVE") {
|
||||||
return primary_libdir_name();
|
Some(libdir) if libdir != "lib" => return libdir.to_string(),
|
||||||
} else {
|
_ => if sysroot.join(primary_libdir_name()).join(rustlibdir()).exists() {
|
||||||
return secondary_libdir_name();
|
return primary_libdir_name();
|
||||||
|
} else {
|
||||||
|
return secondary_libdir_name();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_word_size = "64")]
|
#[cfg(target_word_size = "64")]
|
||||||
|
|
Loading…
Reference in a new issue