Summary:        Utilities for SAS management protocol (SMP)
Name:           smp_utils
Version:        0.99
Release:        1%{?_dist_release}
Group:          Applications/System
Vendor:         Project Vine
Distribution:   Vine Linux
BuildRoot:      %{_tmppath}/%{name}-%{version}-root

License:        BSD
URL:            http://sg.danny.cz/sg/smp_utils.html
Source0:        http://sg.danny.cz/sg/p/%{name}-%{version}.tgz

Requires:       %{name}-libs%{?_isa} = %{version}-%{release}


%description
This is a package of utilities. Each utility sends a Serial Attached
SCSI (SAS) Management Protocol (SMP) request to a SMP target.
If the request fails then the error is decoded. If the request succeeds
then the response is either decoded, printed out in hexadecimal or
output in binary. This package supports multiple interfaces since
SMP passthroughs are not mature. This package supports the linux
2.4 and 2.6 series and should be easy to port to other operating
systems.

Warning: Some of these tools access the internals of your system
and the incorrect usage of them may render your system inoperable.


%package libs
Summary: Shared library for %{name}

%description libs
This package contains the shared library for %{name}.


%package devel
Summary: Development library and header files for the smp_utils library
Requires: %{name}-libs%{?_isa} = %{version}-%{release}

%description devel
This package contains the %{name} library and its header files for
developing applications.


%prep
%setup -q


%build
%configure --disable-static

sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool

make %{?smp_mflags} CFLAGS="%{optflags} -DSMP_UTILS_LINUX"


%install
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}

make install \
        PREFIX=%{_prefix} \
        DESTDIR=%{buildroot}
rm -f %{buildroot}%{_libdir}/*.la


%clean
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}


%files
%defattr(-,root,root)
%license COPYING
%doc ChangeLog COVERAGE CREDITS INSTALL README
%attr(0755,root,root) %{_bindir}/*
%{_mandir}/man8/*

%files libs
%doc COPYING
%{_libdir}/*.so.*

%files devel
%{_includedir}/scsi/*.h
%{_libdir}/*.so


%changelog
* Sat Apr 04 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 0.99-1
- new upstream release.

* Sat Dec 28 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.94-3
- rebuild with VineSeed environment

* Sat Sep 04 2010 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.94-2
- changed Group to Applications/System

* Wed Apr 07 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.94-1
- Initial build for Vine Linux
- add Patch0 (smp_utils-0.94-Makefile-vine.patch)

* Mon Dec 29 2008 - dgilbert at interlog dot com
- adjust sgv4 for lk 2.6.27, sync with sas2r15
  * smp_utils-0.94
* Sun Jan 06 2008 - dgilbert at interlog dot com
- sync with sas2r13, add 'sgv4' interface
  * smp_utils-0.93
* Fri Dec 08 2006 - dgilbert at interlog dot com
- sync against sas2r07, add smp_conf_general
  * smp_utils-0.92
* Tue Aug 22 2006 - dgilbert at interlog dot com
- add smp_phy_test and smp_discover_list, uniform exit status values
  * smp_utils-0.91
* Sun Jun 11 2006 - dgilbert at interlog dot com
- add smp_read_gpio, smp_conf_route_info and smp_write_gpio
  * smp_utils-0.90