ldap/admin/src/base-initconfig.in | 6 ++++ rpm.mk | 28 +++++++++++++++++--- rpm/389-ds-base.spec.in | 51 ++++++++++++++++++++++++++++++++++---- 3 files changed, 75 insertions(+), 10 deletions(-)
New commits: commit f132cf41805a9ff525f611967b88a6d85f520def Author: Mark Reynolds mreynolds@redhat.com Date: Wed Dec 16 15:19:24 2015 -0500
Ticket 48377 - Bundle jemalloc with Directory Server
Description: Updated spec files to download the latest supported version of jemalloc source code, and build it. Then include the library in the server's library directory (/usr/lib64/dirsrv). Also, the bundled jemalloc library can coexist with any existing jemalloc package. This allows us to control the supported version that we ship.
Then in /etc/sysconfig/dirsrv added a commented LD_PRELOAD line that is pre-set for the server.
Also fixed rpm.mk so that it looked at the proper spec file for nunc-stans and jemalloc configuraton.
https://fedorahosted.org/389/ticket/48377
Reviewed by: rmeggins, wibrown, and nhosoi(Thanks!!!)
diff --git a/ldap/admin/src/base-initconfig.in b/ldap/admin/src/base-initconfig.in index 2d47eb7..e803a36 100644 --- a/ldap/admin/src/base-initconfig.in +++ b/ldap/admin/src/base-initconfig.in @@ -42,3 +42,9 @@ # up before we assume there is a problem and fail to start # if using systemd, omit the "; export VARNAME" at the end #PID_TIME=600 ; export PID_TIME + +# jemalloc is a general purpose malloc implementation that emphasizes +# fragmentation avoidance and scalable concurrency support. jemalloc +# has been shown to have a significant positive impact on the Directory +# Server's process size/growth. +#LD_PRELOAD=@libdir@/@package_name@/libjemalloc.so.1 ; export LD_PRELOAD diff --git a/rpm.mk b/rpm.mk index aa397b7..4d89777 100644 --- a/rpm.mk +++ b/rpm.mk @@ -4,8 +4,12 @@ RPM_RELEASE ?= $(shell $(PWD)/rpm/rpmverrel.sh release) PACKAGE = 389-ds-base RPM_NAME_VERSION = $(PACKAGE)-$(RPM_VERSION) TARBALL = $(RPM_NAME_VERSION).tar.bz2 -NUNC_STANS_URL ?= $(shell rpmspec -P -D 'use_nunc_stans 1' $(PWD)/rpm/389-ds-base.spec.in | awk '/^Source3:/ {print $$2}') +NUNC_STANS_URL ?= $(shell rpmspec -P -D 'use_nunc_stans 1' $(RPMBUILD)/SPECS/389-ds-base.spec | awk '/^Source4:/ {print $$2}') NUNC_STANS_TARBALL ?= $(shell basename "$(NUNC_STANS_URL)") +JEMALLOC_URL ?= $(shell rpmspec -P $(RPMBUILD)/SPECS/389-ds-base.spec | awk '/^Source3:/ {print $$2}') +JEMALLOC_TARBALL ?= $(shell basename "$(JEMALLOC_URL)") +NUNC_STANS_ON = 1 +BUNDLE_JEMALLOC = 1
clean: rm -rf dist @@ -19,7 +23,13 @@ tarballs: local-archive -mkdir -p dist/sources cd dist; tar cfj sources/$(TARBALL) $(RPM_NAME_VERSION) rm -rf dist/$(RPM_NAME_VERSION) - cd dist/sources; wget $(NUNC_STANS_URL) + cd dist/sources ; \ + if [ $(NUNC_STANS_ON) -eq 1 ]; then \ + wget $(NUNC_STANS_URL) ; \ + fi ; \ + if [ $(BUNDLE_JEMALLOC) -eq 1 ]; then \ + wget $(JEMALLOC_URL) ; \ + fi
rpmroot: rm -rf $(RPMBUILD) @@ -28,6 +38,10 @@ rpmroot: mkdir -p $(RPMBUILD)/SOURCES mkdir -p $(RPMBUILD)/SPECS mkdir -p $(RPMBUILD)/SRPMS + sed -e s/__VERSION__/$(RPM_VERSION)/ -e s/__RELEASE__/$(RPM_RELEASE)/ \ + -e s/__NUNC_STANS_ON__/$(NUNC_STANS_ON)/ \ + -e s/__BUNDLE_JEMALLOC__/$(BUNDLE_JEMALLOC)/ \ + rpm/$(PACKAGE).spec.in > $(RPMBUILD)/SPECS/$(PACKAGE).spec
rpmdistdir: mkdir -p dist/rpms @@ -37,10 +51,14 @@ srpmdistdir:
rpmbuildprep: cp dist/sources/$(TARBALL) $(RPMBUILD)/SOURCES/ - cp dist/sources/$(NUNC_STANS_TARBALL) $(RPMBUILD)/SOURCES/ + if [ $(NUNC_STANS_ON) -eq 1 ]; then \ + cp dist/sources/$(NUNC_STANS_TARBALL) $(RPMBUILD)/SOURCES/ ; \ + fi + if [ $(BUNDLE_JEMALLOC) -eq 1 ]; then \ + cp dist/sources/$(JEMALLOC_TARBALL) $(RPMBUILD)/SOURCES/ ; \ + fi cp rpm/$(PACKAGE)-* $(RPMBUILD)/SOURCES/ - sed -e s/__VERSION__/$(RPM_VERSION)/ -e s/__RELEASE__/$(RPM_RELEASE)/ \ - rpm/$(PACKAGE).spec.in > $(RPMBUILD)/SPECS/$(PACKAGE).spec +
srpms: rpmroot srpmdistdir tarballs rpmbuildprep rpmbuild --define "_topdir $(RPMBUILD)" -bs $(RPMBUILD)/SPECS/$(PACKAGE).spec diff --git a/rpm/389-ds-base.spec.in b/rpm/389-ds-base.spec.in index ff85863..6e4bc48 100644 --- a/rpm/389-ds-base.spec.in +++ b/rpm/389-ds-base.spec.in @@ -12,13 +12,19 @@ # If perl-Socket-2.000 or newer is available, set 0 to use_Socket6. %global use_Socket6 0 # nunc-stans only builds on x86_64 for now -# To build without nunc-stans, set 0 to use_nunc_stans. +# To build without nunc-stans, set use_nunc_stans to 0. %global use_nunc_stans __NUNC_STANS_ON__ - %if %{use_nunc_stans} %global nunc_stans_ver 0.1.7 %endif
+# Are we bundling jemalloc? +%global bundle_jemalloc __BUNDLE_JEMALLOC__ +%if %{bundle_jemalloc} +# The version used in the source tarball +%global jemalloc_ver 3.6.0 +%endif + # fedora 15 and later uses tmpfiles.d # otherwise, comment this out %{!?with_tmpfiles_d: %global with_tmpfiles_d %{_sysconfdir}/tmpfiles.d} @@ -32,7 +38,6 @@ Summary: 389 Directory Server (base) Name: 389-ds-base Version: __VERSION__ -#Release: %{?relprefix}1%{?prerel}%{?dist} Release: __RELEASE__%{?dist} License: GPLv2 with exceptions URL: http://port389.org/ @@ -122,8 +127,12 @@ Source0: http://port389.org/sources/%%7Bname%7D-%%7Bversion%7D%%7B?prerel%7D.tar.bz # 389-ds-git.sh should be used to generate the source tarball from git Source1: %{name}-git.sh Source2: %{name}-devel.README + +%if %{bundle_jemalloc} +Source3: http://www.port389.org/binaries/jemalloc-%%7Bjemalloc_ver%7D.tar.bz2 +%endif %if %{use_nunc_stans} -Source3: https://git.fedorahosted.org/cgit/nunc-stans.git/snapshot/nunc-stans-%%7Bnun... +Source4: https://git.fedorahosted.org/cgit/nunc-stans.git/snapshot/nunc-stans-%%7Bnun... %endif
%description @@ -154,6 +163,12 @@ BuildRequires: libtalloc-devel BuildRequires: libevent-devel BuildRequires: libtevent-devel %endif +%if %{bundle_jemalloc} +BuildRequires: /usr/bin/xsltproc +%ifnarch s390 +BuildRequires: valgrind-devel +%endif +%endif
%description libs Core libraries for the 389 Directory Server base package. These libraries @@ -184,9 +199,13 @@ Development Libraries and headers for the 389 Directory Server base package.
%prep %setup -q -n %{name}-%{version}%{?prerel} -%if %{use_nunc_stans} + +%if %{bundle_jemalloc} %setup -q -n %{name}-%{version}%{?prerel} -T -D -b 3 %endif +%if %{use_nunc_stans} +%setup -q -n %{name}-%{version}%{?prerel} -T -D -b 4 +%endif cp %{SOURCE2} README.devel
%build @@ -201,6 +220,13 @@ cp nunc-stans.h include/nunc-stans/nunc-stans.h popd %endif
+%if %{bundle_jemalloc} +pushd ../jemalloc-%{jemalloc_ver} +%configure CFLAGS='%{optflags} -msse2' --libdir=%{_libdir}/%{pkgname} +make %{?_smp_mflags} +popd +%endif + %if %{use_openldap} OPENLDAP_FLAG="--with-openldap" %endif @@ -236,6 +262,12 @@ rm -rf $RPM_BUILD_ROOT%{_includedir} $RPM_BUILD_ROOT%{_datadir} \ popd %endif
+%if %{bundle_jemalloc} +pushd ../jemalloc-%{jemalloc_ver} +cp --preserve=links lib/libjemalloc.so* $RPM_BUILD_ROOT%{_libdir}/%{pkgname} +popd +%endif + make DESTDIR="$RPM_BUILD_ROOT" install
mkdir -p $RPM_BUILD_ROOT/var/log/%{pkgname} @@ -390,6 +422,9 @@ fi %if %{use_nunc_stans} %{_libdir}/%{pkgname}/libnunc-stans.so %endif +%if %{bundle_jemalloc} +%{_libdir}/%{pkgname}/libjemalloc.so +%endif %{_libdir}/pkgconfig/*
%files libs @@ -401,8 +436,14 @@ fi %if %{use_nunc_stans} %{_libdir}/%{pkgname}/libnunc-stans.so* %endif +%if %{bundle_jemalloc} +%{_libdir}/%{pkgname}/libjemalloc.so* +%endif
%changelog +* Mon Dec 14 2015 Mark Reynolds mreynolds@redhat.com - 1.3.4.1-2 +- Ticket 48377 - Include the jemalloc library + * Tue Jun 23 2015 Noriko Hosoi nhosoi@redhat.com - 1.3.4.1-1 - Release 1.3.4.1-1
389-commits@lists.fedoraproject.org