From 29df6444db6856152f44c5f9e8d9f57b2c3ec509 Mon Sep 17 00:00:00 2001 From: nicholastao Date: Mon, 11 Sep 2023 03:31:16 +0000 Subject: [PATCH] add sub rpm coreutils-relocation Signed-off-by: nicholastao --- coreutils.spec | 65 ++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 52 insertions(+), 13 deletions(-) diff --git a/coreutils.spec b/coreutils.spec index 1a80bec..109e69e 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 @@ -84,19 +96,32 @@ export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -fpic -fsigned-char" export ac_cv_func_lchmod="no" %{expand:%%global optflags %{optflags} -D_GNU_SOURCE=1} +CONFIGURE_OPTS=( + --with-openssl + --enable-install-program=arch + --enable-no-install-program=kill,uptime + --with-tty-group + DEFAULT_POSIX2_VERSION=200112 alternative=199209 +) + mkdir separate && \ (cd separate && ln -s ../configure || exit 1 -%configure --with-openssl \ - --cache-file=../config.cache \ - --enable-install-program=arch \ - --enable-no-install-program=kill,uptime \ - --with-tty-group \ - DEFAULT_POSIX2_VERSION=200112 alternative=199209 || : +%configure "${CONFIGURE_OPTS[@]}" || : make all %{?_smp_mflags} # make sure that parse-datetime.{c,y} ends up in debuginfo (#1555079) ln -v ../lib/parse-datetime.{c,y} . - ) +) + +%if %{?ENABLE_RELOC} +mkdir rloc && \ + (cd rloc && ln -s ../configure || exit 1 +%configure "${CONFIGURE_OPTS[@]}" LDFLAGS=-Wl,--emit-relocs,-pie || : +make all %{?_smp_mflags} + +find src/ -type f -executable -exec objreloc {} ';' +) +%endif %install (cd separate && make DESTDIR=$RPM_BUILD_ROOT install) @@ -114,19 +139,24 @@ 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}/rloc/src/ -name "*.relocation" -exec install -pD {} ${RPM_BUILD_ROOT}/usr/lib/relocation%{_bindir} ';' +%endif + %check pushd separate make check VERBOSE=yes popd -%preun +%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 @@ -147,7 +177,16 @@ fi %{_infodir}/coreutils* %{_mandir}/man*/* +%if %{?ENABLE_RELOC} +%files relocation +%defattr(400,root,root,-) +%attr(400, root, root) /usr/lib/relocation%{_bindir}/*.relocation +%endif + %changelog +* Mon Sep 11 2023 taoyuxiang - 9.3-2 +- add sub rpm coreutils-relocation + * Wed Jul 12 2023 jiangchuangang - 9.3-1 - update to 9.3 @@ -166,7 +205,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 +323,7 @@ fi - Type:bugfix - ID:NA - SUG:NA -- DESC:sync +- DESC:sync * Fri Dec 28 2018 hushiyuan - 8.30-4.h1 - Type:bugfix -- Gitee