File passwordsafe.spec of Package passwordsafe

#
# spec file for package passwordsafe
#
# Copyright (c) 2014 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/
#

%bcond_without passwordsafe_yubikey

Name:           passwordsafe
Version:        1.03~beta
Release:        0
%define pkg_branch  1.03
%define pkg_version 1.03BETA
License:        Artistic-2.0
Summary:        A password database utility
Url:            https://github.com/pwsafe/pwsafe
Group:          Productivity/Security
Source:         pwsafe-%{pkg_version}.tar.gz
Patch:          pwsafe-1.02BETA_helpdir.patch
Requires:       ykpers
BuildRequires:  gcc-c++
BuildRequires:  libuuid-devel
BuildRequires:  libxerces-c-devel
BuildRequires:  libXt-devel
BuildRequires:  libXtst-devel
BuildRequires:  wxWidgets-devel >= 3
BuildRequires:  zip
%if %{with passwordsafe_yubikey}
BuildRequires:  libyubikey-devel
BuildRequires:  libykpers-devel
BuildRequires:  qrencode-devel
%endif
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Password Safe is a password database utility. Like many other such
products, commercial and otherwise, it stores your passwords in an
encrypted file, allowing you to remember only one password (the "safe
combination"), instead of all the username/password combinations that
you use.

%prep
%setup -q -n pwsafe-%{pkg_version}
%patch -p1

FAKE_BUILDDATE=$(LC_ALL=C date -u -r %{_sourcedir}/%{name}.changes '+%%b %%e %%Y')
FAKE_BUILDTIME=$(LC_ALL=C date -u -r %{_sourcedir}/%{name}.changes '+%%H:%%M:%%S')
sed -i -e "s/__DATE__/\"$FAKE_BUILDDATE\"/" -e "s/__TIME__/\"$FAKE_BUILDTIME\"/" src/ui/wxWidgets/about.cpp

%build
%if ! %{with passwordsafe_yubikey}
export NO_YUBI=1
%endif
export CFLAGS="%{optflags}"
export CXXFLAGS="%{optflags}"
make %{?_smp_mflags} rpmbuild
# appending the CFLAGS/CXXFLAGS to the make commandline breaks the build
# CFLAGS="%%{optflags}" CXXFLAGS="%%{optflags}"

%install
install -D -m 755 src/ui/wxWidgets/GCCUnicodeRelease/pwsafe %{buildroot}%{_bindir}/pwsafe
install -D -m 644 install/desktop/fedora-pwsafe.desktop     %{buildroot}%{_datadir}/applications/pwsafe.desktop
install -D -m 644 install/graphics/pwsafe.png               %{buildroot}%{_datadir}/icons/hicolor/48x48/apps/pwsafe.png
install -D -m 644 docs/pwsafe.1                             %{buildroot}%{_mandir}/man1/pwsafe.1
install -D -d -m 0755                                       %{buildroot}%{_datadir}/pwsafe/xml/
install -m 644 xml/*                                        %{buildroot}%{_datadir}/pwsafe/xml/
install -D -d -m 0755                                       %{buildroot}%{_datadir}/pwsafe/help/
install -D -m 644 help/help*.zip                            %{buildroot}%{_datadir}/pwsafe/help/
install -D -d -m 0755                                       %{buildroot}%{_datadir}/locale/
cp -a src/ui/wxWidgets/I18N/mos/*                           %{buildroot}%{_datadir}/locale/
%find_lang pwsafe

%files -f pwsafe.lang
%defattr(-,root,root)
%doc docs/ReleaseNotes.txt docs/ChangeLog.txt LICENSE install/copyright
%{_bindir}/pwsafe
%{_datadir}/applications/pwsafe.desktop
%{_datadir}/icons/hicolor/48x48/apps/pwsafe.png
%{_mandir}/man1/pwsafe.1*
%{_datadir}/pwsafe/

%changelog