From 88894b6f9ca8b276e194efaf2c5c60865fdba0eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20=C3=81vila=20de=20Esp=C3=ADndola?= Date: Wed, 20 Jul 2011 16:02:36 -0400 Subject: [PATCH] Add support for building with a static libstd for testing static crate support. --- Makefile.in | 19 ++++++++++++++++++- configure | 1 + mk/stage0.mk | 3 +++ mk/stageN.mk | 2 +- 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/Makefile.in b/Makefile.in index 5f609db588d..a52df01ab37 100644 --- a/Makefile.in +++ b/Makefile.in @@ -49,6 +49,12 @@ CFG_RUSTLLVM :=$(call CFG_LIB_NAME,rustllvm) CFG_STDLIB :=$(call CFG_LIB_NAME,std) CFG_LIBRUSTC :=$(call CFG_LIB_NAME,rustc) +ifdef CFG_DISABLE_SHAREDSTD + CFG_STDLIB_DEFAULT := lib/libstd.rlib +else + CFG_STDLIB_DEFAULT := $(CFG_STDLIB) +endif + # version-string calculation CFG_GIT_DIR := $(CFG_SRC_DIR).git CFG_VERSION = prerelease @@ -156,15 +162,26 @@ LLC := $(CFG_LLVM_BINDIR)/llc$(X) ###################################################################### define SREQ +ifdef CFG_DISABLE_SHAREDSTD SREQ$(1) = stage$(1)/rustc$(X) \ stage$(1)/$$(CFG_RUNTIME) \ - stage$(1)/$$(CFG_STDLIB) \ + stage$(1)/$$(CFG_STDLIB_DEFAULT) \ + stage$(1)/$$(CFG_RUSTLLVM) \ + stage$(1)/lib/glue.o \ + stage$(1)/lib/main.o \ + stage$(1)/lib/$$(CFG_RUNTIME) \ + $$(MKFILES) +else +SREQ$(1) = stage$(1)/rustc$(X) \ + stage$(1)/$$(CFG_RUNTIME) \ + stage$(1)/$$(CFG_STDLIB_DEFAULT) \ stage$(1)/$$(CFG_RUSTLLVM) \ stage$(1)/lib/glue.o \ stage$(1)/lib/main.o \ stage$(1)/lib/$$(CFG_RUNTIME) \ stage$(1)/lib/$$(CFG_STDLIB) \ $$(MKFILES) +endif STAGE$(1) := $$(Q)$$(call CFG_RUN_TARG,stage$(1),stage$(1), \ $$(CFG_VALGRIND_COMPILE) stage$(1)/rustc$$(X) \ diff --git a/configure b/configure index f14c92de399..e89ad4ee939 100755 --- a/configure +++ b/configure @@ -162,6 +162,7 @@ else step_msg "processing $CFG_SELF args" fi +opt sharedstd 1 "build libstd as a shared library" opt valgrind 1 "run tests with valgrind" opt docs 1 "build documentation" opt optimize 1 "build optimized rust code" diff --git a/mk/stage0.mk b/mk/stage0.mk index c01b8045e13..0adb220544f 100644 --- a/mk/stage0.mk +++ b/mk/stage0.mk @@ -33,3 +33,6 @@ stage0/lib/$(CFG_RUNTIME): stage0/rustc$(X) stage0/lib/$(CFG_STDLIB): stage0/rustc$(X) $(Q)touch $@ + +stage0/lib/libstd.rlib: stage0/rustc$(X) + $(Q)touch $@ diff --git a/mk/stageN.mk b/mk/stageN.mk index 48aee68b45e..6390ac79cc0 100644 --- a/mk/stageN.mk +++ b/mk/stageN.mk @@ -23,7 +23,7 @@ stage$(2)/%.o: stage$(2)/%.s stage$(2)/rustc$$(X): $$(COMPILER_CRATE) $$(COMPILER_INPUTS) \ stage$(2)/$$(CFG_RUNTIME) \ - stage$(2)/$$(CFG_STDLIB) \ + stage$(1)/$$(CFG_STDLIB_DEFAULT) \ stage$(2)/$$(CFG_RUSTLLVM) \ $$(SREQ$(1)) @$$(call E, compile_and_link: $$@)