File openssl-engine-gost.spec of Package openssl-engine-gost

%define realname gost-engine
%define srcext   tar.bz2

%define engine_dir %(eval $(openssl version -e | sed "s/: */=/"); echo $ENGINESDIR)
%define module_dir %(eval $(openssl version -m | sed "s/: */=/"); echo $MODULESDIR)

# Common info
Name:          openssl-engine-gost
Version:       0
Release:       wiz%{?extraver:0.}1%{?dist}
License:       Apache-2.0
Group:         Productivity/Networking/Security
URL:           https://github.com/gost-engine/engine
Summary:       GOST engine for OpenSSL

# Build-time parameters
BuildRequires: cmake >= 3.18
BuildRequires: ninja
BuildRequires: pkg-config
BuildRequires: pkgconfig(libcrypto) >= 3.0
BuildRoot:     %{_tmppath}/%{name}-root
Source:        %{realname}-%{version}.%{srcext}

%description
A reference implementation of the Russian GOST crypto algorithms for OpenSSL.

This engine provides an implementation of various Russian cryptographic
algorithms, known generally as GOST cryptographic algorithms (see detailed list
below). These algorithms can be used both via OpenSSL command line tools and
via high-level libopenssl calls.

OpenSSL GOST Engine also includes 'gostsum' and 'gost12sum' command line tools
for generating and checking GOST R34.11-94 and GOST R34.11-2012 hashsums.
They have the same purposes and behavior as the well-known sha1sum and md5sum
utilities. These utilities can be used independently from OpenSSL.

%prep
%setup -q -n %{realname}-%{version}%{?extraver}

%build
_CFLAGS='%{optflags} %{?gcc_lto}'
_LDFLAGS='-Wl,--as-needed -Wl,--strip-all -Wl,--no-undefined -Wl,-z,defs -Wl,-z,noexecstack -Wl,-z,now -Wl,-z,relro %{?gcc_lto}'
_CMAKE_ARGS=(
 -G Ninja \
 -Wno-dev
 -DCMAKE_INSTALL_PREFIX=%{_prefix}
 -DCMAKE_INSTALL_SYSCONFDIR=%{_sysconfdir}
 -DCMAKE_BUILD_TYPE=Release
 -DCMAKE_C_FLAGS_RELEASE="$_CFLAGS"
 -DCMAKE_EXE_LINKER_FLAGS_RELEASE="$_LDFLAGS"
 -DCMAKE_MODULE_LINKER_FLAGS_RELEASE="$_LDFLAGS"
 -DCMAKE_SHARED_LINKER_FLAGS_RELEASE="$_LDFLAGS"
 -DCMAKE_VERBOSE_MAKEFILE=YES
)
cmake -B build -S . \
 "${_CMAKE_ARGS[@]}"
ninja -v -C build %{?_smp_mflags}

%install
DESTDIR=%{buildroot} ninja -v -C build install
#%{__install} -D -m0755 bin/gost12sum %{buildroot}%{_bindir}/gost12sum
#%{__install}    -m0755 bin/gostsum   %{buildroot}%{_bindir}/gostsum
#%{__install} -D -m0755 bin/gost.so   %{buildroot}%{engine_dir}/gost.so
#%{__install} -D -m0644 gost12sum.1   %{buildroot}%{_mandir}/man1/gost12sum.1
#%{__install}    -m0644 gostsum.1     %{buildroot}%{_mandir}/man1/gostsum.1

%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}

%files
%defattr(-,root,root)
%license LICENSE
%doc README.* example.conf
%{_bindir}/gost12sum
%{_bindir}/gostsum
%{_libdir}/libgost.so
%{_libdir}/libgostprov.so
%{engine_dir}/gost.so
%{module_dir}/gostprov.so
%doc %{_mandir}/man1/*
%exclude %{_datadir}/cmake/

%changelog
openSUSE Build Service is sponsored by