# Add generation of HMAC checksums of the final stripped binaries.
# %%define with lazy expansion is used here intentionally, because
# this needs to be expanded inside of a higher level macro that
# gets expanded itself.
%define __spec_install_post \
%{?__debug_package:%{__debug_install_post}} \
%{__arch_install_post} \
%{__os_install_post} \
bindir="%{buildroot}%{_bindir}" \
fipsdir="%{buildroot}%{_libdir}/fipscheck" \
mkdir -p "$fipsdir" \
fipshmac -d "$fipsdir" "$bindir/%{name}" \
%{nil}
# Build and package Doxygen documentation?
%bcond_without doxy
# Enable full binary hardening by default.
%global _hardened_build 1
# Init forge packaging helpers.
%global forgeurl https://github.com/Governikus/%{name}
# Package summary. Gets overwritten by subpackages otherwise.
%global pkg_sum Online identification with German ID card (Personalausweis)
Name: AusweisApp2
Version: 1.14.3
Release: 2%{?dist}
Summary: %{pkg_sum}
License: EUPL 1.2
URL: https://www.ausweisapp.bund.de/en
Source0000: %{forgeurl}/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source0001: %{name}-%{version}-notes_html.tar.xz
Source0002: %{name}-%{version}-sdk_html.tar.xz
Source0003: %{name}.metainfo.xml
Source0004: https://joinup.ec.europa.eu/sites/default/files/custom-page/attachment/2020-03/EUPL-1.2%%20EN.txt#/EUPL-12_EN.txt
# Upstreamed.
Patch00001: %{forgeurl}/pull/28.patch#/%{name}-1.14.3-doxygen_exclude_build_dir.patch
# Downstream.
Patch01000: %{name}-1.14.3-CMake_warning.patch
Patch01001: %{name}-1.14.3-config_h_fix_static_assert_base_file.patch
Patch01002: %{name}-1.14.3-use_datadir.patch
Patch01003: %{name}-1.14.3-disable_online_update.patch
Patch01004: %{name}-1.14.3-desktop_file.patch
BuildRequires: cmake3
BuildRequires: desktop-file-utils
BuildRequires: devtoolset-9
BuildRequires: fipscheck
BuildRequires: help2man
BuildRequires: http-parser-devel
BuildRequires: java-openjdk-headless
BuildRequires: libappstream-glib
BuildRequires: libudev-devel
BuildRequires: ninja-build
BuildRequires: openssl-devel
BuildRequires: pcsc-lite-devel
BuildRequires: qt5-linguist
BuildRequires: qt5-qtbase-devel
BuildRequires: qt5-qtconnectivity-devel
BuildRequires: qt5-qtdeclarative-devel
BuildRequires: qt5-qtquickcontrols2-devel
BuildRequires: qt5-qtsvg-devel
BuildRequires: qt5-qtwebsockets-devel
# Lowercase package name.
%global lc_name %{lua:print(string.lower(rpm.expand("%{name}")))}
# Provide the lowercase name for convenience as well.
Provides: %{lc_name} = %{version}-%{release}
Provides: %{lc_name}%{?_isa} = %{version}-%{release}
Requires: %{name}-data = %{version}-%{release}
%description
The AusweisApp2 is a software to identify yourself online
with your ID card (Personalausweis) or your electronic
residence permit (Aufenthalts- / Niederlassungserlaubis).
The AusweisApp2 also offers you an integrated self-assessment
in which you are able to view your data that is stored on the
online ID.
%package data
Summary: Architecture-independent files used by %{name}
BuildArch: noarch
Requires: %{name} = %{version}-%{release}
Requires: hicolor-icon-theme
%description data
This package contains the architecture-independent files
used by %{name}.
%package doc
Summary: User and API-documentation for %{name}
BuildArch: noarch
%if %{with doxy}
BuildRequires: doxygen
BuildRequires: graphviz
%endif
BuildRequires: hardlink
Requires: %{name} = %{version}-%{release}
%description doc
This package contains the User and API-documentation for %{name}.
%prep
%autosetup -p 1
install -pm 0644 %{SOURCE4} LICENSE.en.txt
%build
# We need GCC >= 4.9 for building.
source /opt/rh/devtoolset-9/enable
# The project does not ship any libraries that are meant to be
# consumed externally. Thus we disable shared libs explicitly.
# See: https://github.com/Governikus/AusweisApp2/pull/24
# and: https://github.com/Governikus/AusweisApp2/pull/26
%cmake3 \
-DBUILD_SHARED_LIBS:BOOL=OFF \
-DBUILD_TESTING:BOOL=OFF \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DFORCE_LEGACY_OPENSSL:BOOL=ON \
-DSELFPACKER:BOOL=OFF \
-G Ninja \
-S . -B %{_vpath_builddir}
%ninja_build -C %{_vpath_builddir}
# Documentation.
%if %{with doxy}
%ninja_build -C %{_vpath_builddir} doxy
%endif
%install
%ninja_install -C %{_vpath_builddir}
# Move installed files to proper locations.
mkdir -p %{buildroot}%{_datadir}/%{name} %{buildroot}%{_qt5_translationdir}
mv %{buildroot}%{_bindir}/%{name}.rcc %{buildroot}%{_bindir}/config.json \
%{buildroot}%{_bindir}/qtlogging.ini %{buildroot}%{_datadir}/%{name}
mv %{buildroot}%{_prefix}/translations/* %{buildroot}%{_qt5_translationdir}
rm -fr %{buildroot}%{_prefix}/translations
# Install the icon-theme file.
mkdir -p %{buildroot}%{_datadir}/icons/hicolor/scalable/apps
install -pm 0644 resources/images/npa.svg \
%{buildroot}%{_datadir}/icons/hicolor/scalable/apps/%{name}.svg
# Install the metainfo.xml file.
mkdir -p %{buildroot}%{_metainfodir}
install -pm 0644 %{SOURCE3} %{buildroot}%{_metainfodir}
# Generate man-page.
mkdir -p %{buildroot}%{_mandir}/man1
help2man \
--no-discard-stderr --no-info \
--manual="%{name}" --name="%{pkg_sum}" --section=1 \
--help-option="--platform offscreen --help" \
--version-option="--platform offscreen --version" \
--output=%{buildroot}%{_mandir}/man1/%{name}.1 \
%{buildroot}%{_bindir}/%{name}
# Excessive docs.
mkdir -p %{buildroot}%{_pkgdocdir}/notes \
%{buildroot}%{_pkgdocdir}/sdk
install -pm 0644 README.rst %{buildroot}%{_pkgdocdir}
%if %{with doxy}
mkdir -p %{buildroot}%{_pkgdocdir}/doxy
cp -a %{_vpath_builddir}/doc/html/* %{buildroot}%{_pkgdocdir}/doxy
%endif
tar xf %{SOURCE1} -C %{buildroot}%{_pkgdocdir}/notes
tar xf %{SOURCE2} -C %{buildroot}%{_pkgdocdir}/sdk
find %{buildroot}%{_pkgdocdir} -type d -print0 | xargs -0 chmod -c 0755
find %{buildroot}%{_pkgdocdir} -type f -print0 | xargs -0 chmod -c 0644
find %{buildroot}%{_pkgdocdir} -type f -name '.*' -delete -print
hardlink -cfv %{buildroot}%{_pkgdocdir}
# Find translation files.
%find_lang %{lc_name} --with-qt
%check
appstream-util validate-relax --nonet %{buildroot}%{_metainfodir}/*.metainfo.xml
desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop
%post data
/bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :
%postun data
if [ $1 -eq 0 ]; then
/bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null
/usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
fi
%posttrans data
/usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%files
%dir %{_libdir}/fipscheck
%dir %{_pkgdocdir}
%doc %{_pkgdocdir}/README.rst
%license AUTHORS
%license LICENSE.en.txt
%license LICENSE.txt
%{_bindir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_libdir}/fipscheck/%{name}.hmac
%{_mandir}/man1/%{name}.1*
%{_metainfodir}/%{name}.metainfo.xml
%files data -f %{lc_name}.lang
%{_datadir}/%{name}
%{_datadir}/icons/hicolor/scalable/apps/%{name}.svg
%files doc
%doc %{_pkgdocdir}
%changelog
* Tue Aug 25 2020 Björn Esser <besser82@fedoraproject.org> - 1.14.3-2
- Add pre-built user documentation to the doc package
* Thu Aug 20 2020 Björn Esser <besser82@fedoraproject.org> - 1.14.3-1
- Initial import (#1851205)