From 59378174a90799c8bf4151deb99b472d1750415a Mon Sep 17 00:00:00 2001 From: Nathan Scott Date: Tue, 26 Sep 2017 17:43:26 +1000 Subject: [PATCH] Incorporate recent feedback from Remi, build once Drop modification of the configuration file to add systemd supervision - Remi correctly points out this is redundant (due to unit files already overriding) and will just cause issues. Noticed the build runs twice also, once during the %build phase and once again during %install (full rebuild) - this was because of differing options on the make lines (CFLAGS= etc vs PREFIX= etc) and the Redis src/Makefile causes full rebuild as a result (including of deps/* which it "make distclean"s). Also fixed a rpmbuild "warning: Macro expanded in comment" message in a couple of places, and changed the way we squash hidden build messages to use the "V" macro as the Makefiles intended. --- redis.spec | 38 ++++++++++---------------------------- 1 file changed, 10 insertions(+), 28 deletions(-) diff --git a/redis.spec b/redis.spec index f223225..654e612 100644 --- a/redis.spec +++ b/redis.spec @@ -32,8 +32,8 @@ Source6: %{name}-shutdown Source7: %{name}-limit-systemd Source8: %{name}-limit-init # To refresh patches: -# tar xf redis-xxx.tar.gz && cd redis-xxx && git init && git add . && git commit -m "%{version} baseline" -# git am %{patches} +# tar xf redis-xxx.tar.gz && cd redis-xxx && git init && git add . && git commit -m "%%{version} baseline" +# git am %%{patches} # Then refresh your patches # git format-patch HEAD~ # Update configuration for Fedora @@ -116,45 +116,27 @@ rm -frv deps/jemalloc %patch0001 -p1 %patch0002 -p1 -# No hidden build. -sed -i -e 's|\t@|\t|g' deps/lua/src/Makefile -sed -i -e 's|$(QUIET_CC)||g' src/Makefile -sed -i -e 's|$(QUIET_LINK)||g' src/Makefile -sed -i -e 's|$(QUIET_INSTALL)||g' src/Makefile # Use system jemalloc library sed -i -e '/cd jemalloc && /d' deps/Makefile sed -i -e 's|../deps/jemalloc/lib/libjemalloc.a|-ljemalloc -ldl|g' src/Makefile sed -i -e 's|-I../deps/jemalloc.*|-DJEMALLOC_NO_DEMANGLE -I/usr/include/jemalloc|g' src/Makefile -# Ensure deps are built with proper flags -sed -i -e 's|$(CFLAGS)|%{optflags} -fPIC|g' deps/Makefile -sed -i -e 's|OPTIMIZATION?=-O3|OPTIMIZATION=%{optflags}|g' deps/hiredis/Makefile -sed -i -e 's|$(LDFLAGS)|%{?__global_ldflags}|g' deps/hiredis/Makefile -sed -i -e 's|$(CFLAGS)|%{optflags} -fPIC|g' deps/linenoise/Makefile -sed -i -e 's|$(LDFLAGS)|%{?__global_ldflags}|g' deps/linenoise/Makefile # Configuration file changes and additions sed -i -e 's|^logfile .*$|logfile /var/log/redis/redis.log|g' redis.conf sed -i -e '$ alogfile /var/log/redis/sentinel.log' sentinel.conf sed -i -e 's|^dir .*$|dir /var/lib/redis|g' redis.conf -%if 0%{?with_systemd} -sed -i -e 's|^supervised .*$|supervised systemd|g' redis.conf -sed -i -e '$ asupervised systemd|g' sentinel.conf + +%if 0%{?with_perftools} +%global malloc_flags MALLOC=tcmalloc +%else +%global malloc_flags MALLOC=jemalloc %endif +%global make_flags DEBUG="" V="echo" LDFLAGS="%{?__global_ldflags}" CFLAGS+="%{optflags} -fPIC" %{malloc_flags} LUA_LDFLAGS+="%{?__global_ldflags}" INSTALL="install -p" PREFIX=%{buildroot}%{_prefix} %build -make %{?_smp_mflags} \ - DEBUG="" \ - LDFLAGS="%{?__global_ldflags}" \ - CFLAGS+="%{optflags} -fPIC" \ - LUA_LDFLAGS+="%{?__global_ldflags}" \ -%if 0%{?with_perftools} - MALLOC=tcmalloc \ -%else - MALLOC=jemalloc \ -%endif - all +make %{?_smp_mflags} %{make_flags} all %install -make install INSTALL="install -p" PREFIX=%{buildroot}%{_prefix} +make %{make_flags} install # Filesystem. install -d %{buildroot}%{_sharedstatedir}/%{name}