Blame jsonnet.spec

949f392
%global         so_version   0
949f392
949f392
Name:           jsonnet
949f392
Version:        0.17.0
711ff4e
Release:        3%{?dist}
3131367
Summary:        A data templating language based on JSON
949f392
949f392
# The bundled MD5 library is RSA licenced
949f392
License:        ASL 2.0 and RSA
949f392
949f392
URL:            https://github.com/google/jsonnet
949f392
Source0:        %{url}/archive/v%{version}/%{name}-%{version}.tar.gz
949f392
33b7a40
# Downstream man pages in groff_man(7) format
33b7a40
Source1:        jsonnet.1
33b7a40
Source2:        jsonnetfmt.1
33b7a40
949f392
# Upstream wants to build single source wheels
949f392
# these benefit from static linking,
949f392
# but we want to link to libjsonnet here so we are sharing the lib
949f392
Patch0001:      0001-Dynamic-link-to-libjsonnet-rather-than-static.patch
949f392
Patch0002:      0002-jsonnet-0.17.0-do-not-override-compiler-flags.patch
949f392
949f392
949f392
# Bundled MD5 C++ class with very permissive license (RSA)
949f392
# rpmlint must be notified of the unversioned provides
949f392
Provides:       bundled(md5-thilo)
949f392
949f392
BuildRequires:  python3-devel
949f392
BuildRequires:  python3-setuptools
949f392
949f392
BuildRequires:  bash cmake gcc gcc-c++ gtest-devel make
949f392
949f392
# json is header only, so note the static lib for tracking
949f392
BuildRequires:  json-devel json-static
949f392
949f392
# Set our toplevel runtime requirements
949f392
Requires:       %{name}-libs%{?_isa} = %{version}-%{release}
949f392
949f392
%global _description %{expand:
949f392
A data templating language for app and tool developers based on JSON}
949f392
949f392
%description %{_description}
949f392
949f392
949f392
%package -n python3-%{name}
949f392
Summary:        %{name} Bindings for Python
949f392
Requires:       %{name}-libs%{?_isa} = %{version}-%{release}
949f392
949f392
%description -n python3-%{name} %{_description}
949f392
949f392
949f392
%package libs
949f392
Summary:        Shared Libraries for %{name}
949f392
949f392
%description libs %{_description}
949f392
949f392
949f392
%package devel
949f392
Summary:        Development Headers for %{name}
949f392
Requires:       %{name}-libs%{?_isa} = %{version}-%{release}
949f392
949f392
%description devel %{_description}
949f392
949f392
949f392
%package doc
949f392
Summary:        Documentation for %{name}
949f392
License:        CC-BY
949f392
BuildArch:      noarch
949f392
949f392
%description doc %{_description}
949f392
949f392
949f392
%prep
949f392
%autosetup
949f392
949f392
# use system json lib instead
949f392
rm -rfv third_party/json/*
949f392
949f392
# don't bundel rapidyaml
949f392
rm -rfv third_party/rapidyaml/*
949f392
949f392
# don't bundle thirdparty doc resources
949f392
# this leaves the doc "unbuilt" but still sorta useful
949f392
rm -rf doc/third_party
949f392
rm -rf doc/.gitignore
949f392
949f392
949f392
%build
949f392
949f392
%if 0%{?rhel} == 8
949f392
# required macro drop for EL8
949f392
%undefine __cmake_in_source_build
949f392
%endif
949f392
949f392
949f392
# FIXME:
949f392
# For reasons I'm not following, json-devel isn't added to include by cmake
949f392
#
949f392
# explicitly set -fPIC so python can pick it up later on
949f392
export CXXFLAGS="%{optflags} -fPIC -I%{_includedir}/nlohmann"
949f392
949f392
# setup our build environment
949f392
%cmake -DBUILD_SHARED_BINARIES:BOOL=ON -DBUILD_STATIC_LIBS:BOOL=OFF -DUSE_SYSTEM_JSON:BOOL=ON -DUSE_SYSTEM_GTEST:BOOL=ON
949f392
949f392
# make tools and headers
949f392
%cmake_build
949f392
949f392
# make python binding
949f392
%{py3_build}
949f392
949f392
949f392
%install
949f392
%{cmake_install}
949f392
949f392
# install python binding
949f392
%{py3_install}
949f392
33b7a40
install -d '%{buildroot}%{_mandir}/man1'
33b7a40
install -t '%{buildroot}%{_mandir}/man1' -p -m 0644 '%{SOURCE1}' '%{SOURCE2}'
33b7a40
949f392
949f392
%check
949f392
%ctest
949f392
949f392
949f392
%files
949f392
%{_bindir}/jsonnet
949f392
%{_bindir}/jsonnetfmt
33b7a40
%{_mandir}/man1/jsonnet.1*
33b7a40
%{_mandir}/man1/jsonnetfmt.1*
949f392
949f392
%files libs
949f392
%license LICENSE
949f392
%doc README.md
949f392
%{_libdir}/lib%{name}*.so.%{so_version}
949f392
%{_libdir}/lib%{name}*.so.%{version}
949f392
949f392
%files devel
949f392
%{_includedir}/lib%{name}*
949f392
%{_libdir}/lib%{name}*.so
949f392
949f392
%files -n python3-%{name}
949f392
# rpmlint must be notified this is not versioned on purpose
949f392
%{python3_sitearch}/_%{name}*.so
949f392
%{python3_sitearch}/%{name}-%{version}-py%{python3_version}.egg-info
949f392
949f392
%files doc
949f392
%license LICENSE
949f392
%doc README.md
949f392
%doc CONTRIBUTING
949f392
%doc doc
949f392
%doc examples
949f392
# don't package up the self-check script
949f392
%exclude %{_docdir}/%{name}-doc/examples/*.sh
949f392
949f392
949f392
%changelog
711ff4e
* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.17.0-3
711ff4e
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
711ff4e
33b7a40
* Fri Jun 25 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 0.17.0-2
33b7a40
- Add downstream man pages
3131367
- Fix Summary
33b7a40
949f392
* Thu Jun 17 2021 Pat Riehecky <riehecky@fnal.gov> - 0.17.0-1
949f392
- Initial package.