%bcond_with clang

Name: aws-sdk-cpp
Version: 1.11.462
Release: 1%{dist}
License: Apache-2.0
Summary: AWS SDK for C++
URL:     https://github.com/aws/aws-sdk-cpp

Source0: https://github.com/aws/aws-sdk-cpp/archive/refs/tags/%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1: requires-devel.spec
Source2: subpackages.spec

# Taken from Alpine prepare()
Patch0:  aws-cpp-sdk-add-version-suffix-to-libs.patch

BuildRequires: cmake
BuildRequires: ninja-build
%if %{with clang}
BuildRequires: clang >= 3.3
%else
BuildRequires: gcc-c++ >= 4.9
%endif
BuildRequires: libcurl-devel
BuildRequires: zlib-devel
BuildRequires: pkgconfig(libpulse)

BuildRequires: aws-c-common-devel
BuildRequires: aws-c-s3-devel
BuildRequires: aws-c-io-devel
BuildRequires: aws-c-auth-devel
BuildRequires: aws-c-event-stream-devel
BuildRequires: aws-checksums-devel
BuildRequires: aws-crt-cpp-devel


%description
The AWS SDK for C++ provides a modern C++ (version C++ 11 or later)
interface for Amazon Web Services (AWS).


%package devel
Summary: Amazon Web Services SDK for C++ (header files)
%include %{SOURCE1}

%description devel

%files devel
%{_libdir}/libaws-*.so
%{_libdir}/pkgconfig/aws-cpp-sdk-*.pc
%{_libdir}/cmake/AWSSDK/*
%{_libdir}/cmake/aws-cpp-sdk-*/*.cmake
%{_includedir}/aws/*
%{_includedir}/smithy/*

%include %{SOURCE2}

%prep
%autosetup -p1

%build
%if %{with clang}
export CC=clang
export CXX=clang++
%endif

%cmake -G Ninja \
    -DBUILD_SHARED_LIBS=ON \
    -DBUILD_DEPS=OFF \
    -DCUSTOM_MEMORY_MANAGEMENT=OFF \
    -DENABLE_TESTING=OFF \
    -DAUTORUN_UNIT_TESTS=OFF


%cmake_build

%install
%cmake_install

