Skip to content

Commit 145e415

Browse files
committed
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.
1 parent fce98e5 commit 145e415

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

configure

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,7 @@ opt verify-install 1 "verify installed binaries work"
425425
valopt prefix "/usr/local" "set installation prefix"
426426
valopt local-rust-root "/usr/local" "set prefix for local rust binary"
427427
valopt llvm-root "" "set LLVM root"
428+
valopt jemalloc-root "" "set jemalloc root"
428429
valopt android-cross-path "/opt/ndk_standalone" "Android NDK standalone path"
429430
valopt mingw32-cross-path "" "MinGW32 cross compiler path"
430431

@@ -1198,6 +1199,7 @@ putvar CFG_ANDROID_CROSS_PATH
11981199
putvar CFG_MINGW32_CROSS_PATH
11991200
putvar CFG_MANDIR
12001201
putvar CFG_DISABLE_INJECT_STD_VERSION
1202+
putvar CFG_JEMALLOC_ROOT
12011203

12021204
# Avoid spurious warnings from clang by feeding it original source on
12031205
# ccache-miss rather than preprocessed input.

mk/rt.mk

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,9 @@ else
253253
endif
254254
JEMALLOC_LIB_$(1) := $$(RT_OUTPUT_DIR_$(1))/$$(JEMALLOC_NAME_$(1))
255255
JEMALLOC_BUILD_DIR_$(1) := $$(RT_OUTPUT_DIR_$(1))/jemalloc
256+
JEMALLOC_LOCAL_$(1) := $$(JEMALLOC_BUILD_DIR_$(1))/lib/$$(JEMALLOC_REAL_NAME_$(1))
256257

257-
$$(JEMALLOC_LIB_$(1)): $$(JEMALLOC_DEPS) $$(MKFILE_DEPS)
258+
$$(JEMALLOC_LOCAL_$(1)): $$(JEMALLOC_DEPS) $$(MKFILE_DEPS)
258259
@$$(call E, make: jemalloc)
259260
cd "$$(JEMALLOC_BUILD_DIR_$(1))"; "$(S)src/jemalloc/configure" \
260261
$$(JEMALLOC_ARGS_$(1)) --enable-cc-silence --with-jemalloc-prefix=je_ \
@@ -265,7 +266,20 @@ $$(JEMALLOC_LIB_$(1)): $$(JEMALLOC_DEPS) $$(MKFILE_DEPS)
265266
CPPFLAGS="-I $(S)src/rt/" \
266267
EXTRA_CFLAGS="$$(CFG_CFLAGS_$(1)) -g1"
267268
$$(Q)$$(MAKE) -C "$$(JEMALLOC_BUILD_DIR_$(1))" build_lib_static
268-
$$(Q)cp $$(JEMALLOC_BUILD_DIR_$(1))/lib/$$(JEMALLOC_REAL_NAME_$(1)) $$(JEMALLOC_LIB_$(1))
269+
270+
ifeq ($(1),$$(CFG_BUILD))
271+
ifneq ($$(CFG_JEMALLOC_ROOT),)
272+
$$(JEMALLOC_LIB_$(1)): $$(CFG_JEMALLOC_ROOT)/libjemalloc_pic.a
273+
@$$(call E, copy: jemalloc)
274+
$$(Q)cp $$< $$@
275+
else
276+
$$(JEMALLOC_LIB_$(1)):
277+
$$(Q)cp $$< $$@
278+
endif
279+
else
280+
$$(JEMALLOC_LIB_$(1)):
281+
$$(Q)cp $$< $$@
282+
endif
269283

270284
################################################################################
271285
# compiler-rt

0 commit comments

Comments
 (0)