File vcpkg-tool.spec of Package vcpkg-tool

#
# spec file for package vcpkg-tool
#
# Copyright (c) 2022 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 version_year 2022
%global version_month 09
%global version_day 20
%global repo_tag %{version_year}-%{version_month}-%{version_day}
Name:           vcpkg-tool
Version:        %{version_year}.%{version_month}.%{version_day}
Release:        0
Summary:        C++ Library Manager
License:        MIT
Group:          Productivity/Other
URL:            https://github.com/microsoft/vcpkg-tool
Source0:        https://github.com/microsoft/vcpkg-tool/archive/%{repo_tag}/%{name}-%{version}.tar.gz
Source1:        vcpkg.sh
BuildRequires:  cmake
BuildRequires:  gcc11-c++
BuildRequires:  ninja
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(catch2) >= 2.13.0
BuildRequires:  pkgconfig(fmt) >= 9.1.0
Requires:       cmake
Requires:       git-core
Requires:       ninja
Recommends:     aria2

%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/vcpkg.sh file
or unset the VCPKG_DISABLE_METRICS environment variable.

%prep
%autosetup -n vcpkg-tool-%{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
export CC=gcc-11
export CXX=g++-11
export CFLAGS="%{optflags} -fPIE -pie"
export CXXFLAGS="%{optflags} -fPIE -pie"
export LDFLAGS="-pie"
%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_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/vcpkg.sh"

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

%changelog
openSUSE Build Service is sponsored by