Spec cleanup

This commit is contained in:
Pete Walter 2018-07-10 22:36:03 +01:00
parent 82ce2a9af4
commit dfd24b0d6f

View File

@ -5,21 +5,34 @@
Name: libsmbios
Version: 2.4.2
Release: 1%{?dist}
License: GPLv2+ or OSL 2.1
Summary: Libsmbios C/C++ shared libraries
Group: System Environment/Libraries
License: GPLv2+ or OSL 2.1
URL: https://github.com/dell/libsmbios
BuildRequires: strace libxml2-devel gcc-c++ gettext git doxygen
BuildRequires: valgrind cppunit-devel hardlink pkgconfig python3-devel
BuildRequires: autoconf gettext-devel automake libtool help2man
Source0: https://github.com/dell/libsmbios/archive/v%{version}/libsmbios-%{version}.tar.gz
Patch0001: 0001-libsmbios-fix-more-places-with-loop-iterators-with-b.patch
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: cppunit-devel
BuildRequires: doxygen
BuildRequires: gcc-c++
BuildRequires: gettext
BuildRequires: gettext-devel
BuildRequires: git
BuildRequires: help2man
BuildRequires: libtool
BuildRequires: libxml2-devel
BuildRequires: pkgconfig
BuildRequires: python3-devel
BuildRequires: strace
BuildRequires: valgrind
# libsmbios only ever makes sense on intel compatible arches
# no DMI tables on ppc, s390, etc.
ExclusiveArch: x86_64 %{ix86}
Source0: https://github.com/dell/libsmbios/archive/v%{version}/libsmbios-%{version}.tar.gz
Patch0001: 0001-libsmbios-fix-more-places-with-loop-iterators-with-b.patch
%description
Libsmbios is a library and utilities that can be used by client programs to get
information from standard BIOS tables, such as the SMBIOS table.
@ -28,7 +41,6 @@ This package provides the C-based libsmbios library, with a C interface.
%package -n python3-smbios
Summary: Python interface to Libsmbios C library
Group: System Environment/Libraries
Requires: libsmbios = %{version}-%{release}
Requires: python3
Obsoletes: python-smbios < 2.4.1
@ -38,7 +50,6 @@ This package provides a Python interface to libsmbios
%package -n smbios-utils
Summary: Meta-package that pulls in all smbios binaries and python scripts
Group: Applications/System
Requires: smbios-utils-bin
Requires: smbios-utils-python
@ -48,7 +59,6 @@ as the python executables.
%package -n smbios-utils-bin
Summary: Binary utilities that use libsmbios
Group: Applications/System
Requires: libsmbios = %{version}-%{release}
%description -n smbios-utils-bin
@ -57,7 +67,6 @@ asset tag.
%package -n smbios-utils-python
Summary: Python executables that use libsmbios
Group: Applications/System
Requires: python3-smbios = %{version}-%{release}
%description -n smbios-utils-python
@ -69,7 +78,6 @@ Update BIOS on select Dell systems. Set LCD brightness on select Dell laptops.
# name the devel package libsmbios-devel regardless of package name, per suse/fedora convention
%package -n libsmbios-devel
Summary: Development headers and archives
Group: Development/Libraries
Requires: libsmbios = %{version}-%{release}
%description -n libsmbios-devel
@ -107,30 +115,10 @@ chmod +x ./configure
%configure
mkdir -p out/libsmbios_c
mkdir -p out/libsmbios_c++
make CFLAGS+="%{optflags} -Werror" %{?_smp_mflags} 2>&1 | tee build-%{_arch}.log
echo \%doc _build/build-%{_arch}.log > buildlogs.txt
TOPDIR=$(pwd)/../
pushd ../src/bin
for x in smbios-battery-ctl smbios-keyboard-ctl smbios-lcd-brightness \
smbios-passwd smbios-sys-info smbios-thermal-ctl smbios-token-ctl \
smbios-wakeup-ctl smbios-wireless-ctl ;
do
chmod +x ${x}
LD_LIBRARY_PATH=$TOPDIR/_build/out/.libs/ help2man -o ${x}.8 -s 8 -n ${x} -N -l ./${x}
done
popd
pushd out
for x in smbios-get-ut-data smbios-state-byte-ctl smbios-sys-info-lite \
smbios-upflag-ctl ;
do
LD_LIBRARY_PATH=$TOPDIR/_build/out/.libs/ help2man -o ${x}.8 -s 8 -n ${x} -N -l ./${x}
done
popd
%check
runtest() {
mkdir _$1$2
@ -143,49 +131,22 @@ runtest() {
echo \%doc _$1$2/$1$2-%{_arch}.log >> _build/buildlogs.txt
}
if [ -d /usr/include/cppunit ]; then
# run this first since it is slightly faster than valgrind
VALGRIND="strace -f" runtest check strace > /dev/null || echo FAILED strace check
fi
if [ -e /usr/bin/valgrind -a -d /usr/include/cppunit ]; then
runtest valgrind > /dev/null || echo FAILED valgrind check
fi
if [ -d /usr/include/cppunit ]; then
runtest check > /dev/null || echo FAILED check
fi
if [ ! -d /usr/include/cppunit ]; then
echo "Unit tests skipped due to missing cppunit."
fi
VALGRIND="strace -f" runtest check strace > /dev/null || echo FAILED strace check
runtest valgrind > /dev/null || echo FAILED valgrind check
runtest check > /dev/null || echo FAILED check
%install
rm -rf %{buildroot}
mkdir %{buildroot}
cd _build
TOPDIR=..
make install DESTDIR=%{buildroot} INSTALL="%{__install} -p"
mkdir -p %{buildroot}/%{_includedir}
mkdir -p %{buildroot}/%{_bindir}
mkdir -p %{buildroot}/%{_mandir}/man8/
cp -v $TOPDIR/src/bin/*.8 %{buildroot}/%{_mandir}/man8/
cp -v $TOPDIR/_build/out/*.8 %{buildroot}/%{_mandir}/man8/
cp -a $TOPDIR/src/include/* %{buildroot}/%{_includedir}/
cp -a out/public-include/* %{buildroot}/%{_includedir}/
%make_install
rm -f %{buildroot}/%{_libdir}/lib*.{la,a}
find %{buildroot}/%{_includedir} out/libsmbios_c++ out/libsmbios_c -exec touch -r $TOPDIR/configure.ac {} \;
find %{buildroot}/%{_includedir} out/libsmbios_c -exec touch -r $TOPDIR/configure.ac {} \;
mv out/libsmbios_c++ out/libsmbios_c++-%{_arch}
mv out/libsmbios_c out/libsmbios_c-%{_arch}
rename %{pot_file}.mo %{lang_dom}.mo $(find %{buildroot}/%{_datadir} -name %{pot_file}.mo)
%find_lang %{lang_dom}
# hardlink files to save some space.
/usr/sbin/hardlink -c -v $RPM_BUILD_ROOT
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
@ -194,15 +155,12 @@ rename %{pot_file}.mo %{lang_dom}.mo $(find %{buildroot}/%{_datadir} -name %{pot
%files -n libsmbios-devel -f _build/buildlogs.txt
%doc COPYING-GPL COPYING-OSL README.md src/bin/getopts_LICENSE.txt src/include/smbios_c/config/boost_LICENSE_1_0_txt
%{_includedir}/smbios
%{_includedir}/smbios_c
%{_libdir}/libsmbios_c.so
%{_libdir}/pkgconfig/*.pc
%doc _build/out/libsmbios_c-%{_arch}
%files -n smbios-utils
# opensuse 11.1 enforces non-empty file list :(
%defattr(-,root,root,-)
%doc COPYING-GPL COPYING-OSL README.md
# no other files.