From 702eb629446581fa369b7ca437acfeaa512b5a5b Mon Sep 17 00:00:00 2001 From: nicholastao Date: Fri, 8 Sep 2023 06:54:58 +0000 Subject: [PATCH 1/2] add sub rpm coreutils-relocation Signed-off-by: nicholastao --- coreutils.spec | 62 +++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 56 insertions(+), 6 deletions(-) diff --git a/coreutils.spec b/coreutils.spec index 1a80bec..1e6b81b 100644 --- a/coreutils.spec +++ b/coreutils.spec @@ -1,6 +1,8 @@ +%global ENABLE_RELOC 1 + Name: coreutils Version: 9.3 -Release: 1 +Release: 2 License: GPLv3+ Summary: A set of basic GNU tools commonly used in shell scripts Url: https://www.gnu.org/software/coreutils/ @@ -17,7 +19,7 @@ Patch1: coreutils-8.2-uname-processortype.patch Patch2: coreutils-getgrouplist.patch Patch3: bugfix-remove-usr-local-lib-from-m4.patch Patch4: bugfix-dummy_help2man.patch -Patch6: skip-the-tests-that-require-selinux-if-selinux-is-di.patch +Patch6: skip-the-tests-that-require-selinux-if-selinux-is-di.patch Patch7: backport-config-color-alias-for-ls.patch Patch8: backport-coreutils-i18n.patch Patch9: backport-pr-fix-infinite-loop-when-double-spacing.patch @@ -63,6 +65,16 @@ Provides: /bin/sync, /bin/touch, /bin/true, /bin/uname These are the GNU core utilities. This package is the combination of the old GNU fileutils, sh-utils, and textutils packages. +%if %{?ENABLE_RELOC} +%package relocation +Summary: Relocation for %{name} +Requires: %{name} = %{version}-%{release} +BuildRequires: native-turbo-tools + +%description relocation +This package contains relocations for %{name}. +%endif + %prep %autosetup -N tee DIR_COLORS{,.256color,.lightbgcolor} /dev/null @@ -91,6 +103,7 @@ mkdir separate && \ --enable-install-program=arch \ --enable-no-install-program=kill,uptime \ --with-tty-group \ + -q \ DEFAULT_POSIX2_VERSION=200112 alternative=199209 || : make all %{?_smp_mflags} @@ -98,6 +111,24 @@ make all %{?_smp_mflags} ln -v ../lib/parse-datetime.{c,y} . ) +%if %{?ENABLE_RELOC} +mkdir relocation && \ + (cd relocation && ln -s ../configure || exit 1 +%configure --with-openssl \ + --enable-install-program=arch \ + --enable-no-install-program=kill,uptime \ + --with-tty-group \ + -q \ + DEFAULT_POSIX2_VERSION=200112 alternative=199209 LDFLAGS=-Wl,--emit-relocs,-pie || : +make all %{?_smp_mflags} + +find src/ -type f -executable -exec objreloc {} \; -exec strip {} \; -exec cp -f {} ../separate/src/ ';' + +# make sure that parse-datetime.{c,y} ends up in debuginfo (#1555079) +ln -v ../lib/parse-datetime.{c,y} . + ) +%endif + %install (cd separate && make DESTDIR=$RPM_BUILD_ROOT install) @@ -114,19 +145,35 @@ install -p -c -m644 DIR_COLORS{,.256color,.lightbgcolor} $RPM_BUILD_ROOT%{_sysco install -p -c -m644 build-aux/coreutils-colorls.sh $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/colorls.sh install -p -c -m644 build-aux/coreutils-colorls.csh $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/colorls.csh +%if %{?ENABLE_RELOC} +mkdir -p ${RPM_BUILD_ROOT}/usr/lib/relocation%{_bindir} +find ${RPM_BUILD_DIR}/%{name}-%{version}/relocation/src/ -name "*.relocation" -exec install -pD {} ${RPM_BUILD_ROOT}/usr/lib/relocation%{_bindir} ';' +%endif + %check +%if %{?ENABLE_RELOC} +# Strip all of the installed object files. +strip -g $RPM_BUILD_ROOT%{_bindir}/* +%endif + pushd separate make check VERBOSE=yes popd -%preun +%if %{?ENABLE_RELOC} +%files relocation +%defattr(400,root,root,-) +%attr(400, root, root) /usr/lib/relocation%{_bindir}/*.relocation +%endif + +%preun if [ $1 = 0 ]; then if [ -f %{_infodir}/%{name}.info.gz ]; then /sbin/install-info --delete %{_infodir}/%{name}.info.gz %{_infodir}/dir || : fi fi -%post +%post if [ -f %{_infodir}/%{name}.info.gz ]; then /sbin/install-info %{_infodir}/%{name}.info.gz %{_infodir}/dir || : fi @@ -148,6 +195,9 @@ fi %{_mandir}/man*/* %changelog +* Fri Sep 8 2023 taoyuxiang - 9.3-2 +- add sub rpm coreutils_relocation + * Wed Jul 12 2023 jiangchuangang - 9.3-1 - update to 9.3 @@ -166,7 +216,7 @@ fi backport-fts-fix-race-mishandling-of-fstatat-failure.patch backport-stty-fix-off-by-onecolumn-wrapping-on-output.patch backport-copy-copy_file_range-handle-ENOENT-for-CIFS.patch - backport-tail-fix-support-for-F-with-non-seekable-files.patch + backport-tail-fix-support-for-F-with-non-seekable-files.patch * Wed Oct 19 2022 wuzx - 9.0-7 - add sw64 patch @@ -284,7 +334,7 @@ fi - Type:bugfix - ID:NA - SUG:NA -- DESC:sync +- DESC:sync * Fri Dec 28 2018 hushiyuan - 8.30-4.h1 - Type:bugfix -- Gitee From 70132a297912a3985d9c554ff26eb24f958f97a7 Mon Sep 17 00:00:00 2001 From: nicholastao Date: Fri, 8 Sep 2023 07:08:09 +0000 Subject: [PATCH 2/2] code optimization: spec Signed-off-by: nicholastao --- coreutils.spec | 1 - 1 file changed, 1 deletion(-) diff --git a/coreutils.spec b/coreutils.spec index 1e6b81b..ae01f40 100644 --- a/coreutils.spec +++ b/coreutils.spec @@ -103,7 +103,6 @@ mkdir separate && \ --enable-install-program=arch \ --enable-no-install-program=kill,uptime \ --with-tty-group \ - -q \ DEFAULT_POSIX2_VERSION=200112 alternative=199209 || : make all %{?_smp_mflags} -- Gitee