Blob Blame History Raw
%global         so_version   0

Name:           jsonnet
Version:        0.17.0
Release:        3%{?dist}
Summary:        A data templating language based on JSON

# The bundled MD5 library is RSA licenced
License:        ASL 2.0 and RSA

Source0:        %{url}/archive/v%{version}/%{name}-%{version}.tar.gz

# Downstream man pages in groff_man(7) format
Source1:        jsonnet.1
Source2:        jsonnetfmt.1

# Upstream wants to build single source wheels
# these benefit from static linking,
# but we want to link to libjsonnet here so we are sharing the lib
Patch0001:      0001-Dynamic-link-to-libjsonnet-rather-than-static.patch
Patch0002:      0002-jsonnet-0.17.0-do-not-override-compiler-flags.patch

# Bundled MD5 C++ class with very permissive license (RSA)
# rpmlint must be notified of the unversioned provides
Provides:       bundled(md5-thilo)

BuildRequires:  python3-devel
BuildRequires:  python3-setuptools

BuildRequires:  bash cmake gcc gcc-c++ gtest-devel make

# json is header only, so note the static lib for tracking
BuildRequires:  json-devel json-static

# Set our toplevel runtime requirements
Requires:       %{name}-libs%{?_isa} = %{version}-%{release}

%global _description %{expand:
A data templating language for app and tool developers based on JSON}

%description %{_description}

%package -n python3-%{name}
Summary:        %{name} Bindings for Python
Requires:       %{name}-libs%{?_isa} = %{version}-%{release}

%description -n python3-%{name} %{_description}

%package libs
Summary:        Shared Libraries for %{name}

%description libs %{_description}

%package devel
Summary:        Development Headers for %{name}
Requires:       %{name}-libs%{?_isa} = %{version}-%{release}

%description devel %{_description}

%package doc
Summary:        Documentation for %{name}
License:        CC-BY
BuildArch:      noarch

%description doc %{_description}


# use system json lib instead
rm -rfv third_party/json/*

# don't bundel rapidyaml
rm -rfv third_party/rapidyaml/*

# don't bundle thirdparty doc resources
# this leaves the doc "unbuilt" but still sorta useful
rm -rf doc/third_party
rm -rf doc/.gitignore


%if 0%{?rhel} == 8
# required macro drop for EL8
%undefine __cmake_in_source_build

# For reasons I'm not following, json-devel isn't added to include by cmake
# explicitly set -fPIC so python can pick it up later on
export CXXFLAGS="%{optflags} -fPIC -I%{_includedir}/nlohmann"

# setup our build environment

# make tools and headers

# make python binding


# install python binding

install -d '%{buildroot}%{_mandir}/man1'
install -t '%{buildroot}%{_mandir}/man1' -p -m 0644 '%{SOURCE1}' '%{SOURCE2}'



%files libs
%license LICENSE

%files devel

%files -n python3-%{name}
# rpmlint must be notified this is not versioned on purpose

%files doc
%license LICENSE
%doc doc
%doc examples
# don't package up the self-check script
%exclude %{_docdir}/%{name}-doc/examples/*.sh

* Thu Jul 22 2021 Fedora Release Engineering <> - 0.17.0-3
- Rebuilt for

* Fri Jun 25 2021 Benjamin A. Beasley <> - 0.17.0-2
- Add downstream man pages
- Fix Summary

* Thu Jun 17 2021 Pat Riehecky <> - 0.17.0-1
- Initial package.