Skip to content

Commit 8eaada5

Browse files
committed
auto merge of #13151 : brson/rust/dist, r=alexcrichton,brson
A variety of stuff here, mostly aimed at making `make install` work correctly with `--libdir` and `--mandir`. `make install` again goes through `install.sh`.
2 parents 3b04fba + 0f4f786 commit 8eaada5

File tree

13 files changed

+154
-124
lines changed

13 files changed

+154
-124
lines changed

Makefile.in

+7-6
Original file line numberDiff line numberDiff line change
@@ -232,19 +232,20 @@ ifneq ($(strip $(findstring prepare,$(MAKECMDGOALS)) \
232232
include $(CFG_SRC_DIR)mk/prepare.mk
233233
endif
234234

235-
# (Unix) Installation from the build directory
236-
ifneq ($(findstring install,$(MAKECMDGOALS)),)
237-
CFG_INFO := $(info cfg: including install rules)
238-
include $(CFG_SRC_DIR)mk/install.mk
239-
endif
240-
241235
# Source and binary distribution artifacts
242236
ifneq ($(strip $(findstring dist,$(MAKECMDGOALS)) \
237+
$(findstring install,$(MAKECMDGOALS)) \
243238
$(findstring clean,$(MAKECMDGOALS))),)
244239
CFG_INFO := $(info cfg: including dist rules)
245240
include $(CFG_SRC_DIR)mk/dist.mk
246241
endif
247242

243+
# (Unix) Installation from the build directory
244+
ifneq ($(findstring install,$(MAKECMDGOALS)),)
245+
CFG_INFO := $(info cfg: including install rules)
246+
include $(CFG_SRC_DIR)mk/install.mk
247+
endif
248+
248249
# Cleaning
249250
ifneq ($(findstring clean,$(MAKECMDGOALS)),)
250251
CFG_INFO := $(info cfg: including clean rules)

configure

+5-5
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,7 @@ opt local-rust 0 "use an installed rustc rather than downloading a snapshot"
383383
opt pax-flags 0 "apply PaX flags to rustc binaries (required for GRSecurity/PaX-patched kernels)"
384384
opt inject-std-version 1 "inject the current compiler version of libstd into programs"
385385
opt rpath 1 "build rpaths into rustc itself"
386+
opt nightly 0 "build nightly packages"
386387
valopt prefix "/usr/local" "set installation prefix"
387388
valopt local-rust-root "/usr/local" "set prefix for local rust binary"
388389
valopt llvm-root "" "set LLVM root"
@@ -401,7 +402,8 @@ valopt infodir "${CFG_PREFIX}/share/info" "install additional info"
401402
valopt mandir "${CFG_PREFIX}/share/man" "install man pages in PATH"
402403

403404
# On windows we just store the libraries in the bin directory because
404-
# there's no rpath
405+
# there's no rpath. This is where the build system itself puts libraries;
406+
# --libdir is used to configure the installation directory.
405407
# FIXME: Thise needs to parameterized over target triples. Do it in platform.mk
406408
CFG_LIBDIR_RELATIVE=lib
407409
if [ "$CFG_OSTYPE" = "pc-mingw32" ]
@@ -410,7 +412,6 @@ then
410412
fi
411413

412414
valopt libdir "${CFG_PREFIX}/${CFG_LIBDIR_RELATIVE}" "install libraries"
413-
valopt rustlibdir "rustlib" "subdirectory name for rustc's libraries"
414415

415416
if [ $HELP -eq 1 ]
416417
then
@@ -777,10 +778,10 @@ do
777778
make_dir $h/stage$i/test
778779

779780
# target bin dir
780-
make_dir $h/stage$i/$CFG_LIBDIR_RELATIVE/$CFG_RUSTLIBDIR/$t/bin
781+
make_dir $h/stage$i/$CFG_LIBDIR_RELATIVE/rustlib/$t/bin
781782

782783
# target lib dir
783-
make_dir $h/stage$i/$CFG_LIBDIR_RELATIVE/$CFG_RUSTLIBDIR/$t/lib
784+
make_dir $h/stage$i/$CFG_LIBDIR_RELATIVE/rustlib/$t/lib
784785
done
785786
done
786787

@@ -1039,7 +1040,6 @@ putvar CFG_HOST
10391040
putvar CFG_TARGET
10401041
putvar CFG_C_COMPILER
10411042
putvar CFG_LIBDIR
1042-
putvar CFG_RUSTLIBDIR
10431043
putvar CFG_LIBDIR_RELATIVE
10441044
putvar CFG_DISABLE_MANAGE_SUBMODULES
10451045
putvar CFG_ANDROID_CROSS_PATH

mk/dist.mk

+5-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
# * dist-tar-bins - Ad-hoc Unix binary installers
2323
# * dist-docs - Stage docs for upload
2424

25-
PKG_NAME = $(CFG_PACKAGE_NAME)
25+
PKG_NAME := $(CFG_PACKAGE_NAME)
2626

2727
# License suitable for displaying in a popup
2828
LICENSE.txt: $(S)COPYRIGHT $(S)LICENSE-APACHE $(S)LICENSE-MIT
@@ -199,8 +199,10 @@ dist-install-dir-$(1): PREPARE_LIB_CMD=$(DEFAULT_PREPARE_LIB_CMD)
199199
dist-install-dir-$(1): PREPARE_MAN_CMD=$(DEFAULT_PREPARE_MAN_CMD)
200200
dist-install-dir-$(1): PREPARE_CLEAN=true
201201
dist-install-dir-$(1): prepare-base-dir-$(1)
202-
$$(Q)(cd $$(PREPARE_DEST_DIR)/ && find -type f) \
203-
> $$(PREPARE_DEST_DIR)/$$(CFG_LIBDIR_RELATIVE)/$$(CFG_RUSTLIBDIR)/manifest
202+
$$(Q)(cd $$(PREPARE_DEST_DIR)/ && find . -type f | sed 's/^\.\///') \
203+
> tmp/dist/manifest-$(1).in
204+
$$(Q)mv tmp/dist/manifest-$(1).in $$(PREPARE_DEST_DIR)/$$(CFG_LIBDIR_RELATIVE)/rustlib/manifest.in
205+
# Add remaining non-installed files
204206
$$(Q)$$(PREPARE_MAN_CMD) $$(S)COPYRIGHT $$(PREPARE_DEST_DIR)
205207
$$(Q)$$(PREPARE_MAN_CMD) $$(S)LICENSE-APACHE $$(PREPARE_DEST_DIR)
206208
$$(Q)$$(PREPARE_MAN_CMD) $$(S)LICENSE-MIT $$(PREPARE_DEST_DIR)

mk/install.mk

+9-60
Original file line numberDiff line numberDiff line change
@@ -8,70 +8,19 @@
88
# option. This file may not be copied, modified, or distributed
99
# except according to those terms.
1010

11-
# FIXME: Docs are currently not installed from the stageN dirs.
12-
# For consistency it might be desirable for stageN to be an exact
13-
# mirror of the installation directory structure.
1411

15-
# The stage we install from
16-
ISTAGE = $(PREPARE_STAGE)
12+
install: dist-install-dir-$(CFG_BUILD)
13+
$(Q)sh tmp/dist/$(PKG_NAME)-$(CFG_BUILD)/install.sh --prefix="$(CFG_PREFIX)" --libdir="$(CFG_LIBDIR)" --mandir="$(CFG_MANDIR)"
14+
# Remove tmp files while we can because they may have been created under sudo
15+
$(Q)rm -R tmp/dist/$(PKG_NAME)-$(CFG_BUILD/
1716

18-
$(eval $(call DEF_PREPARE,mkfile-install))
17+
uninstall: dist-install-dir-$(CFG_BUILD)
18+
$(Q)sh tmp/dist/$(PKG_NAME)-$(CFG_BUILD)/install.sh --uninstall --prefix="$(CFG_PREFIX)" --libdir="$(CFG_LIBDIR)" --mandir="$(CFG_MANDIR)"
1919

20-
install: PREPARE_HOST=$(CFG_BUILD)
21-
install: PREPARE_TARGETS=$(CFG_TARGET)
22-
install: PREPARE_DIR_CMD=$(DEFAULT_PREPARE_DIR_CMD)
23-
install: PREPARE_BIN_CMD=$(DEFAULT_PREPARE_BIN_CMD)
24-
install: PREPARE_LIB_CMD=$(DEFAULT_PREPARE_LIB_CMD)
25-
install: PREPARE_MAN_CMD=$(DEFAULT_PREPARE_MAN_CMD)
26-
install: PREPARE_SOURCE_DIR=$(PREPARE_HOST)/stage$(PREPARE_STAGE)
27-
install: PREPARE_SOURCE_BIN_DIR=$(PREPARE_SOURCE_DIR)/bin
28-
install: PREPARE_SOURCE_LIB_DIR=$(PREPARE_SOURCE_DIR)/$(CFG_LIBDIR_RELATIVE)
29-
install: PREPARE_SOURCE_MAN_DIR=$(S)/man
30-
install: PREPARE_DEST_BIN_DIR=$(DESTDIR)$(CFG_PREFIX)/bin
31-
install: PREPARE_DEST_LIB_DIR=$(DESTDIR)$(CFG_LIBDIR)
32-
install: PREPARE_DEST_MAN_DIR=$(DESTDIR)$(CFG_MANDIR)/man1
33-
install: prepare-everything-mkfile-install
34-
35-
36-
# Uninstall code
37-
38-
PREFIX_ROOT = $(CFG_PREFIX)
39-
PREFIX_BIN = $(PREFIX_ROOT)/bin
40-
PREFIX_LIB = $(CFG_LIBDIR)
41-
42-
INSTALL_TOOLS := $(PREPARE_TOOLS)
43-
44-
# Shorthand for build/stageN/bin
45-
HB = $(HBIN$(ISTAGE)_H_$(CFG_BUILD))
46-
HB2 = $(HBIN2_H_$(CFG_BUILD))
47-
# Shorthand for build/stageN/lib
48-
HL = $(HLIB$(ISTAGE)_H_$(CFG_BUILD))
49-
# Shorthand for the prefix bin directory
50-
PHB = $(PREFIX_BIN)
51-
# Shorthand for the prefix bin directory
52-
PHL = $(PREFIX_LIB)
53-
54-
HOST_LIB_FROM_HL_GLOB = \
55-
$(patsubst $(HL)/%,$(PHL)/%,$(wildcard $(HL)/$(1)))
56-
57-
uninstall: $(foreach tool,$(INSTALL_TOOLS),uninstall-tool-$(tool))
58-
$(Q)rm -Rf $(PHL)/$(CFG_RUSTLIBDIR)
59-
60-
define UNINSTALL_TOOL
61-
uninstall-tool-$(1): $$(foreach dep,$$(TOOL_DEPS_$(1)),uninstall-lib-$$(dep))
62-
$$(Q)rm -f $$(PHB)/$(1)$$(X_$$(CFG_BUILD))
63-
$$(Q)rm -f $$(CFG_MANDIR)/man1/$(1).1
64-
endef
65-
66-
$(foreach tool,$(INSTALL_TOOLS),$(eval $(call UNINSTALL_TOOL,$(tool))))
67-
68-
define UNINSTALL_LIB
69-
uninstall-lib-$(1): $$(foreach dep,$$(RUST_DEPS_$(1)),uninstall-lib-$$(dep))
70-
$$(Q)rm -f $$(call HOST_LIB_FROM_HL_GLOB,$$(call CFG_LIB_GLOB_$$(CFG_BUILD),$(1)))
71-
endef
72-
73-
$(foreach lib,$(CRATES),$(eval $(call UNINSTALL_LIB,$(lib))))
7420

21+
######################################################################
22+
# Android remote installation
23+
######################################################################
7524

7625
# Android runtime setup
7726
# FIXME: This probably belongs somewhere else

mk/main.mk

+2-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
CFG_RELEASE_NUM=0.10
1717
CFG_RELEASE_LABEL=-pre
1818

19-
ifndef CFG_NIGHTLY
19+
ifndef CFG_ENABLE_NIGHTLY
2020
# This is the normal version string
2121
CFG_RELEASE=$(CFG_RELEASE_NUM)$(CFG_RELEASE_LABEL)
2222
CFG_PACKAGE_VERS=$(CFG_RELEASE)
@@ -281,7 +281,6 @@ export CFG_LLVM_ROOT
281281
export CFG_ENABLE_MINGW_CROSS
282282
export CFG_PREFIX
283283
export CFG_LIBDIR
284-
export CFG_RUSTLIBDIR
285284
export CFG_LIBDIR_RELATIVE
286285
export CFG_DISABLE_INJECT_STD_VERSION
287286

@@ -302,7 +301,7 @@ HBIN$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/bin
302301
HLIB$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/$$(CFG_LIBDIR_RELATIVE)
303302

304303
# Destinations of artifacts for target architectures
305-
TROOT$(1)_T_$(2)_H_$(3) = $$(HLIB$(1)_H_$(3))/$$(CFG_RUSTLIBDIR)/$(2)
304+
TROOT$(1)_T_$(2)_H_$(3) = $$(HLIB$(1)_H_$(3))/rustlib/$(2)
306305
TBIN$(1)_T_$(2)_H_$(3) = $$(TROOT$(1)_T_$(2)_H_$(3))/bin
307306
TLIB$(1)_T_$(2)_H_$(3) = $$(TROOT$(1)_T_$(2)_H_$(3))/lib
308307

mk/prepare.mk

+3-2
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ PREPARE_TOOLS = $(filter-out compiletest, $(TOOLS))
8686
define DEF_PREPARE_HOST_TOOL
8787
prepare-host-tool-$(1)-$(2)-$(3)-$(4): prepare-maybe-clean-$(4) \
8888
$$(foreach dep,$$(TOOL_DEPS_$(1)),prepare-host-lib-$$(dep)-$(2)-$(3)-$(4)) \
89+
$$(HBIN$(2)_H_$(3))/$(1)$$(X_$(3)) \
8990
prepare-host-dirs-$(4)
9091
$$(if $$(findstring $(2), $$(PREPARE_STAGE)),\
9192
$$(if $$(findstring $(3), $$(PREPARE_HOST)),\
@@ -121,8 +122,8 @@ endef
121122
# $(4) tag
122123
define DEF_PREPARE_TARGET_N
123124
# Rebind PREPARE_*_LIB_DIR to point to rustlib, then install the libs for the targets
124-
prepare-target-$(2)-host-$(3)-$(1)-$(4): PREPARE_WORKING_SOURCE_LIB_DIR=$$(PREPARE_SOURCE_LIB_DIR)/$$(CFG_RUSTLIBDIR)/$(2)/lib
125-
prepare-target-$(2)-host-$(3)-$(1)-$(4): PREPARE_WORKING_DEST_LIB_DIR=$$(PREPARE_DEST_LIB_DIR)/$$(CFG_RUSTLIBDIR)/$(2)/lib
125+
prepare-target-$(2)-host-$(3)-$(1)-$(4): PREPARE_WORKING_SOURCE_LIB_DIR=$$(PREPARE_SOURCE_LIB_DIR)/rustlib/$(2)/lib
126+
prepare-target-$(2)-host-$(3)-$(1)-$(4): PREPARE_WORKING_DEST_LIB_DIR=$$(PREPARE_DEST_LIB_DIR)/rustlib/$(2)/lib
126127
prepare-target-$(2)-host-$(3)-$(1)-$(4): prepare-maybe-clean-$(4) \
127128
$$(foreach crate,$$(TARGET_CRATES), \
128129
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(crate)) \

mk/stage0.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ $(SNAPSHOT_RUSTC_POST_CLEANUP): \
1515
# Note: the variable "SNAPSHOT_FILE" is generally not set, and so
1616
# we generally only pass one argument to this script.
1717
ifdef CFG_ENABLE_LOCAL_RUST
18-
$(Q)$(S)src/etc/local_stage0.sh $(CFG_BUILD) $(CFG_LOCAL_RUST_ROOT) $(CFG_RUSTLIBDIR)
18+
$(Q)$(S)src/etc/local_stage0.sh $(CFG_BUILD) $(CFG_LOCAL_RUST_ROOT) rustlib
1919
else
2020
$(Q)$(CFG_PYTHON) $(S)src/etc/get-snapshot.py $(CFG_BUILD) $(SNAPSHOT_FILE)
2121
ifdef CFG_ENABLE_PAX_FLAGS

mk/target.mk

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# This is the compile-time target-triple for the compiler. For the compiler at
1212
# runtime, this should be considered the host-triple. More explanation for why
1313
# this exists can be found on issue #2400
14-
export CFG_COMPILER
14+
export CFG_COMPILER_HOST_TRIPLE
1515

1616
# The standard libraries should be held up to a higher standard than any old
1717
# code, make sure that these common warnings are denied by default. These can
@@ -68,7 +68,7 @@ $(foreach host,$(CFG_HOST), \
6868
# $(4) is the crate name
6969
define RUST_TARGET_STAGE_N
7070

71-
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$(4): CFG_COMPILER = $(2)
71+
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$(4): CFG_COMPILER_HOST_TRIPLE = $(2)
7272
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$(4): \
7373
$$(CRATEFILE_$(4)) \
7474
$$(CRATE_FULLDEPS_$(1)_T_$(2)_H_$(3)_$(4)) \

mk/tests.mk

+2-2
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ ifdef CFG_WINDOWSY_$(1)
104104
stage2/$$(CFG_LIBDIR_RELATIVE), \
105105
$$(if $$(findstring stage3,$$(1)), \
106106
stage3/$$(CFG_LIBDIR_RELATIVE), \
107-
)))))/$$(CFG_RUSTLIBDIR)/$$(CFG_BUILD)/lib
107+
)))))/rustlib/$$(CFG_BUILD)/lib
108108
CFG_RUN_TEST_$(1)=$$(call CFG_RUN_$(1),$$(call CFG_TESTLIB_$(1),$$(1),$$(3)),$$(1))
109109
endif
110110

@@ -350,7 +350,7 @@ else
350350
TESTDEP_$(1)_$(2)_$(3)_$(4) = $$(RSINPUTS_$(4))
351351
endif
352352

353-
$(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2)): CFG_COMPILER = $(2)
353+
$(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2)): CFG_COMPILER_HOST_TRIPLE = $(2)
354354
$(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2)): \
355355
$$(CRATEFILE_$(4)) \
356356
$$(TESTDEP_$(1)_$(2)_$(3)_$(4))

0 commit comments

Comments
 (0)