Skip to content

Commit 4329fc6

Browse files
committed
auto merge of #11045 : jhasse/rust/patch-libdir, r=alexcrichton
See #5223 (comment)
2 parents 1d40fd4 + 116773a commit 4329fc6

File tree

7 files changed

+36
-36
lines changed

7 files changed

+36
-36
lines changed

Makefile.in

+3-2
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,7 @@ export CFG_ENABLE_MINGW_CROSS
416416
export CFG_PREFIX
417417
export CFG_LIBDIR
418418
export CFG_RUSTLIBDIR
419+
export LIBDIR_RELATIVE
419420

420421
######################################################################
421422
# Subprograms
@@ -433,12 +434,12 @@ define SREQ
433434
# Destinations of artifacts for the host compiler
434435
HROOT$(1)_H_$(3) = $(3)/stage$(1)
435436
HBIN$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/bin
436-
HLIB$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/$$(CFG_LIBDIR)
437+
HLIB$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/$$(LIBDIR_RELATIVE)
437438

438439
# Destinations of artifacts for target architectures
439440
TROOT$(1)_T_$(2)_H_$(3) = $$(HLIB$(1)_H_$(3))/$$(CFG_RUSTLIBDIR)/$(2)
440441
TBIN$(1)_T_$(2)_H_$(3) = $$(TROOT$(1)_T_$(2)_H_$(3))/bin
441-
TLIB$(1)_T_$(2)_H_$(3) = $$(TROOT$(1)_T_$(2)_H_$(3))/$$(CFG_LIBDIR)
442+
TLIB$(1)_T_$(2)_H_$(3) = $$(TROOT$(1)_T_$(2)_H_$(3))/lib
442443

443444
# The name of the standard and extra libraries used by rustc
444445
HSTDLIB_DEFAULT$(1)_H_$(3) = \

configure

+22-20
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,17 @@ valopt sysconfdir "/etc" "install system configuration files"
397397
valopt datadir "${CFG_PREFIX}/share" "install data"
398398
valopt infodir "${CFG_PREFIX}/share/info" "install additional info"
399399
valopt mandir "${CFG_PREFIX}/share/man" "install man pages in PATH"
400-
valopt libdir "${CFG_PREFIX}/lib" "install libraries"
400+
401+
# On windows we just store the libraries in the bin directory because
402+
# there's no rpath
403+
# FIXME: Thise needs to parameterized over target triples. Do it in platform.mk
404+
LIBDIR_RELATIVE=lib
405+
if [ "$CFG_OSTYPE" = "pc-mingw32" ]
406+
then
407+
LIBDIR_RELATIVE=bin
408+
fi
409+
410+
valopt libdir "${CFG_PREFIX}/${LIBDIR_RELATIVE}" "install libraries"
401411
valopt rustlibdir "rustlib" "subdirectory name for rustc's libraries"
402412

403413
# Validate Options
@@ -560,10 +570,10 @@ then
560570
step_msg "on OS X 10.9, forcing use of clang"
561571
CFG_ENABLE_CLANG=1
562572
putvar CFG_ENABLE_CLANG
563-
else
564-
# on OS X, with xcode 5 and newer, certain developers may have
573+
else
574+
# on OS X, with xcode 5 and newer, certain developers may have
565575
# cc, gcc and g++ point to a mixture of clang and gcc
566-
# if so, this will create very strange build errors
576+
# if so, this will create very strange build errors
567577
# this last stanza is to detect some such problems and save the future rust
568578
# contributor some time solving that issue.
569579
# this detection could be generalized to other OSes aside from OS X
@@ -576,8 +586,8 @@ then
576586
# note that for xcode 5, g++ points to clang, not clang++
577587
if !((chk_cc gcc clang && chk_cc g++ clang) ||
578588
(chk_cc gcc gcc &&( chk_cc g++ g++ || chk g++ gcc))) then
579-
err "the gcc and g++ in your path point to different compilers.
580-
Check which versions are in your path with cc --version and g++ --version.
589+
err "the gcc and g++ in your path point to different compilers.
590+
Check which versions are in your path with cc --version and g++ --version.
581591
To resolve this problem, either fix your PATH or run configure with --enable-clang"
582592
fi
583593

@@ -751,15 +761,6 @@ do
751761
done
752762
done
753763

754-
# On windows we just store the libraries in the bin directory because
755-
# there's no rpath
756-
# FIXME: Thise needs to parameterized over target triples. Do it in platform.mk
757-
CFG_LIBDIR=lib
758-
if [ "$CFG_OSTYPE" = "pc-mingw32" ]
759-
then
760-
CFG_LIBDIR=bin
761-
fi
762-
763764
for h in $CFG_HOST
764765
do
765766
for t in $CFG_TARGET
@@ -770,21 +771,21 @@ do
770771
make_dir $h/stage$i/bin
771772

772773
# host lib dir
773-
make_dir $h/stage$i/$CFG_LIBDIR
774+
make_dir $h/stage$i/$LIBDIR_RELATIVE
774775

775776
# host test dir
776777
make_dir $h/stage$i/test
777778

778779
# target bin dir
779-
make_dir $h/stage$i/$CFG_LIBDIR/$CFG_RUSTLIBDIR/$t/bin
780+
make_dir $h/stage$i/$LIBDIR_RELATIVE/$CFG_RUSTLIBDIR/$t/bin
780781

781782
# target lib dir
782-
make_dir $h/stage$i/$CFG_LIBDIR/$CFG_RUSTLIBDIR/$t/$CFG_LIBDIR
783+
make_dir $h/stage$i/$LIBDIR_RELATIVE/$CFG_RUSTLIBDIR/$t/lib
783784
done
784785

