Summary: Utilities for interfacing with sysfs
Summary(ja): sysfs と接続するためのユーティリティ
Name: sysfsutils
Version: 2.1.0
Release: 4%{?_dist_release}

License: GPLv2
Group: Development/Tools

Source0: http://prdownloads.sourceforge.net/linux-diag/%{name}-%{version}.tar.gz
Patch0: sysfsutils-2.0.0-redhatify.patch
Patch1: sysfsutils-2.0.0-class-dup.patch
Patch2: sysfsutils-2.1.0-get_link.patch
Patch3: sysfsutils-2.1.0-manpages.patch

Buildroot: %{_tmppath}/%{name}-%{version}-root
Requires: libsysfs = %{version}-%{release}

%description
This package's purpose is to provide a set of utilities for interfacing
with sysfs.


%package -n libsysfs
Summary: Shared library for interfacing with sysfs
Summary(ja): sysfs と接続するための共用ライブラリ
Group: System Environment/Libraries
License: LGPLv2+

%description -n libsysfs
Library used in handling linux kernel sysfs mounts and their various files.


%package -n libsysfs-devel
Summary: Static library and headers for libsysfs
Summary(ja): libsysfs のスタティックライブラリおよびヘッダファイル
Group: Development/Libraries
License: LGPLv2+
Requires: libsysfs = %{version}-%{release}
Obsoletes: sysfsutils-devel < %{version}-%{release}
Provides: sysfsutils-devel = %{version}-%{release}

%description -n libsysfs-devel
libsysfs-devel provides the header files and static libraries required
to build programs using the libsysfs API.


%prep
%setup -q
%patch0 -p1 -b .redhatify
%patch1 -p1
%patch2 -p1
%patch3 -p1

%build
%configure --disable-static --libdir=/%{_lib}
%__make %{?_smp_mflags}

%install
rm -fr %{buildroot}

%__make DESTDIR=$RPM_BUILD_ROOT install

# remove unpackaged files
rm -f $RPM_BUILD_ROOT%{_bindir}/dlist_test $RPM_BUILD_ROOT%{_bindir}/get_bus_devices_list $RPM_BUILD_ROOT%{_bindir}/get_class_dev $RPM_BUILD_ROOT%{_bindir}/get_classdev_parent $RPM_BUILD_ROOT%{_bindir}/get_device $RPM_BUILD_ROOT%{_bindir}/get_driver $RPM_BUILD_ROOT%{_bindir}/testlibsysfs $RPM_BUILD_ROOT%{_bindir}/write_attr
rm -f $RPM_BUILD_ROOT/%{_lib}/*.la


%clean
rm -rf $RPM_BUILD_ROOT


%post -n libsysfs -p /sbin/ldconfig

%postun -n libsysfs -p /sbin/ldconfig


%files
%defattr(-,root,root)
%doc COPYING AUTHORS README NEWS CREDITS ChangeLog 
%doc docs/libsysfs.txt cmd/GPL
%{_bindir}/systool
%{_bindir}/get_module
%{_mandir}/man1/systool.1*

%files -n libsysfs
%defattr(-,root,root)
%doc COPYING AUTHORS README NEWS CREDITS ChangeLog 
%doc docs/libsysfs.txt lib/LGPL
/%{_lib}/libsysfs.so.*

%files -n libsysfs-devel
%defattr(-,root,root)
%{_includedir}/sysfs/libsysfs.h
%{_includedir}/sysfs/dlist.h
/%{_lib}/libsysfs.so


%changelog
* Mon Nov 17 2014 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 2.1.0-4
- added Patch0, 1, 2 and 3 from Fedora
- moved shared libraries into libsysfs subpackage
- moved libraries from /usr/lib to /lib

* Sun Apr 17 2011 Shu KONNO <owa@bg.wakwak.com> 2.1.0-3
- rebuilt with rpm-4.8.1-3

* Mon Apr 13 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 2.1.0-2
- spec in utf-8
- remove static library

* Sun Jun 15 2008 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.1.0-1
- applied new versioning policy

* Tue Sep 19 2006 Daisuke SUZUKI <daisuke@linux.or.jp> 2.1.0-0vl1
- new upstream release

* Fri Mar 17 2006 Daisuke SUZUKI <daisuke@linux.or.jp> 1.3.0-0vl1
- initial build

