Skip to content

Commit 88894b6

Browse files
committed
Add support for building with a static libstd for testing static crate support.
1 parent 7a919da commit 88894b6

File tree

4 files changed

+23
-2
lines changed

4 files changed

+23
-2
lines changed

Makefile.in

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ CFG_RUSTLLVM :=$(call CFG_LIB_NAME,rustllvm)
4949
CFG_STDLIB :=$(call CFG_LIB_NAME,std)
5050
CFG_LIBRUSTC :=$(call CFG_LIB_NAME,rustc)
5151

52+
ifdef CFG_DISABLE_SHAREDSTD
53+
CFG_STDLIB_DEFAULT := lib/libstd.rlib
54+
else
55+
CFG_STDLIB_DEFAULT := $(CFG_STDLIB)
56+
endif
57+
5258
# version-string calculation
5359
CFG_GIT_DIR := $(CFG_SRC_DIR).git
5460
CFG_VERSION = prerelease
@@ -156,15 +162,26 @@ LLC := $(CFG_LLVM_BINDIR)/llc$(X)
156162
######################################################################
157163

158164
define SREQ
165+
ifdef CFG_DISABLE_SHAREDSTD
166+
SREQ$(1) = stage$(1)/rustc$(X) \
167+
stage$(1)/$$(CFG_RUNTIME) \
168+
stage$(1)/$$(CFG_STDLIB_DEFAULT) \
169+
stage$(1)/$$(CFG_RUSTLLVM) \
170+
stage$(1)/lib/glue.o \
171+
stage$(1)/lib/main.o \
172+
stage$(1)/lib/$$(CFG_RUNTIME) \
173+
$$(MKFILES)
174+
else
159175
SREQ$(1) = stage$(1)/rustc$(X) \
160176
stage$(1)/$$(CFG_RUNTIME) \
161-
stage$(1)/$$(CFG_STDLIB) \
177+
stage$(1)/$$(CFG_STDLIB_DEFAULT) \
162178
stage$(1)/$$(CFG_RUSTLLVM) \
163179
stage$(1)/lib/glue.o \
164180
stage$(1)/lib/main.o \
165181
stage$(1)/lib/$$(CFG_RUNTIME) \
166182
stage$(1)/lib/$$(CFG_STDLIB) \
167183
$$(MKFILES)
184+
endif
168185

169186
STAGE$(1) := $$(Q)$$(call CFG_RUN_TARG,stage$(1),stage$(1), \
170187
$$(CFG_VALGRIND_COMPILE) stage$(1)/rustc$$(X) \

configure

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ else
162162
step_msg "processing $CFG_SELF args"
163163
fi
164164

165+
opt sharedstd 1 "build libstd as a shared library"
165166
opt valgrind 1 "run tests with valgrind"
166167
opt docs 1 "build documentation"
167168
opt optimize 1 "build optimized rust code"

mk/stage0.mk

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,6 @@ stage0/lib/$(CFG_RUNTIME): stage0/rustc$(X)
3333

3434
stage0/lib/$(CFG_STDLIB): stage0/rustc$(X)
3535
$(Q)touch $@
36+
37+
stage0/lib/libstd.rlib: stage0/rustc$(X)
38+
$(Q)touch $@

mk/stageN.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ stage$(2)/%.o: stage$(2)/%.s
2323

2424
stage$(2)/rustc$$(X): $$(COMPILER_CRATE) $$(COMPILER_INPUTS) \
2525
stage$(2)/$$(CFG_RUNTIME) \
26-
stage$(2)/$$(CFG_STDLIB) \
26+
stage$(1)/$$(CFG_STDLIB_DEFAULT) \
2727
stage$(2)/$$(CFG_RUSTLLVM) \
2828
$$(SREQ$(1))
2929
@$$(call E, compile_and_link: $$@)

0 commit comments

Comments
 (0)