File openzwave.spec of Package openzwave

#
# spec file for package openzwave
#
# Copyright (c) 2019 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 https://bugs.opensuse.org/
#


%define __global_ldflags %{nil}
%define soname 1_6
Name:           openzwave
Version:        1.6
Release:        1.0%{?dist}
Summary:        Sample Executables for Open-ZWave
License:        LGPL-3.0-or-later
Group:          Development/Libraries/C and C++
URL:            http://www.openzwave.net
Source0:        https://github.com/OpenZWave/open-zwave/archive/v%{version}/%{name}-%{version}.tar.gz
Patch0:         3b029a467e83bc7f0054e4dbba1e77e6eac7bc7f.patch
BuildRequires:  doxygen
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  graphviz
BuildRequires:  libudev-devel
BuildRequires:  libxml2-tools
BuildRequires:  make
BuildRequires:  pkgconfig
BuildRequires:  systemd-devel
BuildRequires:  tinyxml-devel
Requires:       libopenzwave%{soname} >= %{version}

%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.

%package -n libopenzwave%{soname}
Summary:        Library to access Z-Wave interfaces
Group:          Development/Libraries/C and C++
Requires(pre):  shadow

%description -n libopenzwave%{soname}
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.

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

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

%package -n libopenzwave-devel-doc
Summary:        Open-ZWave API documentation files
Group:          Development/Libraries/C and C++
Requires:       libopenzwave-devel = %{version}-%{release}

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

%prep
%setup -q -n open-zwave-%{version}
%patch0 -p1


%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
###CPPFLAGS="%%{optflags} -Wformat" LDFLAGS="%%{__global_ldflags}" USE_HID=0 USE_BI_TXML=0 VERSION_MAJ=$major_ver VERSION_MIN=$minor_ver VERSION_REV=$revision PREFIX=/usr sysconfdir=%%{_sysconfdir}/openzwave/ includedir=%%{_includedir} docdir=%%{_defaultdocdir}/openzwave-%%{version} instlibdir=%%{_libdir} make %%{?_smp_mflags}
LDFLAGS="%{__global_ldflags}" USE_HID=0 USE_BI_TXML=0 VERSION_MAJ=$major_ver VERSION_MIN=$minor_ver VERSION_REV=$revision PREFIX=%{_prefix} sysconfdir=%{_sysconfdir}/openzwave/ includedir=%{_includedir} docdir=%{_defaultdocdir}/openzwave-%{version} instlibdir=%{_libdir} make %{?_smp_mflags}



%install
rm -rf %{buildroot}/*
major_ver=$(echo %{version} | awk -F \. {'print $1'})
minor_ver=$(echo %{version} | awk -F \. {'print $2'})
revision=$(echo %{version} | awk -F \. {'print $3'})
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} USE_HID=0 USE_BI_TXML=0 VERSION_MAJ=$major_ver VERSION_MIN=$minor_ver VERSION_REV=$revision PREFIX=%{_prefix} sysconfdir=%{_sysconfdir}/openzwave/ includedir=%{_includedir}/openzwave/ docdir=%{_defaultdocdir}/openzwave-%{version} instlibdir=%{_libdir} make install
rm %{buildroot}%{_defaultdocdir}/openzwave-%{version}/Doxyfile.in
rm -rf %{buildroot}%{_defaultdocdir}/openzwave-%{version}/ChangeLog.old
rm -rf %{buildroot}%{_defaultdocdir}/openzwave-%{version}/html/
rm -rf %{buildroot}%{_defaultdocdir}/openzwave-%{version}/default.htm
rm -rf %{buildroot}%{_defaultdocdir}/openzwave-%{version}/general/
rm -rf %{buildroot}%{_defaultdocdir}/openzwave-%{version}/images+css/
rm -rf %{buildroot}%{_defaultdocdir}/openzwave-%{version}/api/
%fdupes -s %{buildroot}

%post -n libopenzwave%{soname}
/sbin/ldconfig
%postun -n libopenzwave%{soname}
/sbin/ldconfig
# pre is in upstream spec
#%%pre -n libopenzwave%%{soname}
#getent group zwave >/dev/null || groupadd -f -r zwave

%files
%{_bindir}/MinOZW

%files -n libopenzwave%{soname}
%license license/
%doc docs/default.htm docs/general/ docs/images+css/
%{_libdir}/libopenzwave.so.*
# upstream use defattr
#%%defattr(664, root, zwave, 775)
%dir %{_sysconfdir}/openzwave/
%config(noreplace) %{_sysconfdir}/openzwave/*

%files -n libopenzwave-devel
%{_bindir}/ozw_config
%{_includedir}/openzwave/
%{_libdir}/libopenzwave.so
%{_libdir}/pkgconfig/libopenzwave.pc

%files -n libopenzwave-devel-doc
%doc docs/api/

%changelog
openSUSE Build Service is sponsored by