mk: Allow usage of a local jemalloc install

This adds a new configure option, --jemalloc-root, which will specify a location
at which libjemalloc_pic.a must live. This library is then used for the build
triple as the jemalloc library to link.
This commit is contained in:
Alex Crichton 2014-06-06 23:52:56 -07:00
parent fce98e5262
commit 145e415fab
2 changed files with 18 additions and 2 deletions

2
configure vendored
View File

@ -425,6 +425,7 @@ opt verify-install 1 "verify installed binaries work"
valopt prefix "/usr/local" "set installation prefix"
valopt local-rust-root "/usr/local" "set prefix for local rust binary"
valopt llvm-root "" "set LLVM root"
valopt jemalloc-root "" "set jemalloc root"
valopt android-cross-path "/opt/ndk_standalone" "Android NDK standalone path"
valopt mingw32-cross-path "" "MinGW32 cross compiler path"
@ -1198,6 +1199,7 @@ putvar CFG_ANDROID_CROSS_PATH
putvar CFG_MINGW32_CROSS_PATH
putvar CFG_MANDIR
putvar CFG_DISABLE_INJECT_STD_VERSION
putvar CFG_JEMALLOC_ROOT
# Avoid spurious warnings from clang by feeding it original source on
# ccache-miss rather than preprocessed input.

View File

@ -253,8 +253,9 @@ else
endif
JEMALLOC_LIB_$(1) := $$(RT_OUTPUT_DIR_$(1))/$$(JEMALLOC_NAME_$(1))
JEMALLOC_BUILD_DIR_$(1) := $$(RT_OUTPUT_DIR_$(1))/jemalloc
JEMALLOC_LOCAL_$(1) := $$(JEMALLOC_BUILD_DIR_$(1))/lib/$$(JEMALLOC_REAL_NAME_$(1))
$$(JEMALLOC_LIB_$(1)): $$(JEMALLOC_DEPS) $$(MKFILE_DEPS)
$$(JEMALLOC_LOCAL_$(1)): $$(JEMALLOC_DEPS) $$(MKFILE_DEPS)
@$$(call E, make: jemalloc)
cd "$$(JEMALLOC_BUILD_DIR_$(1))"; "$(S)src/jemalloc/configure" \
$$(JEMALLOC_ARGS_$(1)) --enable-cc-silence --with-jemalloc-prefix=je_ \
@ -265,7 +266,20 @@ $$(JEMALLOC_LIB_$(1)): $$(JEMALLOC_DEPS) $$(MKFILE_DEPS)
CPPFLAGS="-I $(S)src/rt/" \
EXTRA_CFLAGS="$$(CFG_CFLAGS_$(1)) -g1"
$$(Q)$$(MAKE) -C "$$(JEMALLOC_BUILD_DIR_$(1))" build_lib_static
$$(Q)cp $$(JEMALLOC_BUILD_DIR_$(1))/lib/$$(JEMALLOC_REAL_NAME_$(1)) $$(JEMALLOC_LIB_$(1))
ifeq ($(1),$$(CFG_BUILD))
ifneq ($$(CFG_JEMALLOC_ROOT),)
$$(JEMALLOC_LIB_$(1)): $$(CFG_JEMALLOC_ROOT)/libjemalloc_pic.a
@$$(call E, copy: jemalloc)
$$(Q)cp $$< $$@
else
$$(JEMALLOC_LIB_$(1)):
$$(Q)cp $$< $$@
endif
else
$$(JEMALLOC_LIB_$(1)):
$$(Q)cp $$< $$@
endif
################################################################################
# compiler-rt