Skip to content

Commit

Permalink
build: Add support for linking against a system libjemalloc
Browse files Browse the repository at this point in the history
Add a new USE_SYSTEM_JEMALLOC make variable to select whether to link
against the system libjemalloc.
  • Loading branch information
guillemj authored and JohnSully committed Mar 26, 2024
1 parent 10c63d7 commit ae130d1
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 108 deletions.
2 changes: 2 additions & 0 deletions deps/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ distclean:
-(cd hiredis && $(MAKE) clean) > /dev/null || true
-(cd linenoise && $(MAKE) clean) > /dev/null || true
-(cd lua && $(MAKE) clean) > /dev/null || true
ifneq ($(USE_SYSTEM_JEMALLOC),yes)
-(cd jemalloc && [ -f Makefile ] && $(MAKE) distclean) > /dev/null || true
endif
-(cd rocksdb && $(MAKE) clean) > /dev/null || true
-(cd hdr_histogram && $(MAKE) clean) > /dev/null || true
-(rm -f .make-*)
Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion pkg/deb/debian_dh9/patches/series
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#debian-packaging/0003-dpkg-buildflags.patch
#debian-packaging/0007-Set-Debian-configuration-defaults.patch
#0010-Use-get_current_dir_name-over-PATHMAX-etc.patch
#0010-Add-support-for-USE_SYSTEM_JEMALLOC-flag.patch
#0011-Add-support-for-a-USE_SYSTEM_LUA-flag.patch
#0007-Add-support-for-a-USE_SYSTEM_HIREDIS-flag.patch
#test
7 changes: 7 additions & 0 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -317,11 +317,17 @@ ifeq ($(MALLOC),tcmalloc_minimal)
endif

ifeq ($(MALLOC),jemalloc)
ifeq ($(USE_SYSTEM_JEMALLOC),yes)
FINAL_CFLAGS+= -DUSE_JEMALLOC $(shell $(PKG_CONFIG) --cflags jemalloc)
FINAL_CXXFLAGS+= -DUSE_JEMALLOC $(shell $(PKG_CONFIG) --cflags jemalloc)
FINAL_LIBS := $(shell $(PKG_CONFIG) --libs jemalloc) $(FINAL_LIBS)
else
DEPENDENCY_TARGETS+= jemalloc
FINAL_CFLAGS+= -DUSE_JEMALLOC -I../deps/jemalloc/include
FINAL_CXXFLAGS+= -DUSE_JEMALLOC -I../deps/jemalloc/include
FINAL_LIBS := ../deps/jemalloc/lib/libjemalloc.a $(FINAL_LIBS)
endif
endif

ifeq ($(MALLOC),memkind)
DEPENDENCY_TARGETS+= memkind
Expand Down Expand Up @@ -422,6 +428,7 @@ persist-settings: distclean
echo OPT=$(OPT) >> .make-settings
echo USE_SYSTEM_CONCURRENTQUEUE=$(USE_SYSTEM_CONCURRENTQUEUE) >> .make-settings
echo MALLOC=$(MALLOC) >> .make-settings
echo USE_SYSTEM_JEMALLOC=$(USE_SYSTEM_JEMALLOC) >> .make-settings
echo BUILD_TLS=$(BUILD_TLS) >> .make-settings
echo USE_SYSTEMD=$(USE_SYSTEMD) >> .make-settings
echo CFLAGS=$(CFLAGS) >> .make-settings
Expand Down

0 comments on commit ae130d1

Please sign in to comment.