# The test suite is normally run. It can be disabled with "--without=check". %bcond_without check # Upstream source information. %global upstream_owner pmderodat %global upstream_name ada-toml %global upstream_version 0.5 %global upstream_gittag v%{upstream_version} Name: ada-toml Version: %{upstream_version} Release: 1%{?dist} Summary: TOML parser for Ada License: BSD-3-Clause URL: https://github.com/%{upstream_owner}/%{upstream_name} Source: %{url}/archive/%{upstream_gittag}/%{upstream_name}-%{upstream_version}.tar.gz # [Fedora-specific] Add a soname. Patch: %{name}-add-soname.patch # Use 'gnatcoll_core.gpr' instead of 'gnatcoll.gpr'. Patch: %{name}-refine-dependencies-to-gnatcoll.patch BuildRequires: gcc-gnat gprbuild # A fedora-gnat-project-common that contains the new GPRinstall macro. BuildRequires: fedora-gnat-project-common >= 3.21 %if %{with check} # A gnatcoll-core that contains gnatcoll_core.gpr is needed. BuildRequires: gnatcoll-core-devel >= 25.0.0 BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-e3-testsuite BuildRequires: python-unversioned-command %endif # Build only on architectures where GPRbuild is available. ExclusiveArch: %{GPRbuild_arches} %global common_description_en \ Ada-toml is a pure Ada library for parsing and creating TOML documents. It \ conforms to the version 1.0.0 of the format standard. %description %{common_description_en} ################# ## Subpackages ## ################# %package devel Summary: Development files for Ada-TOML Requires: %{name}%{?_isa} = %{version}-%{release} Requires: fedora-gnat-project-common Recommends: %{name}-doc %description devel %{common_description_en} This package contains source code and linking information for developing applications that use Ada-TOML. ############# ## Prepare ## ############# %prep %autosetup -n %{upstream_name}-%{upstream_version} -p1 # Scenario variables for GRPbuild project. %global scn_vars -XVERSION=%{version}.0 \\\ -XADA_TOML_BUILD_MODE=prod \\\ -XLIBRARY_TYPE=relocatable ########### ## Build ## ########### %build gprbuild %{GPRbuild_flags} %{scn_vars} -P ada_toml.gpr ############# ## Install ## ############# %install # Install the library. %{GPRinstall} %{scn_vars} --no-build-var -P ada_toml.gpr # Fix up some things that GPRinstall does wrong. ln --symbolic --force libada_toml.so.0.%{version} %{buildroot}%{_libdir}/libada_toml.so # Before making the project files architecture-independent, copy the buildroot # into a separate directory for later testing. The testsuite fails if applied to # the buildroot after making the project files architecture-independent because # of the hardcoded paths in `directories.gpr`. %if %{with check} %global checkroot %{_builddir}/%{upstream_name}-%{upstream_version}/checkroot mkdir %{checkroot} cp --recursive %{buildroot}/* %{checkroot}/ %endif # Make the generated usage project file architecture-independent. sed --regexp-extended --in-place \ '--expression=1i with "directories";' \ '--expression=/^-- This project has been generated/d' \ '--expression=/package Linker is/,/end Linker/d' \ '--expression=s|^( *for +Source_Dirs +use +).*;$|\1(Directories.Includedir \& "/'%{name}'");|i' \ '--expression=s|^( *for +Library_Dir +use +).*;$|\1Directories.Libdir;|i' \ '--expression=s|^( *for +Library_ALI_Dir +use +).*;$|\1Directories.Libdir \& "/'%{name}'";|i' \ %{buildroot}%{_GNAT_project_dir}/ada_toml.gpr # The Sed commands are: # 1: Insert a with clause before the first line to import the directories # project. # 2: Delete a comment that mentions the architecture. # 3: Delete the package Linker, which contains linker parameters that a # shared library normally doesn't need, and can contain architecture- # specific pathnames. # 4: Replace the value of Source_Dirs with a pathname based on # Directories.Includedir. # 5: Replace the value of Library_Dir with Directories.Libdir. # 6: Replace the value of Library_ALI_Dir with a pathname based on # Directories.Libdir. ########### ## Check ## ########### %if %{with check} %check # Make the files of this packages visible to the test runner. export PATH=%{checkroot}%{_bindir}:$PATH export LD_LIBRARY_PATH=%{checkroot}%{_libdir}:$LD_LIBRARY_PATH export GPR_PROJECT_PATH=%{checkroot}%{_GNAT_project_dir}:$GPR_PROJECT_PATH # Build a test program. gprbuild %{GPRbuild_flags} %{scn_vars} -cargs -fPIE -gargs -P checkers.gpr # Run the test suite. export VERSION=%{version}.0 export LIBRARY_TYPE=relocatable %python3 ./run-tests.py \ --show-error-output \ --max-consecutive-failures=4 \ --failure-exit-code=0 %endif ########### ## Files ## ########### %files %license LICENSE %doc README* %{_libdir}/libada_toml.so.%{version}.0 %files devel %{_GNAT_project_dir}/ada_toml.gpr %{_includedir}/%{name} %dir %{_libdir}/%{name} %attr(444,-,-) %{_libdir}/%{name}/*.ali %{_libdir}/libada_toml.so ############### ## Changelog ## ############### %changelog * Sun Oct 27 2024 Dennis van Raaij - 0.5-1 - New package.