File prelink.spec of Package prelink
#
# spec file for package prelink
#
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Name: prelink
BuildRequires: gcc-c++
BuildRequires: glibc-devel-static
BuildRequires: libelf0-devel
BuildRequires: libselinux-devel-static
BuildRequires: selinux-tools
Summary: An ELF Prelinking Utility
License: GPL-2.0+
Group: System/Base
Version: 20130503
Release: 0
Url: http://people.redhat.com/jakub/prelink/
PreReq: %fillup_prereq
Source: http://people.redhat.com/jakub/prelink/%name-%version.tar.bz2
Source2: %name.conf
Patch0: %name-make_it_cool.diff
Patch1: %name-make-dry-run-verbose.diff
Patch2: disable-unprel1.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
# Copied from upstream archs, lets just trust them as they mostly know what they are doing.
ExclusiveArch: %{ix86} alpha sparc sparcv9 sparc64 s390 s390x x86_64 ppc ppc64 %{arm}
%description
The prelink program is a utility that modifies shared libraries and
executables in the ELF format so that far less relocations need to be
resolved at run time. This decreases program start-up time.
Be aware that prelink can modify all libraries and executables on your
system. Applications which monitor changes in files or RPM itself
will no longer work.
%prep
%setup -q -n prelink
%patch0 -p0
%patch1 -p0
%patch2 -p1
# Disalbe new dtags
sed -i -e '/^CC=/s: : -Wl,--disable-new-dtags :' testsuite/functions.sh
# Add dt-needed
sed -i \
-e '/CCLINK=/s:CCLINK="$(CC):& -Wl,--copy-dt-needed-entries :' \
-e '/CXXLINK=/s:CXXLINK="$(CXX):& -Wl,--copy-dt-needed-entries :' \
testsuite/Makefile.{am,in}
# Fix pthread linking
sed -i \
-e '/^prelink_LDADD/s/$/ -lpthread -pthread/' \
src/Makefile.{am,in}
sed -i \
-e 's:undosyslibs.sh::' \
testsuite/Makefile.in
%build
%configure --disable-shared
make %{?_smp_mflags}
%check
# This package failed when testing with -Wl,-as-needed being default.
# So we disable it here, if you want to retest, just delete this comment and the line below.
export SUSE_ASNEEDED=0
# Uninitialized memory in dynamic loader in ifunc3 test.
export -n MALLOC_PERTURB_
unset MALLOC_PERTURB_
#
make -C testsuite check-harder
make -C testsuite check-cycle
make -C testsuite check-harder
%install
%{make_install}
mkdir -p %{buildroot}%{_sysconfdir}
sed -e "s,LIBDIR,%_lib," %{SOURCE2} > %{buildroot}%{_sysconfdir}/prelink.conf
mkdir -p $FILLUP_DIR %{buildroot}/sbin/conf.d
install -m 0755 -d %{buildroot}/var/lib/prelink
mkdir -p %{buildroot}%{_sysconfdir}/rpm
cat > %{buildroot}%{_sysconfdir}/rpm/macros.prelink <<EOF
# rpm-4.1 verifies prelinked libraries using a prelink undo helper.
# Note: The 2nd token is used as argv[0] and "library" is a
# placeholder that will be deleted and replaced with the appropriate
# library file path.
%__prelink_undo_cmd /usr/sbin/prelink prelink -y library
EOF
%files
%defattr(-,root,root)
%dir /var/lib/prelink
%dir %{_sysconfdir}/rpm
%config(noreplace) %{_sysconfdir}/prelink.conf
%config %{_sysconfdir}/rpm/macros.prelink
%_sbindir/prelink
%_bindir/execstack
%_mandir/man8/prelink.8.*
%_mandir/man8/execstack.8.*
%changelog