diff --git a/gmp.spec b/gmp.spec index 914f821d086c477152420b8ea8e7597e4b01b8f0..5c7867d14dd4bea79330f91cd381825d5f3cf117 100644 --- a/gmp.spec +++ b/gmp.spec @@ -1,6 +1,8 @@ +%global ENABLE_RLOC 1 + Name: gmp Version: 6.3.0 -Release: 2 +Release: 3 Epoch: 1 URL: https://gmplib.org Source0: https://gmplib.org/download/gmp/gmp-%{version}.tar.xz @@ -30,6 +32,16 @@ Requires: %{name}%{?_isa} = %{epoch}:%{version}-%{release} %description c++ GMP dependent library for C++ applications. +%if %{?ENABLE_RLOC} +%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 -p1 @@ -56,6 +68,20 @@ sed -e 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' \ export LD_LIBRARY_PATH=`pwd`/.libs %make_build +%if %{?ENABLE_RLOC} +mkdir rloc && \ + (cd rloc && ln -s ../configure || exit 1 +%configure --enable-cxx LDFLAGS=-Wl,--emit-relocs +sed -e 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' \ + -e 's|-lstdc++ -lm|-lstdc++|' \ + -e 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' \ + -i libtool +export LD_LIBRARY_PATH=`pwd`/.libs +%make_build +objreloc $(readlink -f .libs/libgmp.so) +) +%endif + %install export LD_LIBRARY_PATH=`pwd`/.libs %make_install @@ -65,6 +91,11 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/lib{gmp,mp,gmpxx}.la /sbin/ldconfig -n $RPM_BUILD_ROOT%{_libdir} ln -sf libgmpxx.so.4 $RPM_BUILD_ROOT%{_libdir}/libgmpxx.so +%if %{?ENABLE_RLOC} +mkdir -p ${RPM_BUILD_ROOT}/usr/lib/relocation/%{_libdir} +install -pD $RPM_BUILD_DIR/%{name}-%{version}/rloc/.libs/*.relocation ${RPM_BUILD_ROOT}/usr/lib/relocation/%{_libdir} +%endif + basearch=%{_arch} %ifarch %{ix86} basearch=i386 @@ -93,7 +124,16 @@ export LD_LIBRARY_PATH=`pwd`/.libs %{_libdir}/libgmpxx.so.* %{_libdir}/pkgconfig/gmpxx.pc +%if %{?ENABLE_RLOC} +%files relocation +%defattr(400,root,root,-) +%attr(400, root, root) /usr/lib/relocation%{_libdir}/*.relocation +%endif + %changelog +* Tue Sep 12 2023 taoyuxiang 1:6.3.0-3 +- add sub rpm coreutils-relocation + * Sat Aug 05 2023 cf-zhao 1:6.3.0-2 - Support build with clang