Hello everybody!

I'm in process to pack hwloc into rpm for Fedora. I have attached the latest 
hwloc.spec file for reference.

However, there are strict rules to get a package into Fedora. One of the rules 
is that rpmlint has to pass. It's failing at the moment:

=====================================================
 hwloc.x86_64: E: binary-or-shlib-defines-rpath /usr/bin/hwloc-distrib 
['/usr/lib64']
The binary or shared library defines `RPATH'. Usually this is a bad thing
because it hardcodes the path to search libraries and so makes it difficult to
move libraries around.  Most likely you will find a Makefile with a line like:
gcc test.o -o test -Wl,--rpath.  Also, sometimes configure scripts provide a
--disable-rpath flag to avoid this.
=====================================================

Check
https://fedoraproject.org/wiki/Packaging/Guidelines#Beware_of_Rpath
or for example
http://wiki.debian.org/RpathIssue

Basically, I need to get rid of it. One approach is to change it in the source 
code directly. Could you guys do it?

I could possibly deal with it when creating a package 

- either by patching libtool after ./configure step. (Which works nicely)
%configure
sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool

- or by using chrpath to strip the RPATH header from the generated binary. 

As I said, patching libtool after ./configure step works just fine (see 
attached 
spec file hwloc.spec-patching_libtool). However, I don't like this solution. I 
believe that fixing this in upstream would be the best solution.

Please let me know your opinion.

Thanks
Jirka
Summary:   Portable Hardware Locality - portable abstraction of hierarchical architectures
Name:      hwloc
Version:   1.0.1
Release:   1%{?dist}
License:   BSD
Group:     Applications/System
URL:       http://www.open-mpi.org/projects/hwloc/
Source0:   http://www.open-mpi.org/software/hwloc/v1.0/downloads/%{name}-%{version}.tar.bz2
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

%if 0%{?rhel}==4
BuildRequires: xorg-x11-devel,libxml2-devel,evolution28-cairo-devel
Requires:      evolution28-cairo, xorg-x11-libs, xorg-x11-devel, glibc-devel, fontconfig-devel, freetype-devel, ncurses, libpng, libxml2-devel, zlib-devel
AutoReq:       no
%else
BuildRequires: libX11-devel,libxml2-devel,cairo-devel
%endif

%description
The Portable Hardware Locality (hwloc) software package provides 
a portable abstraction (across OS, versions, architectures, ...) 
of the hierarchical topology of modern architectures, including 
NUMA memory nodes,  shared caches, processor sockets, processor cores
and processing units (logical processors or "threads"). It also gathers
various system attributes such as cache and memory information. It primarily
aims at helping applications with gathering information about modern
computing hardware so as to exploit it accordingly and efficiently.

hwloc may display the topology in multiple convenient formats. 
It also offers a powerful programming interface (C API) to gather information 
about the hardware, bind processes, and much more.

%package devel
Summary:   hwloc headers and shared development libraries
Group:     Development/Libraries
Requires:  hwloc = %{version}-%{release}
Provides:  hwloc-devel = %{version}-%{release}
%if 0%{?rhel}==4
BuildRequires: xorg-x11-devel,libxml2-devel,evolution28-cairo-devel
%else
BuildRequires: libX11-devel,libxml2-devel,cairo-devel
%endif

%description devel
Headers and shared object symlinks for the hwloc.

%prep
%setup -q

%build
%if 0%{?rhel}==4
OUT=$(/usr/bin/find /usr/evolution28 -type d -name pkgconfig)
[ ! -z "${OUT}" ] && export PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:${OUT}"
%endif

%configure
%{__make} %{?_smp_mflags}

%install
%{__rm} -rf %{buildroot}

%{__make} install DESTDIR=%{buildroot} INSTALL="%{__install} -p"

%{__mv} %{buildroot}%{_defaultdocdir}/%{name} %{buildroot}%{_defaultdocdir}/%{name}-%{version}
%{__cp} AUTHORS COPYING NEWS README VERSION %{buildroot}%{_defaultdocdir}/%{name}-%{version}
%{__cp} doc/hwloc-hello.c %{buildroot}%{_defaultdocdir}/%{name}-%{version}

%clean
%{__rm} -rf %{buildroot}

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%defattr(-, root, root, -)
%{_bindir}/%{name}*
%{_bindir}/lstopo
%{_mandir}/man7/%{name}*
%{_mandir}/man1/%{name}*
%{_mandir}/man1/lstopo*
%{_prefix}/share/%{name}/%{name}.dtd
%dir %{_defaultdocdir}/%{name}-%{version}
%{_defaultdocdir}/%{name}-%{version}/*[^c]
%{_libdir}/libhwloc*.so.*

%files devel
%defattr(-, root, root, -)
%{_libdir}/pkgconfig/*
%{_libdir}/libhwloc*.so
%{_libdir}/libhwloc.la
%{_mandir}/man3/*
%dir %{_includedir}/%{name}
%{_includedir}/%{name}/*
%{_includedir}/%{name}.h
%dir %{_defaultdocdir}/%{name}-%{version}
%{_defaultdocdir}/%{name}-%{version}/*c


%changelog
* Fri Jun 18 2010 Jirka Hladky <jhla...@redhat.com> - 1.0.1-1
- Initial build
Summary:   Portable Hardware Locality - portable abstraction of hierarchical architectures
Name:      hwloc
Version:   1.0.1
Release:   1%{?dist}
License:   BSD
Group:     Applications/System
URL:       http://www.open-mpi.org/projects/hwloc/
Source0:   http://www.open-mpi.org/software/hwloc/v1.0/downloads/%{name}-%{version}.tar.bz2
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

%if 0%{?rhel}==4
BuildRequires: xorg-x11-devel,libxml2-devel,evolution28-cairo-devel
Requires:      evolution28-cairo, xorg-x11-libs, xorg-x11-devel, glibc-devel, fontconfig-devel, freetype-devel, ncurses, libpng, libxml2-devel, zlib-devel
AutoReq:       no
%else
BuildRequires: libX11-devel,libxml2-devel,cairo-devel
%endif

%description
The Portable Hardware Locality (hwloc) software package provides 
a portable abstraction (across OS, versions, architectures, ...) 
of the hierarchical topology of modern architectures, including 
NUMA memory nodes,  shared caches, processor sockets, processor cores
and processing units (logical processors or "threads"). It also gathers
various system attributes such as cache and memory information. It primarily
aims at helping applications with gathering information about modern
computing hardware so as to exploit it accordingly and efficiently.

hwloc may display the topology in multiple convenient formats. 
It also offers a powerful programming interface (C API) to gather information 
about the hardware, bind processes, and much more.

%package devel
Summary:   hwloc headers and shared development libraries
Group:     Development/Libraries
Requires:  hwloc = %{version}-%{release}
Provides:  hwloc-devel = %{version}-%{release}
%if 0%{?rhel}==4
BuildRequires: xorg-x11-devel,libxml2-devel,evolution28-cairo-devel
%else
BuildRequires: libX11-devel,libxml2-devel,cairo-devel
%endif

%description devel
Headers and shared object symlinks for the hwloc.

%prep
%setup -q

%build
%if 0%{?rhel}==4
OUT=$(/usr/bin/find /usr/evolution28 -type d -name pkgconfig)
[ ! -z "${OUT}" ] && export PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:${OUT}"
%endif

%configure
sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
%{__make} %{?_smp_mflags}

%install
%{__rm} -rf %{buildroot}

%{__make} install DESTDIR=%{buildroot} INSTALL="%{__install} -p"

%{__mv} %{buildroot}%{_defaultdocdir}/%{name} %{buildroot}%{_defaultdocdir}/%{name}-%{version}
%{__cp} AUTHORS COPYING NEWS README VERSION %{buildroot}%{_defaultdocdir}/%{name}-%{version}
%{__cp} doc/hwloc-hello.c %{buildroot}%{_defaultdocdir}/%{name}-%{version}

%clean
%{__rm} -rf %{buildroot}

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%defattr(-, root, root, -)
%{_bindir}/%{name}*
%{_bindir}/lstopo
%{_mandir}/man7/%{name}*
%{_mandir}/man1/%{name}*
%{_mandir}/man1/lstopo*
%{_prefix}/share/%{name}/%{name}.dtd
%dir %{_defaultdocdir}/%{name}-%{version}
%{_defaultdocdir}/%{name}-%{version}/*[^c]
%{_libdir}/libhwloc*.so.*

%files devel
%defattr(-, root, root, -)
%{_libdir}/pkgconfig/*
%{_libdir}/libhwloc*.so
%{_libdir}/libhwloc.la
%{_mandir}/man3/*
%dir %{_includedir}/%{name}
%{_includedir}/%{name}/*
%{_includedir}/%{name}.h
%dir %{_defaultdocdir}/%{name}-%{version}
%{_defaultdocdir}/%{name}-%{version}/*c


%changelog
* Fri Jun 18 2010 Jirka Hladky <jhla...@redhat.com> - 1.0.1-1
- Initial build

Reply via email to