Skip to content

Commit ae130d1

Browse files
guillemjJohnSully
authored andcommitted
build: Add support for linking against a system libjemalloc
Add a new USE_SYSTEM_JEMALLOC make variable to select whether to link against the system libjemalloc.
1 parent 10c63d7 commit ae130d1

File tree

4 files changed

+9
-108
lines changed

4 files changed

+9
-108
lines changed

deps/Makefile

+2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ distclean:
3737
-(cd hiredis && $(MAKE) clean) > /dev/null || true
3838
-(cd linenoise && $(MAKE) clean) > /dev/null || true
3939
-(cd lua && $(MAKE) clean) > /dev/null || true
40+
ifneq ($(USE_SYSTEM_JEMALLOC),yes)
4041
-(cd jemalloc && [ -f Makefile ] && $(MAKE) distclean) > /dev/null || true
42+
endif
4143
-(cd rocksdb && $(MAKE) clean) > /dev/null || true
4244
-(cd hdr_histogram && $(MAKE) clean) > /dev/null || true
4345
-(rm -f .make-*)

pkg/deb/debian_dh9/patches/0010-Add-support-for-USE_SYSTEM_JEMALLOC-flag.patch

-107
This file was deleted.

pkg/deb/debian_dh9/patches/series

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#debian-packaging/0003-dpkg-buildflags.patch
33
#debian-packaging/0007-Set-Debian-configuration-defaults.patch
44
#0010-Use-get_current_dir_name-over-PATHMAX-etc.patch
5-
#0010-Add-support-for-USE_SYSTEM_JEMALLOC-flag.patch
65
#0011-Add-support-for-a-USE_SYSTEM_LUA-flag.patch
76
#0007-Add-support-for-a-USE_SYSTEM_HIREDIS-flag.patch
87
#test

src/Makefile

+7
Original file line numberDiff line numberDiff line change
@@ -317,11 +317,17 @@ ifeq ($(MALLOC),tcmalloc_minimal)
317317
endif
318318

319319
ifeq ($(MALLOC),jemalloc)
320+
ifeq ($(USE_SYSTEM_JEMALLOC),yes)
321+
FINAL_CFLAGS+= -DUSE_JEMALLOC $(shell $(PKG_CONFIG) --cflags jemalloc)
322+
FINAL_CXXFLAGS+= -DUSE_JEMALLOC $(shell $(PKG_CONFIG) --cflags jemalloc)
323+
FINAL_LIBS := $(shell $(PKG_CONFIG) --libs jemalloc) $(FINAL_LIBS)
324+
else
320325
DEPENDENCY_TARGETS+= jemalloc
321326
FINAL_CFLAGS+= -DUSE_JEMALLOC -I../deps/jemalloc/include
322327
FINAL_CXXFLAGS+= -DUSE_JEMALLOC -I../deps/jemalloc/include
323328
FINAL_LIBS := ../deps/jemalloc/lib/libjemalloc.a $(FINAL_LIBS)
324329
endif
330+
endif
325331

326332
ifeq ($(MALLOC),memkind)
327333
DEPENDENCY_TARGETS+= memkind
@@ -422,6 +428,7 @@ persist-settings: distclean
422428
echo OPT=$(OPT) >> .make-settings
423429
echo USE_SYSTEM_CONCURRENTQUEUE=$(USE_SYSTEM_CONCURRENTQUEUE) >> .make-settings
424430
echo MALLOC=$(MALLOC) >> .make-settings
431+
echo USE_SYSTEM_JEMALLOC=$(USE_SYSTEM_JEMALLOC) >> .make-settings
425432
echo BUILD_TLS=$(BUILD_TLS) >> .make-settings
426433
echo USE_SYSTEMD=$(USE_SYSTEMD) >> .make-settings
427434
echo CFLAGS=$(CFLAGS) >> .make-settings

0 commit comments

Comments
 (0)