File vcpkg.spec of Package vcpkg

#
# spec file for package vcpkg
#
# Copyright (c) 2023 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#


%global repo_name vcpkg-tool
%global repo_tag 2023-03-29
Name:           vcpkg
Version:        %(echo %{repo_tag} | sed 's/-/./g')
Release:        0
Summary:        C++ Library Manager
License:        MIT
Group:          Development/Tools/Building
URL:            https://github.com/microsoft/%{repo_name}
Source0:        https://github.com/microsoft/%{repo_name}/archive/%{repo_tag}/%{name}-%{version}.tar.gz
Source1:        %{name}.sh
BuildRequires:  cmake
BuildRequires:  cmrc-devel
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(catch2) >= 2.13.0
BuildRequires:  pkgconfig(fmt) < 10.0.0
BuildRequires:  pkgconfig(fmt) >= 9.1.0
Requires:       cmake
Requires:       git-core
Recommends:     aria2
%if 0%{?suse_version} <= 1500
BuildRequires:  gcc12-c++
%else
BuildRequires:  gcc-c++
%endif
%if 0%{?suse_version} <= 1500
Requires:       gcc12-c++
%else
Requires:       gcc-c++
%endif
Provides:       vcpkg-tool

%description
Vcpkg is a package manager for the different C and C++ libraries.

Vcpkg can collect usage data. The data collected by Microsoft is anonymous.

Fedora package has telemetry disabled by default. If you want to enable
telemetry, you should remove the %{_sysconfdir}/profile.d/%{name}.sh file
or unset the VCPKG_DISABLE_METRICS environment variable.

%prep
%autosetup -n %{repo_name}-%{repo_tag} -p1

# Fixing line endings...
sed -e "s,\r,," -i README.md

# Unbundling catch...
rm -rf include/catch2
ln -svf %{_includedir}/catch2/ include/

%build
%if 0%{?suse_version} <= 1500
export CC=gcc-12
export CXX=g++-12
%endif
%cmake \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_SKIP_INSTALL_RPATH:BOOL=ON \
    -DBUILD_TESTING:BOOL=OFF \
    -DVCPKG_BASE_VERSION:STRING=%{repo_tag} \
    -DVCPKG_VERSION:STRING=%{repo_tag} \
    -DVCPKG_DEVELOPMENT_WARNINGS:BOOL=OFF \
    -DVCPKG_WARNINGS_AS_ERRORS:BOOL=OFF \
    -DVCPKG_DEPENDENCY_CMAKERC:BOOL=ON \
    -DVCPKG_DEPENDENCY_EXTERNAL_FMT:BOOL=ON \
    -DVCPKG_BUILD_TLS12_DOWNLOADER:BOOL=OFF \
    -DVCPKG_BUILD_FUZZING:BOOL=OFF \
    -DVCPKG_EMBED_GIT_SHA:BOOL=OFF \
    -DVCPKG_BUILD_BENCHMARKING:BOOL=OFF \
    -DVCPKG_ADD_SOURCELINK:BOOL=OFF
%cmake_build

%install
%cmake_install

# Installing environment options override...
install -D -m 0644 -p "%{SOURCE1}" "%{buildroot}%{_sysconfdir}/profile.d/%{name}.sh"

%files
%doc README.md
%license LICENSE.txt NOTICE.txt
%{_bindir}/%{name}
%config(noreplace) %{_sysconfdir}/profile.d/%{name}.sh

%changelog
openSUSE Build Service is sponsored by