# 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_with check # Upstream source information. %global upstream_owner AdaCore %global upstream_name vss-extra %global upstream_version 26.0.0 %global upstream_commit a9d466d7d75c555676654b71a0d92e946ea4688d Name: vss-extra Version: %{upstream_version} Release: %autorelease Summary: High level string and text processing library - Extras 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_version}.tar.gz # Test data. See "data/README.md" on how to create. # # +--------------------------------------------------------+-------------+ # | Contents | License | # +--------------------------------------------------------+-------------+ # | https://github.com/json5/json5-tests.git | MIT | # +--------------------------------------------------------+-------------+ # %if %{with check} # Open-issue: Source file cannot be found during build when using # --with=check. Works only when `bcond_without check`. Source1: %{name}-test-data.tar.bz2 %endif # [Fedora-specific] Set the library so version. Patch: %{name}-set-library-so-version.patch # [Fedora-specific] Change GNAT project file dependencies for the JSON schema # tool. This is a temporary fix. Patch: %{name}-build-json-schema-tool.patch # Fix the GNAT project file dependencies in the examples. Patch: %{name}-fix-examples.patch BuildRequires: gcc-gnat gprbuild make sed # A fedora-gnat-project-common that contains the new GPRinstall macro. BuildRequires: fedora-gnat-project-common >= 3.21 BuildRequires: vss-text-devel BuildRequires: xmlada-devel %if %{with check} BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-e3-testsuite %endif # Build only on architectures where GPRbuild is available. ExclusiveArch: %{GPRbuild_arches} # VSS-Text isn't available for s390x. ExcludeArch: s390x %global common_description_en \ Libraries for handling JSON, Regexp, XML and other features based on VSS-Text. %description %{common_description_en} ################# ## Subpackages ## ################# %package devel Summary: Development files for the VSS-Extra libraries Requires: %{name}%{?_isa} = %{version}-%{release} Requires: fedora-gnat-project-common Requires: vss-text-devel Requires: xmlada-devel %description devel %{common_description_en} This package contains source code and linking information for developing applications that use the VSS-Extra libraries. ############# ## Prepare ## ############# %prep %autosetup -C -p1 # Scenario variables for GRPbuild project. %global scn_vars %{shrink: -XVERSION=%{version} \ -XVSS_BUILD_PROFILE=release \ -XVSS_LIBRARY_TYPE=relocatable \ -XVSS_MAX_SUPPORTED_INTEGER_SIZE=128 \ -XVSS_OS=unix } ########### ## Build ## ########### %build # Build the library components. for component in json os regexp xml xml_templates xml_xmlada; do gprbuild %{GPRbuild_flags} %{scn_vars} -P gnat/vss_${component}.gpr done; # Build the JSON Schema for Ada tool. gprbuild %{GPRbuild_flags} %{scn_vars} -cargs -fPIE -gargs \ -P gnat/tools/json_schema.gpr ############# ## Install ## ############# %install # Install the library components. for component in json os regexp xml xml_templates xml_xmlada ; do %{GPRinstall -s vss-${component} -a vss-${component}} \ %{scn_vars} --no-build-var -P gnat/vss_${component}.gpr done for component in json os regexp xml xml-templates xml-xmlada ; do ln --symbolic --force libvss-${component}.so.%{version} \ %{buildroot}%{_libdir}/libvss-${component}.so done # Install the JSON Schema for Ada tool. %{GPRinstall} %{scn_vars} --mode=usage -P gnat/tools/json_schema.gpr # Install the examples. mkdir --parents %{buildroot}%{_pkgdocdir}/examples cp --recursive --preserve=timestamps \ examples %{buildroot}%{_pkgdocdir}/examples find %{buildroot} -exec stat --format "%A %n" {} \; ls -l %{buildroot}%{_libdir} ########### ## Check ## ########### %if %{with check} %check # Unpack test data. pushd ./data tar --extract --bzip2 --file %{SOURCE1} popd # 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 examples compile. gprbuild %{GPRbuild_flags} %{scn_vars} -cargs -fPIE -gargs \ -P examples/blogs/json_1/blog_1.gpr gprbuild %{GPRbuild_flags} %{scn_vars} -cargs -fPIE -gargs \ -P examples/command_line/command/command_line_command.gpr gprbuild %{GPRbuild_flags} %{scn_vars} -cargs -fPIE -gargs \ -P examples/regexp/grep.gpr # Build the tests. gprbuild %{GPRbuild_flags} %{scn_vars} -cargs -fPIE -gargs \ -P gnat/tests/vss_os_tests.gpr gprbuild %{GPRbuild_flags} %{scn_vars} -cargs -fPIE -gargs \ -P gnat/tests/vss_json_tests.gpr gprbuild %{GPRbuild_flags} %{scn_vars} -cargs -fPIE -gargs \ -P gnat/tests/vss_regexp_tests.gpr gprbuild %{GPRbuild_flags} %{scn_vars} -cargs -fPIE -gargs \ -P gnat/tests/vss_html_tests.gpr # NOTE: All tests are built using the libraries' build profile (i.e., # `release'). This is necessary because GCC may optimize away elaboration # routines that are expected by non-optimized build of clients. # # Example when compiling the tests with build profile `validate': # # .objs/validation/tests/test_converters: symbol lookup error: # .objs/validation/tests/test_converters: undefined symbol: vss__characters__latin___elabs sed --in-place \ --expression 's,.objs/validation/tests,.objs/release/tests,' \ Makefile sed --in-place \ --expression 's,.objs/validation/tests,.objs/release/tests,' \ testsuite/run_json_reader_test # Show detailed information for failed tests. export VERBOSE_TEST_REPORT= # Run the tests. make check_text make check_json make check_regexp make check_html %endif ########### ## Files ## ########### %files %license LICENSE.txt %doc README* %{_libdir}/libvss-json.so.%{version} %{_libdir}/libvss-os.so.%{version} %{_libdir}/libvss-regexp.so.%{version} %{_libdir}/libvss-xml.so.%{version} %{_libdir}/libvss-xml-templates.so.%{version} %{_libdir}/libvss-xml-xmlada.so.%{version} %{_bindir}/gen_json %files devel %{_GNAT_project_dir}/vss_json.gpr %{_includedir}/vss-json %dir %{_libdir}/vss-json %attr(444,-,-) %{_libdir}/vss-json/*.ali %{_libdir}/libvss-json.so %{_GNAT_project_dir}/vss_os.gpr %{_includedir}/vss-os %dir %{_libdir}/vss-os %attr(444,-,-) %{_libdir}/vss-os/*.ali %{_libdir}/libvss-os.so %{_GNAT_project_dir}/vss_regexp.gpr %{_includedir}/vss-regexp %dir %{_libdir}/vss-regexp %attr(444,-,-) %{_libdir}/vss-regexp/*.ali %{_libdir}/libvss-regexp.so %{_GNAT_project_dir}/vss_xml.gpr %{_includedir}/vss-xml %dir %{_libdir}/vss-xml %attr(444,-,-) %{_libdir}/vss-xml/*.ali %{_libdir}/libvss-xml.so %{_GNAT_project_dir}/vss_xml_templates.gpr %{_includedir}/vss-xml_templates %dir %{_libdir}/vss-xml_templates %attr(444,-,-) %{_libdir}/vss-xml_templates/*.ali %{_libdir}/libvss-xml-templates.so %{_GNAT_project_dir}/vss_xml_xmlada.gpr %{_includedir}/vss-xml_xmlada %dir %{_libdir}/vss-xml_xmlada %attr(444,-,-) %{_libdir}/vss-xml_xmlada/*.ali %{_libdir}/libvss-xml-xmlada.so # Examples %dir %{_pkgdocdir} %{_pkgdocdir}/examples