# The test suite isn't normally run as some of the test data must be downloaded # separately. It can be enabled with "--with=check". %bcond_without check # Upstream source information. %global upstream_owner AdaCore %global upstream_name sarif-ada %global upstream_commit_date 20251021 %global upstream_commit 4bc234ccccdd68813352c668a3c83ca82940f1b6 %global upstream_shortcommit %(c=%{upstream_commit}; echo ${c:0:7}) Name: sarif-ada Version: 0^git%{upstream_commit_date}.%{upstream_shortcommit} Release: %autorelease Summary: Ada library for parsing and producing SARIF reports License: Apache-2.0 WITH LLVM-Exception URL: https://github.com/%{upstream_owner}/%{upstream_name} Source0: %{url}/archive/%{upstream_commit}.tar.gz#/%{upstream_name}-%{upstream_shortcommit}.tar.gz # Official JSON schema (License?) Source1: https://docs.oasis-open.org/sarif/sarif/v2.1.0/os/schemas/sarif-schema-2.1.0.json # [Fedora-specific] Set the library so version. Patch: %{name}-set-library-so-version.patch BuildRequires: gcc-gnat gprbuild # A fedora-gnat-project-common that contains the new GPRinstall macro. BuildRequires: fedora-gnat-project-common >= 3.21 BuildRequires: vss-text-devel BuildRequires: vss-extra-devel # Build only on architectures where GPRbuild is available. ExclusiveArch: %{GPRbuild_arches} # VSS-Text and VSS-Extra aren't available for s390x. ExcludeArch: s390x %global common_description_en \ An Ada library generated with the JSON Schema for Ada tool for parsing and \ producing SARIF reports. %description %{common_description_en} ################# ## Subpackages ## ################# %package devel Summary: Development files for the SARIF Ada library Requires: %{name}%{?_isa} = %{version}-%{release} Requires: fedora-gnat-project-common Requires: vss-extra-devel %description devel %{common_description_en} This package contains source code and linking information for developing applications that use the SARIF Ada library. ############# ## Prepare ## ############# %prep %autosetup -C -p1 # Scenario variables for GRPbuild project. %global scn_vars %{shrink: -XVERSION=%{version} \ -XSARIF_BUILD_PROFILE=release \ -XSARIF_ADA_LIBRARY_TYPE=relocatable } # Regenerate sources using the JSON Schema for Ada tool. rm -rf src/generated/* gen_json --root-package SARIF.Types \ --enum-package Enum --root-type Root \ --additional-properties \ --header-file src/header.adt \ %{SOURCE1} > ada.txt gnatchop -gnatyN -gnat2022 -w ada.txt src/generated ########### ## Build ## ########### %build gprbuild %{GPRbuild_flags} %{scn_vars} -P sarif_ada.gpr ############# ## Install ## ############# %install %{GPRinstall} %{scn_vars} --no-build-var -P sarif_ada.gpr # Fix up the symbolic links to the shared libraries. ln --symbolic --force libsarif_ada.so.%{version} \ %{buildroot}%{_libdir}/libsarif_ada.so # Install the examples. mkdir --parents %{buildroot}%{_pkgdocdir}/examples cp --recursive --preserve=timestamps \ share/sarif_ada/examples/* %{buildroot}%{_pkgdocdir}/examples rm -rf %{buildroot}%{_pkgdocdir}/examples/.gitignore rm -rf %{buildroot}%{_pkgdocdir}/examples/alire.toml find %{buildroot} -exec stat --format "%A %n" {} \; ls -l %{buildroot}%{_libdir} ########### ## Check ## ########### %if %{with check} %check # Make the files installed in the buildroot visible to the testsuite. export LD_LIBRARY_PATH=%{buildroot}%{_libdir}:$LD_LIBRARY_PATH export GPR_PROJECT_PATH=%{buildroot}%{_GNAT_project_dir}:$GPR_PROJECT_PATH # Ensure the example compiles. gprbuild %{GPRbuild_flags} %{scn_vars} -cargs -fPIE -gargs \ -P share/sarif_ada/examples/sarif_examples.gpr # Try to run the examples. ./share/sarif_ada/examples/.obj/sarif_run \ share/sarif_ada/examples/simple-read-write %endif ########### ## Files ## ########### %files %license LICENSE %doc README* %{_libdir}/libsarif_ada.so.%{version} %files devel %{_GNAT_project_dir}/sarif_ada.gpr %{_includedir}/%{name} %dir %{_libdir}/%{name} %attr(444,-,-) %{_libdir}/%{name}/*.ali %{_libdir}/libsarif_ada.so # Examples. %dir %{_pkgdocdir} %{_pkgdocdir}/examples