Package hwinfo: Specfile

%def_with static
%define lname lib%name

Name: hwinfo
Version: 21.76
Release: alt1.E2K.1

Summary: Hardware detection tool
License: GPLv2+
Group: System/Kernel and hardware

Url: http://github.com/openSUSE/hwinfo
# http://download.opensuse.org/source/factory/repo/oss/src/%name-%version-2.1.src.rpm
Source: %name-%version.tar
Patch0: %name-14.19-kbd.c-tiocgdev_undefined.patch
Patch1: %name-21.23-as-needed.patch
Patch2: %name-21.23-makefile.patch
Patch3: %name-14.19-alt.patch
Patch4: %name-alt-no-hal.patch

Patch2000: 0001-add-e2k-architecture.patch
Patch2001: 0004-.patch
Patch2002: 0005-.patch
Patch2003: 0006-Added-disable_vbe_info.patch-from-Debian.patch
Patch2004: 0007-e2k-arch.patch
Patch2005: 0008-e2k-arch.patch
Patch2006: 0009-e2k-arch.patch
Patch2007: 0010-e2k-arch.patch
Patch2008: 0011-e2k-arch.patch

Requires: %lname = %version-%release

# Automatically added by buildreq on Thu Sep 25 2008 (-bi)
BuildRequires: doxygen flex perl-XML-Parser perl-XML-Writer perl-devel
BuildRequires: libdbus-devel
BuildRequires: pkgconfig(udev)
BuildRequires: pkgconfig(uuid)
%ifarch %ix86 x86_64
BuildRequires: libx86emu-devel
%endif

%description
A simple program that lists results from the hardware detection
library.


%package utils
Summary: Hardware Detection utils
Group: System/Kernel and hardware

%description utils
Hardware Detection utils.


%package -n %lname
Summary: Hardware Detection library
Group: System/Libraries
Provides: libhd = %version-%release

%description -n %lname
This library collects information about the hardware installed on a
system.


%package -n %lname-doc
Summary: Documentation for Hardware Detection library
Group: Documentation
BuildArch: noarch
Conflicts: %name-devel < %version-%release

%description -n %lname-doc
Documentation for Hardware Detection library.


%package -n %lname-devel
Summary: Hardware Detection library (development files)
Group: Development/C
Obsoletes: %name-devel < %version-%release
Provides: %name-devel = %version-%release
Provides: libhddev
Requires: %lname = %version-%release

%description -n %lname-devel
Development files for %lname.


%if_with static
%package -n %lname-devel-static
Summary: Hardware Detection static library
Group: Development/C
Requires: %lname-devel = %version-%release
Conflicts: %name-devel < %version-%release

%description -n %lname-devel-static
This static library collects information about the hardware installed
on a system.
%endif


%prep
%setup
%patch0 -p1
%patch1 -p0
%patch2 -p1
%patch3 -p1
%patch4 -p2
%ifarch %e2k
%patch2000 -p1
%patch2001 -p1
%patch2002 -p1
%patch2003 -p1
%patch2004 -p1
%patch2005 -p1
%patch2006 -p1
%patch2007 -p1
%patch2008 -p1
echo '#define HD_VERSION_STRING "%version"' > src/hd/version.h
%endif


%build
%make RPM_OPT_FLAGS="%optflags" 
%make_build doc
bzip2 --best --keep --force changelog

%ifarch %e2k
# lcc doesn't do -MG (cf. mcst#1210)
cd src/ids
cc %optflags -Wall -Wno-pointer-sign -pipe -g -fPIC -I../../src/hd check_hd.c -o check_hd
cd ../isdn/cdb
cc -c %optflags -Wall -Wno-pointer-sign -pipe -g -I../src/hd -I../../src/hd -I../../../src/hd -Lsrc mk_isdnhwdb.c
cc -c %optflags -Wall -Wno-pointer-sign -pipe -g -I../src/hd -I../../src/hd -I../../../src/hd -Lsrc cdb_read.c
cc -Lsrc  mk_isdnhwdb.o cdb_read.o -o mk_isdnhwdb
%endif

%install
%make DESTDIR=%buildroot LIBDIR=%_libdir install
install -d -m 0755 %buildroot{%_man8dir,%_docdir/%lname-%version/html,%_localstatedir/hardware/udi}
install -m 0644 doc/*.8 %buildroot%_man8dir/
install -m 0644 doc/libhd/html/* %buildroot%_docdir/%lname-%version/html/
%{?_with_static:install -m 0644 src/lib*.a %buildroot%_libdir/}
%ifarch %e2k
cp -at %buildroot%_sbindir -- src/ids/check_hd src/isdn/cdb/mk_isdnhwdb
%endif


%files
%doc changelog.* README*
%_sbindir/%name
%_man8dir/*


%files utils
%_sbindir/getsysinfo
%_sbindir/mk_isdnhwdb
%_sbindir/check_hd
%_sbindir/convert_hd


%files -n %lname
%_libdir/*.so.*
%dir %_localstatedir/hardware
%dir %_localstatedir/hardware/udi
%_datadir/%name


%files -n %lname-devel
%_libdir/*.so
%_pkgconfigdir/*
%_includedir/*


%files -n %lname-doc
%_docdir/%lname-%version/html


%if_with static
%files -n %lname-devel-static
%_libdir/*.a
%endif


%changelog
* Mon Aug 09 2021 Michael Shigorin <mike@altlinux.org> 21.76-alt1.E2K.1
- E2K: applied mcst patches

* Mon Aug 09 2021 Michael Shigorin <mike@altlinux.org> 21.76-alt1
- NMU: update to 21.76
  + dropped patch5: upstream
- clarified License: from upstream spec

* Wed Mar 06 2019 Igor Vlasenko <viy@altlinux.ru> 21.23-alt1.1
- NMU: rebuild with new libx86emu (closes: #36239)

* Tue Dec 01 2015 Igor Vlasenko <viy@altlinux.ru> 21.23-alt1
- new version (QA NMU)

* Tue Mar 22 2011 Eugeny A. Rostovtsev (REAL) <real at altlinux.org> 18.5-alt3
- %name-utils: avoid requirement on hal

* Mon Mar 21 2011 Eugeny A. Rostovtsev (REAL) <real at altlinux.org> 18.5-alt2
- Rebuilt as hwinfo

* Mon Mar 21 2011 Eugeny A. Rostovtsev (REAL) <real at altlinux.org> 18.5-alt1
- Version 18.5 (new soname version)
- Built without hal

* Tue Nov 09 2010 Eugeny A. Rostovtsev (REAL) <real at altlinux.org> 15.26-alt1.1
- Rebuilt for soname set-versions

* Mon Mar 30 2009 Fr. Br. George <george@altlinux.ru> 15.26-alt1
- Version up
- Upstream locateion is moved

* Thu Sep 25 2008 Fr. Br. George <george@altlinux.ru> 14.19-alt1
- Changes via led@:
-   clean up spec
+   %name-14.19-makefile.patch
+   %name-14.19-alt.patch
-   group fix
-   update %name-14.19-kbd.c-tiocgdev_undefined.patch

* Sun May 25 2008 Fr. Br. George <george@altlinux.ru> 13.57-alt2
- #14572 fixed

* Fri Oct 12 2007 Fr. Br. George <george@altlinux.ru> 13.57-alt1
- Initial ALT build (Open SUSE hwinfo-13.57-2)
- MDV patch applied