File vortex-mingw-eid-mw.spec of Package vortex-2024-05-mingw64-eid-mw
# MinGW header
%{?mingw_package_header}
# build 64-bit only
%global mingw_build_win32 0
# bundle name
%define bundle_name 2024-05
%define archive_file eid-mw-master-20220915.tgz
%define archive_dir eid-mw
# upstream version
%global major_version 5
%global minor_version 0
%global patch_version 7
%global arch_triplet %(/vortex/mingw-2022/usr/bin/x86_64-w64-mingw32-gcc -dumpmachine)
%global install_dir /vortex/%{arch_triplet}/%{bundle_name}
%global host_arch_triplet %(gcc -dumpmachine)
%global host_install_dir /vortex/%{host_arch_triplet}/%{bundle_name}
# ================= IT SHOULD NOT BE NECESSARY TO MAKE CHANGES BELOW ==============================
# ==================
# Top-level metadata
# ==================
Name: vortex-%{bundle_name}-mingw64-eid-mw
Summary: Custom Vortex eID middleware build for windows using MinGW
URL: https://github.com/Fedict/eid-mw
License: LGPL
Version: %{major_version}.%{minor_version}.%{patch_version}
# release number will be determined by OBS
Release: 0.0
# =======================
# Build-time requirements
# =======================
BuildRequires: vortex-devel-cmake
BuildRequires: mingw64-2022-filesystem >= 110
BuildRequires: mingw64-2022-binutils
BuildRequires: mingw64-2022-headers
BuildRequires: mingw64-2022-gcc-c++
# =======================
# Source code and patches
# =======================
Source0: %{archive_file}
Source1: CMakeLists.txt
# ==========================================
# Descriptions, and metadata for subpackages
# ==========================================
%description
Custom Vortex eID middleware build for windows using MinGW.
# ======================================================
# The prep phase of the build:
# ======================================================
# This is required to supress rpmbuild error for files section
%global debug_package %{nil}
%prep
cd %{_topdir}/BUILD
%setup -n %{archive_dir}
cp %{SOURCE1} cardcomm/pkcs11/src
# ======================================================
# Configuring and building the code:
# ======================================================
%build
PATH=/vortex/mingw-2022/usr/bin:$PATH
cd ..
mkdir build_win64
pushd build_win64
# PATH for cmake >= 3.16
PATH=/vortex/%{host_arch_triplet}/devel/bin:$PATH
pwd
cmake \
-DCMAKE_TOOLCHAIN_FILE=/vortex/mingw-2022/usr/share/mingw/toolchain-mingw64.cmake \
-DCMAKE_BUILD_TYPE=RelWidthDebInfo \
-DCMAKE_INSTALL_PREFIX=%{install_dir} \
../%{archive_dir}/cardcomm/pkcs11/src
cmake --build . --parallel
popd
# ======================================================
# Installing the built code:
# ======================================================
%install
PATH=/vortex/mingw-2022/usr/bin:$PATH
PATH=/vortex/%{host_arch_triplet}/devel/bin:$PATH
rm -rf $RPM_BUILD_ROOT
cd ../build_win64
DESTDIR=%{buildroot} cmake --install .
%files
%{install_dir}
/usr/lib/debug