File openzwave.spec of Package openzwave

#
# spec file for package openzwave
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           libopenzwave1.7
Summary:        Library to access Z-Wave interfaces
License:        LGPL-2.1+
Group:          Development/Libraries/C and C++
Url:            https://github.com/OpenZWave/open-zwave/releases
Version:        1.7
Release:        0
BuildRequires:  doxygen
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  git
BuildRequires:  graphviz
BuildRequires:  libudev-devel
BuildRequires:  libxml2-tools
BuildRequires:  make
%if 0%{?fedora} >= 18
BuildRequires:  pkgconfig
BuildRequires:  systemd-devel
%else
%if 0%{?suse_version} >= 1220
BuildRequires:  pkg-config
BuildRequires:  systemd-devel
%else
BuildRequires:  libudev-devel
BuildRequires:  pkgconfig
%endif
%endif
Source0:        open-zwave-%{version}.tar.xz
Patch0:         open-zwave.patch
Patch1:         spiritz.patch

%description
OpenZWave is an open-source, cross-platform library designed to enable anyone to
add support for Z-Wave home-automation devices to their applications, without 
requiring any in depth knowledge of the Z-Wave protocol.

Z-Wave employs a proprietary protocol which the owners, Sigma Designs, have 
chosen not to release into the public domain. There is also no official free 
or low-cost SDK that can be used to develop applications (The ControlThink SDK
is now tied exclusively to their own Z-Wave PC interface). The only way to 
obtain the protocol documentation and sample code is to purchase an expensive 
development kit, and sign a non-disclosure agreement (NDA) preventing the 
release of that knowledge.

OpenZWave was created to fill that gap. We do not have the official 
documentation, have signed no NDA, and are free to develop the library as we 
see fit. Our knowledge comes from existing bodies of open-source code 
(principally the Z-Wave parts of LinuxMCE), and through examining the 
messages sent by Z-Wave devices.

The goal of the project is to make a positive contribution to the Z-Wave 
community by creating a library that supports as much of the Z-Wave 
specification as possible, and that can be used as a "black-box" solution 
by anyone wanting to add Z-Wave to their application. It is NOT our aim 
to publish alternative documentation of the Z-Wave protocol, or to 
attempt to "punish" Sigma Designs for their decision to keep the 
protocol closed.


%package -n libopenzwave-devel
Summary:        Open-ZWave devel files
License:        LGPL-2.0+
Group:          Development/Libraries/C and C++
Requires:       %{name} = %{version}-%{release}

%description -n libopenzwave-devel
devel files needed when you want to compile your own 
applications using openzwave


%package -n openzwave
Summary:        Open-ZWave Sample Executable(s)
License:        LGPL-2.1+
Group:          Development/Libraries/C and C++
Requires:       %{name} = %{version}-%{release}

%description -n openzwave
Sample Executable(s) for OpenZWave


%prep
%setup -q -n open-zwave-%{version}
%if 0%{?suse_version} >= 1600
%patch -P0 -p1
%else
%patch0 -p1
%endif
#%patch1 -p1 -F 99

%build
major_ver=$(echo %{version} | awk -F \. {'print $1'})
minor_ver=$(echo %{version} | awk -F \. {'print $2'})
# revision=$(echo %{version} | awk -F \. {'print $3'})
revision=0
VERSION_MAJ=$major_ver VERSION_MIN=${minor_ver%~pre} VERSION_REV=$revision PREFIX=/usr sysconfdir=%{_sysconfdir}/openzwave/ includedir=%{_includedir} docdir=%{_defaultdocdir}/openzwave-%{version} instlibdir=%{_libdir} pkgconfigdir=%{_libdir}/pkgconfig/ make CPPFLAGS="-fPIC -Wno-error=nonnull"

%install
major_ver=$(echo %{version} | awk -F \. {'print $1'})
minor_ver=$(echo %{version} | awk -F \. {'print $2'})
# revision=$(echo %{version} | awk -F \. {'print $3'})
revision=0
mkdir -p %{buildroot}/%{_bindir}
mkdir -p %{buildroot}/%{_libdir}
mkdir -p %{buildroot}/%{_defaultdocdir}/openzwave-%{version}/
mkdir -p %{buildroot}/%{_sysconfdir}/
mkdir -p %{buildroot}/%{_includedir}/openzwave/
DESTDIR=%{buildroot} VERSION_MAJ=$major_ver VERSION_MIN=${minor_ver%~pre} VERSION_REV=$revision PREFIX=/usr sysconfdir=%{_sysconfdir}/openzwave/ includedir=%{_includedir}/openzwave/ docdir=%{_defaultdocdir}/openzwave-%{version} instlibdir=%{_libdir} pkgconfigdir=%{_libdir}/pkgconfig/ make install
cp -p INSTALL %{buildroot}/%{_defaultdocdir}/openzwave-%{version}/
cp -p LICENSE %{buildroot}/%{_defaultdocdir}/openzwave-%{version}/
rm %{buildroot}%{_defaultdocdir}/openzwave-%{version}/ChangeLog.old
rm %{buildroot}%{_defaultdocdir}/openzwave-%{version}/Doxyfile.in
rm -rf %{buildroot}%{_defaultdocdir}/openzwave-%{version}/html/
%fdupes -s %{buildroot}

%files
%defattr(-,root,root,-)
%{_libdir}/libopenzwave.so.*
%dir %{_defaultdocdir}/openzwave-%{version}
%doc %{_defaultdocdir}/openzwave-%{version}/default.htm
%doc %{_defaultdocdir}/openzwave-%{version}/general/
%doc %{_defaultdocdir}/openzwave-%{version}/images+css/
%doc %{_defaultdocdir}/openzwave-%{version}/LICENSE
%doc %{_defaultdocdir}/openzwave-%{version}/INSTALL
%config(noreplace) %{_sysconfdir}/openzwave/

%files -n libopenzwave-devel
%defattr(-,root,root,-)
%{_bindir}/ozw_config
%{_includedir}/openzwave/
%{_libdir}/libopenzwave.so
%{_libdir}/pkgconfig/libopenzwave.pc
%dir %{_defaultdocdir}/openzwave-%{version}
%doc %{_defaultdocdir}/openzwave-%{version}/api/

%files -n openzwave
%defattr(-,root,root,-)
%{_bindir}/MinOZW

%post
/sbin/ldconfig 

%post -n libopenzwave-devel
/sbin/ldconfig 

%postun
/sbin/ldconfig 

%changelog
openSUSE Build Service is sponsored by