Spec file cleanup

- Update URL and Source to current common canonical URLs
- Use architecture-specific dependencies via %{?_isa}
- Use %make_build macro
- Switch from /lib(64) and /sbin to /usr/{lib(64),sbin} (Fedora 17 /usr-move)
- Provide /sbin/lspci and /sbin/setpci for backward compatibility
- Set correct permissions when installing headers and pkgconfig file
This commit is contained in:
Robert Scheck 2021-01-31 22:36:01 +01:00
parent c3a9ba89ca
commit 90e8bf4309

View File

@ -3,9 +3,9 @@ Version: 3.7.0
Release: 2%{?dist} Release: 2%{?dist}
Summary: PCI bus related utilities Summary: PCI bus related utilities
License: GPLv2+ License: GPLv2+
URL: http://atrey.karlin.mff.cuni.cz/~mj/pciutils.shtml URL: https://mj.ucw.cz/sw/pciutils/
Source: https://mirrors.edge.kernel.org/pub/software/utils/pciutils/%{name}-%{version}.tar.xz Source0: https://www.kernel.org/pub/software/utils/pciutils/%{name}-%{version}.tar.xz
Source1: multilibconfigh Source1: multilibconfigh
#change pci.ids directory to hwdata, fedora/rhel specific #change pci.ids directory to hwdata, fedora/rhel specific
@ -17,8 +17,8 @@ Patch3: pciutils-3.7.0-decodercec.patch
Requires: hwdata Requires: hwdata
Requires: %{name}-libs = %{version}-%{release} Requires: %{name}-libs = %{version}-%{release}
BuildRequires: make BuildRequires: gcc make sed kmod-devel
BuildRequires: gcc sed kmod-devel Provides: /sbin/lspci /sbin/setpci
%description %description
The pciutils package contains various utilities for inspecting and The pciutils package contains various utilities for inspecting and
@ -26,7 +26,7 @@ setting devices connected to the PCI bus.
%package devel %package devel
Summary: Linux PCI development library Summary: Linux PCI development library
Requires: zlib-devel pkgconfig %{name} = %{version}-%{release} Requires: zlib-devel pkgconfig %{name}%{?_isa} = %{version}-%{release}
%description devel %description devel
This package contains a library for inspecting and setting This package contains a library for inspecting and setting
@ -41,7 +41,7 @@ devices connected to the PCI bus.
%package devel-static %package devel-static
Summary: Linux PCI static library Summary: Linux PCI static library
Requires: %{name}-devel = %{version}-%{release} Requires: %{name}-devel%{?_isa} = %{version}-%{release}
%description devel-static %description devel-static
This package contains a static library for inspecting and setting This package contains a static library for inspecting and setting
@ -51,50 +51,44 @@ devices connected to the PCI bus.
%autosetup -p1 %autosetup -p1
%build %build
make SHARED="no" ZLIB="no" LIBKMOD=yes STRIP="" OPT="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS" PREFIX="/usr" IDSDIR="/usr/share/hwdata" PCI_IDS="pci.ids" %{?_smp_mflags} %make_build SHARED="no" ZLIB="no" LIBKMOD=yes STRIP="" OPT="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS" PREFIX="/usr" LIBDIR="%{_libdir}" IDSDIR="/usr/share/hwdata" PCI_IDS="pci.ids"
mv lib/libpci.a lib/libpci.a.toinstall mv lib/libpci.a lib/libpci.a.toinstall
make clean make clean
make SHARED="yes" ZLIB="no" LIBKMOD=yes STRIP="" OPT="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS" PREFIX="/usr" LIBDIR="/%{_lib}" IDSDIR="/usr/share/hwdata" PCI_IDS="pci.ids" %{?_smp_mflags} %make_build SHARED="yes" ZLIB="no" LIBKMOD=yes STRIP="" OPT="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS" PREFIX="/usr" LIBDIR="%{_libdir}" IDSDIR="/usr/share/hwdata" PCI_IDS="pci.ids"
#fix lib vs. lib64 in libpci.pc (static Makefile is used)
sed -i "s|^libdir=.*$|libdir=/%{_lib}|" lib/libpci.pc
%install %install
install -d $RPM_BUILD_ROOT/{sbin,%{_sbindir},%{_lib},%{_mandir}/man{7,8},%{_libdir},%{_libdir}/pkgconfig,%{_includedir}/pci} install -d $RPM_BUILD_ROOT{%{_sbindir},%{_mandir}/man{7,8},%{_libdir},%{_libdir}/pkgconfig,%{_includedir}/pci}
install -p lspci setpci $RPM_BUILD_ROOT/sbin install -p lspci setpci update-pciids $RPM_BUILD_ROOT%{_sbindir}
install -p update-pciids $RPM_BUILD_ROOT/%{_sbindir}
install -p -m 644 lspci.8 setpci.8 update-pciids.8 $RPM_BUILD_ROOT%{_mandir}/man8 install -p -m 644 lspci.8 setpci.8 update-pciids.8 $RPM_BUILD_ROOT%{_mandir}/man8
install -p -m 644 pcilib.7 $RPM_BUILD_ROOT%{_mandir}/man7 install -p -m 644 pcilib.7 $RPM_BUILD_ROOT%{_mandir}/man7
install -p lib/libpci.so.* $RPM_BUILD_ROOT/%{_lib}/ install -p lib/libpci.so.* $RPM_BUILD_ROOT%{_libdir}/
ln -s ../../%{_lib}/$(basename $RPM_BUILD_ROOT/%{_lib}/*.so.*.*.*) $RPM_BUILD_ROOT%{_libdir}/libpci.so ln -s $(basename $RPM_BUILD_ROOT%{_libdir}/*.so.*.*.*) $RPM_BUILD_ROOT%{_libdir}/libpci.so
mv lib/libpci.a.toinstall lib/libpci.a mv lib/libpci.a.toinstall lib/libpci.a
install -p -m 644 lib/libpci.a $RPM_BUILD_ROOT%{_libdir} install -p -m 644 lib/libpci.a $RPM_BUILD_ROOT%{_libdir}
/sbin/ldconfig -N $RPM_BUILD_ROOT/%{_lib} install -p -m 644 lib/pci.h $RPM_BUILD_ROOT%{_includedir}/pci
install -p lib/pci.h $RPM_BUILD_ROOT%{_includedir}/pci install -p -m 644 lib/header.h $RPM_BUILD_ROOT%{_includedir}/pci
install -p lib/header.h $RPM_BUILD_ROOT%{_includedir}/pci install -p -m 644 %{SOURCE1} $RPM_BUILD_ROOT%{_includedir}/pci/config.h
install -p %{SOURCE1} $RPM_BUILD_ROOT%{_includedir}/pci/config.h install -p -m 644 lib/config.h $RPM_BUILD_ROOT%{_includedir}/pci/config.%{_lib}.h
install -p lib/config.h $RPM_BUILD_ROOT%{_includedir}/pci/config.%{_lib}.h install -p -m 644 lib/types.h $RPM_BUILD_ROOT%{_includedir}/pci
install -p lib/types.h $RPM_BUILD_ROOT%{_includedir}/pci install -p -m 644 lib/libpci.pc $RPM_BUILD_ROOT%{_libdir}/pkgconfig
install -p lib/libpci.pc $RPM_BUILD_ROOT%{_libdir}/pkgconfig
%ldconfig_scriptlets libs %ldconfig_scriptlets libs
%files %files
%doc README ChangeLog pciutils.lsm %doc README ChangeLog pciutils.lsm
/sbin/lspci %{_sbindir}/lspci
/sbin/setpci %{_sbindir}/setpci
%{_sbindir}/update-pciids %{_sbindir}/update-pciids
%{_mandir}/man8/* %{_mandir}/man8/*
%files libs %files libs
%license COPYING %license COPYING
%defattr(-,root,root,-) %{_libdir}/libpci.so.*
/%{_lib}/libpci.so.*
%files devel-static %files devel-static
%{_libdir}/libpci.a %{_libdir}/libpci.a