Summary: Hardware monitoring tools
Summary(ja): ハードウェア監視ツール集
Name: lm-sensors
Version: 3.5.0
Release: 1%{?_dist_release}

%global ver_str %(echo -n "%{version}" | sed -e 's/\\./-/g')

Group: Applications/System
License: LGPLv2+ and GPLv3+ and GPLv2+ and Verbatim and Public Domain
URL: https://github.com/lm-sensors/lm-sensors

Source0: https://github.com/lm-sensors/lm-sensors/archive/lm_sensors-%{version}.tar.gz#/lm-sensors-%{ver_str}.tar.gz
Source1: lm_sensors.sysconfig

BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: bison
BuildRequires: flex
BuildRequires: gawk
BuildRequires: kernel-headers >= 2.2.16
%if "%{_dist_release}" >= "vl7"
BuildRequires: libsysfs-devel
%else
BuildRequires: sysfsutils-devel
%endif
BuildRequires: rrdtool-devel

Requires: perl
Requires: initscripts
Requires(post): /sbin/chkconfig
Requires(preun): /sbin/chkconfig

Vendor: Project Vine
Distribution: Vine Linux
Packager: shaolin, owa

%description
The lm-sensors package includes a collection of modules for general SMBus
access and hardware monitoring.

%package libs
Summary: Lm_sensors core libraries
Summary(ja): Lm_sensors コアライブラリ
Group: System Environment/Libraries

%description libs
Core libraries for lm_sensors applications


%package devel
Summary: Development files for programs which will use lm_sensors
Summary(ja): lm_sensors を使用するプログラムのための開発用ファイル
Group: Development/Libraries
Requires: %{name}-libs = %{version}-%{release}

%description devel
The %{name}-devel package includes a header files and libraries for use
when building applications that make use of sensor data.


%package sensord
Summary: Daemon that periodically logs sensor readings
Summary(ja): センサーの読み取り値を定期的に記録するデーモン
Group: System Environment/Daemons
Requires: %{name} = %{version}-%{release}

%description sensord
Daemon that periodically logs sensor readings to syslog or a round-robin
database, and warns of sensor alarms.

%prep
%setup -q -n lm-sensors-%{ver_str}

%build
export CFLAGS="%{optflags}"
make PREFIX=%{_prefix} LIBDIR=%{_libdir} MANDIR=%{_mandir} EXLDFLAGS=  user

%install
rm -rf $RPM_BUILD_ROOT
make user_install \
     DESTDIR=$RPM_BUILD_ROOT \
     PREFIX=%{_prefix} \
     LIBDIR=%{_libdir} \
     ETCDIR=%{_sysconfdir} \
     MANDIR=%{_mandir} 

ln -s sensors.conf.5.gz $RPM_BUILD_ROOT%{_mandir}/man5/sensors3.conf.5.gz

# add initscript from proc/init
mkdir -p $RPM_BUILD_ROOT%{_initdir}
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sensors.d
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
install -m755 prog/init/lm_sensors.init $RPM_BUILD_ROOT%{_initdir}/lm_sensors
install -pm 644 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/lm_sensors

# remove unuse files
rm -f $RPM_BUILD_ROOT/%{_libdir}/*.a

%clean
rm -rf $RPM_BUILD_ROOT

%post
if [ "$1" = 1 ] ; then
	/sbin/chkconfig --add lm_sensors
fi
%{_initdir}/lm_sensors condrestart

%preun
if [ "$1" = 0 ] ; then
	%{_initdir}/lm_sensors stop > /dev/null 2>&1
    /sbin/chkconfig --del lm_sensors
fi

%post libs -p /sbin/ldconfig

%postun libs -p /sbin/ldconfig


%files
%defattr(-,root,root,-)
%license COPYING
%doc CHANGES CONTRIBUTORS INSTALL README doc
%dir %{_sysconfdir}/sensors.d
%config(noreplace) %{_sysconfdir}/sensors3.conf
%config(noreplace) %{_sysconfdir}/sysconfig/lm_sensors
%config %{_initdir}/lm_sensors
%{_bindir}/sensors
%{_bindir}/sensors-conf-convert
%{_sbindir}/fancontrol
%ifarch %{ix86} x86_64
%{_sbindir}/isadump
%{_sbindir}/isaset
%endif
%{_sbindir}/pwmconfig
%{_sbindir}/sensors-detect
%{_mandir}/man1/*
%{_mandir}/man5/*
%{_mandir}/man8/*

%files libs
%{_libdir}/lib*.so.*

%files devel
%{_includedir}/sensors
%{_libdir}/lib*.so
%{_mandir}/man3/*


%changelog
* Fri May 10 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.5.0-1
- updated to 3.5.0.

* Sat Nov  7 2015 Daisuke SUZUKI <daisuke@vinelinux.org> 3.4.0-1
- update to 3.4.0

* Mon Jan  5 2015 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 3.3.5-1
- updated to 3.3.5
- built on current VineSeed
- split libraries to libs subpackage

* Tue Apr 12 2011 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 3.3.0-1
- new upstrem release 3.3.0

* Tue Dec 14 2010 Shu KONNO <owa@bg.wakwak.com> 3.2.0-1
- updated lm-sensors to 3.2.0
- added RQ: initscripts

* Tue Mar 16 2010 Shu KONNO <owa@bg.wakwak.com> 3.1.2-1
- updated lm-sensors to 3.1.2

* Tue Oct 20 2009 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 3.1.1-2
- isadump/isaset only available on ix86/x86_64 archs

* Mon Aug 31 2009 Shu KONNO <owa@bg.wakwak.com> 3.1.1-1
- updated lm-sensors to 3.1.1
- added japanese summary, spec in utf-8
- added %{_initdir}/lm_sensors to %%files
- added %%post, %%preun, %%postun scripts

* Fri Oct 03 2008 Shu KONNO <owa@bg.wakwak.com> 2.10.7-1vl5
- new upstream release
- applied new versioning policy

* Sun Nov 25 2007 Shu KONNO <owa@bg.wakwak.com> - 2.10.3-0vl2
- fixed libdir in Makefile (for support lib64)

* Tue May 29 2007 USAMI Kosuke <usami-k@yc5.so-net.ne.jp> - 2.10.3-0vl1
- Initial build.