Summary:        Utilities for interfacing with sysfs
Summary(ja):    sysfs と接続するためのユーティリティ
Name:           sysfsutils
Version:        2.1.1
Release:        1%{?_dist_release}
Group:          admin-tools
Vendor:         Project Vine
Distribution:   Vine Linux

License:        GPLv2
URL:            https://github.com/linux-ras/sysfsutils
Source0:        https://github.com/linux-ras/sysfsutils/archive/v%{version}.tar.gz#/sysfsutils-%{version}.tar.gz

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
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: programming
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.


%debug_package


%prep
%setup -q


%build
autoreconf -i -v -f
%configure --disable-static --libdir=/%{_lib}
%__make %{?_smp_mflags}


%install
rm -fr %{buildroot}

%__make DESTDIR=%{buildroot} install

rm -f %{buildroot}/%{_lib}/*.la

mkdir -p %{buildroot}%{_libdir}
mv %{buildroot}/%{_lib}/pkgconfig %{buildroot}%{_libdir}/
sed -i -e 's|^libdir=.*$|libdir=%{_libdir}|' %{buildroot}%{_libdir}/pkgconfig/libsysfs.pc

TARGET=$(readlink %{buildroot}/%{_lib}/libsysfs.so)
ln -sf ../../%{_lib}/$TARGET %{buildroot}%{_libdir}/libsysfs.so
rm -f %{buildroot}/%{_lib}/libsysfs.so


%clean
rm -rf %{buildroot}


%files
%defattr(-,root,root)
%license COPYING cmd/GPL
%doc AUTHORS README CREDITS 
%{_bindir}/systool
%{_mandir}/man1/systool.1*

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

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

%changelog
* Fri Mar 12 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.1.1-1
- new upstream release.
- dropped scriptlets.
- dropped all patches.

* Thu Apr 02 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.1.0-5
- rebuilt with current environment.

* 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

