File ada-url.spec of Package ada-url

%define __builder ninja
%global flavor @BUILD_FLAVOR@%{nil}
%if "%{flavor}" == "static"
%bcond_with shared
%else
%bcond_without shared
%endif

Name:    ada-url
Version: 3.3.0
Release: 0
Summary: WHATWG-compliant and fast URL parser written in modern C++
URL:     https://github.com/%{name}/ada/archive/refs/tags/v3.3.0.tar.gz
License: Apache-2.0 AND MIT
Source0: ada-%{version}.tar.gz

BuildRequires: ninja
BuildRequires: cmake
BuildRequires: gcc-c++


%description
Ada is a fast and spec-compliant URL parser written in C++.
Specification for URL parser can be found from the WHATWG website.

Ada library also includes a URLPattern implementation that is compatible with the web-platform tests.
The Ada library passes the full range of tests from the specification,
across a wide range of platforms (e.g., Windows, Linux, macOS).
It fully supports the relevant Unicode Technical Standard.


%package devel
Summary:  Development files for %{name}
Requires: %{name} = %{version}-%{release}


%description devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.


%package devel-static
Summary:  Static library for %{name}
Conflicts: %{name}-devel = %{version}-%{release}


%description devel-static
This package provides the static library for %{name}.


%prep
%autosetup -n ada-%{version} -p1


%build
%if %{without shared}
%global _lto_cflags %{_lto_cflags} -ffat-lto-objects
%endif
%cmake -DBUILD_SHARED_LIBS=%{?with_shared:ON}%{!?with_shared:OFF} \
       -DCMAKE_BUILD_TYPE=Release
%cmake_build


%install
%cmake_install
rm -rf %{buildroot}%{_libdir}/pkgconfig


%if %{with shared}
%post   -n %{name} -p /sbin/ldconfig
%postun -n %{name} -p /sbin/ldconfig
%endif

%check
%ctest


%if %{with shared}

%files
%license LICENSE-MIT LICENSE-APACHE
%doc README.md
%{_libdir}/libada.so.3*

%files devel
%{_libdir}/libada.so
%{_libdir}/cmake/ada/
%{_includedir}/ada/
%{_includedir}/ada.h
%{_includedir}/ada_c.h

%else

%files devel-static
%license LICENSE-MIT LICENSE-APACHE
%{_libdir}/libada.a
%{_libdir}/cmake/ada/
%{_includedir}/ada/
%{_includedir}/ada.h
%{_includedir}/ada_c.h

%endif

%changelog
openSUSE Build Service is sponsored by