From 976b8d2c873331ff7596216ce437c298e68d4b3d Mon Sep 17 00:00:00 2001 From: Tie Liu Date: Fri, 26 May 2023 17:25:05 +0800 Subject: [PATCH] Refactor the installation path of the relocation package, and fix the issues of not stripped --- bash.spec | 40 ++++++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/bash.spec b/bash.spec index 065caec..b686a48 100644 --- a/bash.spec +++ b/bash.spec @@ -1,6 +1,14 @@ +%if %{?openEuler:1}0 +%global ENABLE_RELOC 0 +%endif + +%if %{ENABLE_RELOC} +%global ldflags_options -Wl,--emit-relocs +%endif + Name: bash Version: 5.1.8 -Release: 9 +Release: 10 Summary: It is the Bourne Again Shell License: GPLv3 URL: https://www.gnu.org/software/bash @@ -61,13 +69,15 @@ Requires: pkgconf-pkg-config %description devel This package contains development files for %{name}. -%package reloc +%if %{?ENABLE_RELOC} +%package relocation Summary: Relocations for %{name} Requires: %{name} = %{version}-%{release} BuildRequires: sysboost-devel -%description reloc +%description relocation This package contains relocations for %{name}. +%endif %package help Summary: Documents for %{name} @@ -84,13 +94,16 @@ Man pages and other related documents for %{name}. %build autoconf -%configure --with-bash-malloc=no --with-afs LDFLAGS="-Wl,--emit-relocs" +%configure --with-bash-malloc=no --with-afs LDFLAGS="%{?ldflags_options}" MFLAGS="CPPFLAGS=-D_GNU_SOURCE -DRECYCLES_PIDS -DDEFAULT_PATH_VALUE='\"/usr/local/bin:/usr/bin\"' `getconf LFS_CFLAGS`" make "$MFLAGS" version.h make "$MFLAGS" -C builtins %make_build "$MFLAGS" +%if %{?ENABLE_RELOC} objreloc $RPM_BUILD_DIR/%{name}-%{version}/bash +rm -rf $RPM_BUILD_DIR/%{name}-%{version}/bash.prim +%endif %install %make_install install-headers @@ -100,7 +113,10 @@ install -pDm 644 %SOURCE2 %{buildroot}/etc/skel/.bash_profile install -pDm 644 %SOURCE3 %{buildroot}/etc/skel/.bash_logout install -pDm 644 ./configs/alias.sh %{buildroot}%{_sysconfdir}/profile.d/alias.sh -install -pDm 750 $RPM_BUILD_DIR/%{name}-%{version}/bash.relocation %{buildroot}%{_bindir}/bash.relocation +%if %{?ENABLE_RELOC} +mkdir -p ${RPM_BUILD_ROOT}/usr/lib/relocation/%{_bindir} +install -pDm 400 $RPM_BUILD_DIR/%{name}-%{version}/bash.relocation ${RPM_BUILD_ROOT}/usr/lib/relocation/%{_bindir}/bash.relocation +%endif # bug #820192, need to add execable alternatives for regular built-ins for ea in alias bg cd command fc fg getopts hash jobs read type ulimit umask unalias wait @@ -125,9 +141,11 @@ make check %{_bindir}/{hash,getopts,jobs,read,type,ulimit,umask,unalias} %config(noreplace) %{_sysconfdir}/profile.d/alias.sh -%files reloc -%defattr(744,root,root) -%{_bindir}/bash.relocation +%if %{ENABLE_RELOC} +%files relocation +%defattr(-,root,root) +/usr/lib/relocation/%{_bindir}/bash.relocation +%endif %files devel %defattr(-,root,root) @@ -146,6 +164,12 @@ make check %exclude %{_infodir}/dir %changelog +* Tue Oct 17 2023 wangyuhang - 5.1.8-10 +- Type:enhancement +- ID:NA +- SUG:NA +- DESC: Fixed the issue of not stripped + * Thu Jun 15 2023 wangyuhang -5.1.8-9 - Type:bugfix - ID:NA