785786
# Fix stage0:
786-
make_dir $h/stage0/$CFG_LIBDIR/rustc/$t/bin
787-
make_dir $h/stage0/$CFG_LIBDIR/rustc/$t/$CFG_LIBDIR
787+
make_dir $h/stage0/$LIBDIR_RELATIVE/rustc/$t/bin
788+
make_dir $h/stage0/$LIBDIR_RELATIVE/rustc/$t/$LIBDIR_RELATIVE
788789

789790
done
790791

@@ -1038,6 +1039,7 @@ putvar CFG_TARGET
10381039
putvar CFG_C_COMPILER
10391040
putvar CFG_LIBDIR
10401041
putvar CFG_RUSTLIBDIR
1042+
putvar LIBDIR_RELATIVE
10411043
putvar CFG_DISABLE_MANAGE_SUBMODULES
10421044
putvar CFG_ANDROID_CROSS_PATH
10431045
putvar CFG_MINGW32_CROSS_PATH

mk/host.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ $$(HLIB$(2)_H_$(4))/$(CFG_LIBNATIVE_$(4)): \
149149
$$(HBIN$(2)_H_$(4))/:
150150
mkdir -p $$@
151151

152-
ifneq ($(CFG_LIBDIR),bin)
152+
ifneq ($(LIBDIR_RELATIVE),bin)
153153
$$(HLIB$(2)_H_$(4))/:
154154
mkdir -p $$@
155155
endif

mk/install.mk

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ ISTAGE = 2
6363

6464
PREFIX_ROOT = $(CFG_PREFIX)
6565
PREFIX_BIN = $(PREFIX_ROOT)/bin
66-
PREFIX_LIB = $(PREFIX_ROOT)/$(CFG_LIBDIR)
66+
PREFIX_LIB = $(CFG_LIBDIR)
6767

6868
define INSTALL_PREPARE_N
6969
# $(1) is the target triple
@@ -76,7 +76,7 @@ TL$(1)$(2) = $$(TLIB$$(ISTAGE)_T_$(1)_H_$(2))
7676
# PT{R,B,L} == Prefix Target {Root, Bin, Lib}
7777
PTR$(1)$(2) = $$(PREFIX_LIB)/$(CFG_RUSTLIBDIR)/$(1)
7878
PTB$(1)$(2) = $$(PTR$(1)$(2))/bin
79-
PTL$(1)$(2) = $$(PTR$(1)$(2))/$(CFG_LIBDIR)
79+
PTL$(1)$(2) = $$(PTR$(1)$(2))/lib
8080

8181
endef
8282

mk/target.mk

-2
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,8 @@ endif
193193
$$(TBIN$(1)_T_$(2)_H_$(3))/:
194194
mkdir -p $$@
195195

196-
ifneq ($(CFG_LIBDIR),bin)
197196
$$(TLIB$(1)_T_$(2)_H_$(3))/:
198197
mkdir -p $$@
199-
endif
200198

201199
endef
202200

mk/tests.mk

+5-5
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,14 @@ endif
101101
ifdef CFG_WINDOWSY_$(1)
102102
CFG_TESTLIB_$(1)=$$(CFG_BUILD_DIR)$$(2)/$$(strip \
103103
$$(if $$(findstring stage0,$$(1)), \
104-
stage0/$$(CFG_LIBDIR), \
104+
stage0/$$(LIBDIR_RELATIVE), \
105105
$$(if $$(findstring stage1,$$(1)), \
106-
stage1/$$(CFG_LIBDIR), \
106+
stage1/$$(LIBDIR_RELATIVE), \
107107
$$(if $$(findstring stage2,$$(1)), \
108-
stage2/$$(CFG_LIBDIR), \
108+
stage2/$$(LIBDIR_RELATIVE), \
109109
$$(if $$(findstring stage3,$$(1)), \
110-
stage3/$$(CFG_LIBDIR), \
111-
)))))/$$(CFG_RUSTLIBDIR)/$$(CFG_BUILD)/$$(CFG_LIBDIR)
110+
stage3/$$(LIBDIR_RELATIVE), \
111+
)))))/$$(CFG_RUSTLIBDIR)/$$(CFG_BUILD)/lib
112112
CFG_RUN_TEST_$(1)=$$(call CFG_RUN_$(1),$$(call CFG_TESTLIB_$(1),$$(1),$$(3)),$$(1))
113113
endif
114114

src/librustc/metadata/filesearch.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,11 @@ pub fn search(filesearch: @FileSearch, pick: pick) {
154154
}
155155

156156
pub fn relative_target_lib_path(target_triple: &str) -> Path {
157-
let dir = libdir();
158-
let mut p = Path::new(dir.as_slice());
157+
let mut p = Path::new(libdir());
159158
assert!(p.is_relative());
160159
p.push(rustlibdir());
161160
p.push(target_triple);
162-
p.push(dir);
161+
p.push("lib");
163162
p
164163
}
165164

@@ -245,7 +244,7 @@ pub fn rust_path() -> ~[Path] {
245244
// The name of the directory rustc expects libraries to be located.
246245
// On Unix should be "lib", on windows "bin"
247246
pub fn libdir() -> ~str {
248-
(env!("CFG_LIBDIR")).to_owned()
247+
(env!("LIBDIR_RELATIVE")).to_owned()
249248
}
250249

251250
// The name of rustc's own place to organize libraries.

0 commit comments

Comments
 (0)