File libu2f-host.spec of Package libu2f-host

#
# spec file for libu2f-host
#
# Copyright (c) 2015 SUSE LINUX Products 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/
#

%define soname  0

Name:           libu2f-host
Version:        1.0.0
Release:        0
Summary:        Yubico Universal 2nd Factor (U2F) Host C Library
Group:          Productivity/Networking/Security
License:        GPL-3.0+
Url:            https://developers.yubico.com/
Source0:        https://developers.yubico.com/libu2f-host/Releases/%{name}-%{version}.tar.xz
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  pkg-config
BuildRequires:  libtool
BuildRequires:  libhidapi-devel 
BuildRequires:  libzip
BuildRequires:  openssl-devel
BuildRequires:  pkgconfig(json-c) => 0.10
BuildRequires:  pkgconfig(openssl) 

%description
libu2f-host provide a command-line tool that implements
the host-side of the U2F protocol. There are APIs to talk to a U2F
device and perform the U2F Register and U2F Authenticate operations.

%package     -n %{name}%{soname}
Summary:        Library for Universal 2nd Factor (U2F)
Group:          Productivity/Networking/Security

%description -n %{name}%{soname}
Libu2f-host provide a C library that implements
the host-side of the U2F protocol.  There are APIs to talk to a U2F
device and perform the U2F Register and U2F Authenticate operations.

%package     -n %{name}-devel
Summary:        Development files for Universal 2nd Factor (U2F)
Group:          Development/Libraries/C and C++
Requires:       %{name}%{soname} = %{version}

%description -n %{name}-devel
This package contains the header file needed to develop applications that
use Universal 2nd Factor (U2F).

%package     -n u2f-host
Summary:        Tool to support Yubico's Universal 2nd Factor (U2F)
Group:          Productivity/Networking/Security
Requires:       %{name}%{soname} = %{version}

%description -n u2f-host

Command line tool that implements the host-side of the Universal 2nd Factor (U2F) protocol

%package        doc
Summary:        Doc-files for U2F protocol
Group:          Productivity/Networking/Security

%description    doc

Doc-files for the host-side of the U2F protocol.

%prep
%setup -q 

%build 
%configure --disable-static --with-openssl
# --disable-rpath doesn't work for the configure script
%{__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
# Fix path in u2f-host/u2f-host.h
%{__sed} -i 's|^#include <u2f-host|#include <u2f-host/u2f-host|g' u2f-host/u2f-host.h
%{__make}   %{?_smp_mflags}

%install
%{__make} install DESTDIR=$RPM_BUILD_ROOT INSTALL="%{__install} -p"
find %{buildroot}%{_libdir} -type f -name '*.la' -delete -print
%{__mkdir} -pv %{buildroot}%{_udevrulesdir}
install -D -m 644  ${RPM_BUILD_DIR}/%{name}-%{version}/70-u2f.rules %{buildroot}%{_udevrulesdir}

%post
%{?udev_rules_update:%udev_rules_update}

%post   -n %{name}%{soname} -p /sbin/ldconfig

%postun -n %{name}%{soname} -p /sbin/ldconfig

%files -n u2f-host
%defattr(-,root,root)
%doc AUTHORS COPYING NEWS ChangeLog README
%{_bindir}/u2f-host
%{_mandir}/man1/u2f-host.1.gz
%{_udevrulesdir}/*-u2f.rules

%files doc
%defattr(-,root,root)
%dir %{_datadir}/gtk-doc
%dir %{_datadir}/gtk-doc/html
%dir %{_datadir}/gtk-doc/html/u2f-host
%{_datadir}/gtk-doc/html/u2f-host/*

%files -n %{name}%{soname}
%defattr(-,root,root)
%{_libdir}/%{name}.so.%{soname}
%{_libdir}/%{name}.so.%{soname}.0.5

%files -n %{name}-devel
%defattr(-,root,root)
%dir %{_includedir}/u2f-host
%{_includedir}/u2f-host/u2f-host.h
%{_includedir}/u2f-host/u2f-host-types.h
%{_includedir}/u2f-host/u2f-host-version.h
%{_libdir}/%{name}.so
%{_libdir}/pkgconfig/*

%changelog
openSUSE Build Service is sponsored by