From 4fb41b50de92b433e096c97fb782f8cc89add34e Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Mon, 8 Apr 2019 19:58:15 +0200 Subject: [PATCH] Only ever build primary arch. Put tools under libexec. --- valgrind-3.14.0-pkglibexecdir.patch | 117 ++++++++++++++++++++++++++++ valgrind.spec | 98 ++++++----------------- 2 files changed, 142 insertions(+), 73 deletions(-) create mode 100644 valgrind-3.14.0-pkglibexecdir.patch diff --git a/valgrind-3.14.0-pkglibexecdir.patch b/valgrind-3.14.0-pkglibexecdir.patch new file mode 100644 index 0000000..cd52729 --- /dev/null +++ b/valgrind-3.14.0-pkglibexecdir.patch @@ -0,0 +1,117 @@ +diff --git a/Makefile.all.am b/Makefile.all.am +index 3786e34..1befef5 100644 +--- a/Makefile.all.am ++++ b/Makefile.all.am +@@ -50,20 +50,20 @@ inplace-noinst_DSYMS: build-noinst_DSYMS + done + + # This is used by coregrind/Makefile.am and by /Makefile.am for doing +-# "make install". It copies $(noinst_PROGRAMS) into $prefix/lib/valgrind/. ++# "make install". It copies $(noinst_PROGRAMS) into $prefix/libexec/valgrind/. + # It needs to be depended on by an 'install-exec-local' rule. + install-noinst_PROGRAMS: $(noinst_PROGRAMS) +- $(mkinstalldirs) $(DESTDIR)$(pkglibdir); \ ++ $(mkinstalldirs) $(DESTDIR)$(pkglibexecdir); \ + for f in $(noinst_PROGRAMS); do \ +- $(INSTALL_PROGRAM) $$f $(DESTDIR)$(pkglibdir); \ ++ $(INSTALL_PROGRAM) $$f $(DESTDIR)$(pkglibexecdir); \ + done + + # This is used by coregrind/Makefile.am and by /Makefile.am for doing +-# "make uninstall". It removes $(noinst_PROGRAMS) from $prefix/lib/valgrind/. ++# "make uninstall". It removes $(noinst_PROGRAMS) from $prefix/libexec/valgrind/. + # It needs to be depended on by an 'uninstall-local' rule. + uninstall-noinst_PROGRAMS: + for f in $(noinst_PROGRAMS); do \ +- rm -f $(DESTDIR)$(pkglibdir)/$$f; \ ++ rm -f $(DESTDIR)$(pkglibexecdir)/$$f; \ + done + + # Similar to install-noinst_PROGRAMS. +@@ -71,15 +71,15 @@ uninstall-noinst_PROGRAMS: + # directories. XXX: not sure whether the resulting permissions will be + # correct when using 'cp -R'... + install-noinst_DSYMS: build-noinst_DSYMS +- $(mkinstalldirs) $(DESTDIR)$(pkglibdir); \ ++ $(mkinstalldirs) $(DESTDIR)$(pkglibexecdir); \ + for f in $(noinst_DSYMS); do \ +- cp -R $$f.dSYM $(DESTDIR)$(pkglibdir); \ ++ cp -R $$f.dSYM $(DESTDIR)$(pkglibexecdir); \ + done + + # Similar to uninstall-noinst_PROGRAMS. + uninstall-noinst_DSYMS: + for f in $(noinst_DSYMS); do \ +- rm -f $(DESTDIR)$(pkglibdir)/$$f.dSYM; \ ++ rm -f $(DESTDIR)$(pkglibexecdir)/$$f.dSYM; \ + done + + # This needs to be depended on by a 'clean-local' rule. +diff --git a/Makefile.am b/Makefile.am +index 242b38a..3b7c806 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -58,7 +58,7 @@ DEFAULT_SUPP_FILES = @DEFAULT_SUPP@ + # default.supp, as it is built from the base .supp files at compile-time. + dist_noinst_DATA = $(SUPP_FILES) + +-vglibdir = $(pkglibdir) ++vglibdir = $(pkglibexecdir) + vglib_DATA = default.supp + + pkgconfigdir = $(libdir)/pkgconfig +diff --git a/coregrind/Makefile.am b/coregrind/Makefile.am +index 94030fd..f09763a 100644 +--- a/coregrind/Makefile.am ++++ b/coregrind/Makefile.am +@@ -11,12 +11,12 @@ include $(top_srcdir)/Makefile.all.am + + AM_CPPFLAGS_@VGCONF_PLATFORM_PRI_CAPS@ += \ + -I$(top_srcdir)/coregrind \ +- -DVG_LIBDIR="\"$(pkglibdir)"\" \ ++ -DVG_LIBDIR="\"$(pkglibexecdir)"\" \ + -DVG_PLATFORM="\"@VGCONF_ARCH_PRI@-@VGCONF_OS@\"" + if VGCONF_HAVE_PLATFORM_SEC + AM_CPPFLAGS_@VGCONF_PLATFORM_SEC_CAPS@ += \ + -I$(top_srcdir)/coregrind \ +- -DVG_LIBDIR="\"$(pkglibdir)"\" \ ++ -DVG_LIBDIR="\"$(pkglibexecdir)"\" \ + -DVG_PLATFORM="\"@VGCONF_ARCH_SEC@-@VGCONF_OS@\"" + endif + +@@ -714,7 +714,7 @@ GDBSERVER_XML_FILES = \ + m_gdbserver/mips64-fpu.xml + + # so as to make sure these get copied into the install tree +-vglibdir = $(pkglibdir) ++vglibdir = $(pkglibexecdir) + vglib_DATA = $(GDBSERVER_XML_FILES) + + # so as to make sure these get copied into the tarball +diff --git a/mpi/Makefile.am b/mpi/Makefile.am +index 7ad9a25..471fee0 100644 +--- a/mpi/Makefile.am ++++ b/mpi/Makefile.am +@@ -18,16 +18,18 @@ EXTRA_DIST = \ + # libmpiwrap-.so + #---------------------------------------------------------------------------- + +-noinst_PROGRAMS = ++# These are really real libraries, so they should go to libdir, not libexec. ++mpidir = $(pkglibdir) ++mpi_PROGRAMS = + if BUILD_MPIWRAP_PRI +-noinst_PROGRAMS += libmpiwrap-@VGCONF_ARCH_PRI@-@VGCONF_OS@.so ++mpi_PROGRAMS += libmpiwrap-@VGCONF_ARCH_PRI@-@VGCONF_OS@.so + endif + if BUILD_MPIWRAP_SEC +-noinst_PROGRAMS += libmpiwrap-@VGCONF_ARCH_SEC@-@VGCONF_OS@.so ++mpi_PROGRAMS += libmpiwrap-@VGCONF_ARCH_SEC@-@VGCONF_OS@.so + endif + + if VGCONF_OS_IS_DARWIN +-noinst_DSYMS = $(noinst_PROGRAMS) ++mpi_DSYMS = $(mpi_PROGRAMS) + endif + + diff --git a/valgrind.spec b/valgrind.spec index b22a432..baf3eeb 100644 --- a/valgrind.spec +++ b/valgrind.spec @@ -14,29 +14,6 @@ URL: http://www.valgrind.org/ %{?scl:%global is_scl 1} %{!?scl:%global is_scl 0} -# Only arches that are supported upstream as multilib and that the distro -# has multilib builds for should set build_multilib 1. In practice that -# is only x86_64 and ppc64 (but not in fedora 21 and later, and never -# for ppc64le or when building for scl). -%global build_multilib 0 - -%ifarch x86_64 - %global build_multilib 1 -%endif - -%ifarch ppc64 - %if %{is_scl} - %global build_multilib 0 - %else - %if 0%{?rhel} - %global build_multilib 1 - %endif - %if 0%{?fedora} - %global build_multilib (%fedora < 21) - %endif - %endif -%endif - # We never want the openmpi subpackage when building a software collecton. # We always want it for fedora. # We only want it for older rhel. @@ -184,11 +161,11 @@ Patch38: valgrind-3.14.0-ppc64-quotactl.patch # SW#6399 glibc might implement gettid itself, rename to gettid_sys. Patch39: valgrind-3.14.0-gettid.patch +# We want all executables and libraries in libexec instead of lib +# so they are only available for valgrind usage itself and so the +# same directory is used independent of arch. +Patch40: valgrind-3.14.0-pkglibexecdir.patch -%if %{build_multilib} -# Ensure glibc{,-devel} is installed for both multilib arches -BuildRequires: /lib/libc.so.6 /usr/lib/libc.so /lib64/libc.so.6 /usr/lib64/libc.so -%endif %if 0%{?fedora} >= 15 BuildRequires: glibc-devel >= 2.14 @@ -239,41 +216,40 @@ ExclusiveArch: %{valgrind_arches} %else ExclusiveArch: %{ix86} x86_64 ppc ppc64 ppc64le s390x armv7hl aarch64 %endif + +# Define valarch, the architecture name that valgrind uses +# And only_arch, the configure option to only build for that arch. %ifarch %{ix86} %define valarch x86 -%define valsecarch %{nil} +%define only_arch --enable-only32bit %endif %ifarch x86_64 %define valarch amd64 -%define valsecarch x86 +%define only_arch --enable-only64bit %endif %ifarch ppc %define valarch ppc32 -%define valsecarch %{nil} +%define only_arch --enable-only32bit %endif %ifarch ppc64 - %define valarch ppc64be - %if %{build_multilib} - %define valsecarch ppc32 - %else - %define valsecarch %{nil} - %endif +%define valarch ppc64be +%define only_arch --enable-only64bit %endif %ifarch ppc64le %define valarch ppc64le -%define valsecarch %{nil} +%define only_arch --enable-only64bit %endif %ifarch s390x %define valarch s390x -%define valsecarch %{nil} +%define only_arch --enable-only64bit %endif %ifarch armv7hl %define valarch arm -%define valsecarch %{nil} +%define only_arch --enable-only32bit %endif %ifarch aarch64 %define valarch arm64 -%define valsecarch %{nil} +%define only_arch --enable-only64bit %endif %description @@ -357,16 +333,10 @@ Valgrind User Manual for details. %patch37 -p1 %patch38 -p1 %patch39 -p1 +%patch40 -p1 %build CC=gcc -%if %{build_multilib} -# Ugly hack - libgcc 32-bit package might not be installed -mkdir -p shared/libgcc/32 -ar r shared/libgcc/32/libgcc_s.a -ar r shared/libgcc/libgcc_s_32.a -CC="gcc -B `pwd`/shared/libgcc/" -%endif # Some patches (might) touch Makefile.am or configure.ac files. # Just always autoreconf so we don't need patches to prebuild files. @@ -398,6 +368,7 @@ CC="gcc -B `pwd`/shared/libgcc/" OPTFLAGS="`echo " %{optflags} " | sed 's/ -m\(64\|3[21]\) / /g;s/ -fexceptions / /g;s/ -fstack-protector\([-a-z]*\) / / g;s/ -Wp,-D_FORTIFY_SOURCE=2 / /g;s/ -O2 / /g;s/ -mcpu=\([a-z0-9]\+\) / /g;s/^ //;s/ $//'`" %configure CC="$CC" CFLAGS="$OPTFLAGS" CXXFLAGS="$OPTFLAGS" \ --with-mpicc=%{mpiccpath} \ + %{only_arch} \ GDB=%{_bindir}/gdb make %{?_smp_mflags} @@ -440,18 +411,6 @@ ln -s ../openmpi/valgrind/libmpiwrap-%{valarch}-linux.so popd %endif -%if "%{valsecarch}" != "" -pushd $RPM_BUILD_ROOT%{_libdir}/valgrind/ -rm -f *-%{valsecarch}-* || : -for i in *-%{valarch}-*; do - j=`echo $i | sed 's/-%{valarch}-/-%{valsecarch}-/'` - ln -sf ../../lib/valgrind/$j $j -done -popd -%endif - -rm -f $RPM_BUILD_ROOT%{_libdir}/valgrind/*.supp.in - %if %{build_tools_devel} %ifarch %{ix86} x86_64 # To avoid multilib clashes in between i?86 and x86_64, @@ -478,7 +437,7 @@ rm $RPM_BUILD_ROOT%{_libdir}/valgrind/*.a # We don't want debuginfo generated for the vgpreload libraries. # Turn off execute bit so they aren't included in the debuginfo.list. # We'll turn the execute bit on again in %%files. -chmod 644 $RPM_BUILD_ROOT%{_libdir}/valgrind/vgpreload*-%{valarch}-*so +chmod 644 $RPM_BUILD_ROOT%{_libexecdir}/valgrind/vgpreload*-%{valarch}-*so %check # Make sure some info about the system is in the build.log @@ -539,21 +498,13 @@ echo ===============END TESTING=============== %doc COPYING NEWS README_* %doc docs/installed/html docs/installed/*.pdf %{_bindir}/* -%dir %{_libdir}/valgrind -# Install everything in the libdir except the .so and .a files. -# The vgpreload so files might file mode adjustment (see below). -# The libmpiwrap so files go in the valgrind-openmpi package. -# The .a archives go into the valgrind-devel package. -%{_libdir}/valgrind/*[^ao] +%dir %{_libexecdir}/valgrind +# Install everything in the libdir except the .so. +# The vgpreload so files might need file mode adjustment. +%{_libexecdir}/valgrind/*[^o] # Turn on executable bit again for vgpreload libraries. # Was disabled in %%install to prevent debuginfo stripping. -%attr(0755,root,root) %{_libdir}/valgrind/vgpreload*-%{valarch}-*so -# And install the symlinks to the secarch files if the exist. -# These are separate from the above because %%attr doesn't work -# on symlinks. -%if "%{valsecarch}" != "" -%{_libdir}/valgrind/vgpreload*-%{valsecarch}-*so -%endif +%attr(0755,root,root) %{_libexecdir}/valgrind/vgpreload*-%{valarch}-*so %{_mandir}/man1/* %files devel @@ -597,6 +548,7 @@ fi %changelog * Mon Apr 8 2019 Mark Wielaard - Remove patches to prebuild files and always ./autogen.sh. +- Only ever build primary arch. Put tools under libexec. * Mon Mar 4 2019 Mark Wielaard - 3.14.0-16 - Add valgrind-3.14.0-gettid.patch