|
|
1d23854 |
%bcond cpp_tests 1
|
|
|
b1b960a |
# Disabled for now because protobuf-devel does not provide CMake files
|
|
|
1d23854 |
%bcond cpp_grpc_test 0
|
|
|
1d23854 |
%bcond py_tests 1
|
|
|
d987cfb |
|
|
|
a7c3032 |
# Doxygen HTML help is not suitable for packaging due to a minified JavaScript
|
|
|
a7c3032 |
# bundle inserted by Doxygen itself. See discussion at
|
|
|
a7c3032 |
# https://bugzilla.redhat.com/show_bug.cgi?id=2006555.
|
|
|
a7c3032 |
#
|
|
|
a7c3032 |
# We could potentially enable the Doxygen PDF documentation as a substitute,
|
|
|
a7c3032 |
# but currently Doxygen generates invalid LaTeX.
|
|
|
ead525a |
%bcond doc_pdf 0
|
|
|
8251aff |
|
|
|
8251aff |
Name: flatbuffers
|
|
|
50e8749 |
Version: 24.3.7
|
|
|
ed9000d |
# The .so version is equal to the project version since upstream offers no ABI
|
|
|
ed9000d |
# stability guarantees. We manually repeat it here and and use the macro in the
|
|
|
ed9000d |
# file lists as a reminder to avoid undetected .so version bumps. See
|
|
|
ed9000d |
# https://github.com/google/flatbuffers/issues/7759.
|
|
|
50e8749 |
%global so_version 24.3.7
|
|
|
5fb3a29 |
Release: %autorelease
|
|
|
65b61eb |
Summary: Memory efficient serialization library
|
|
|
8251aff |
|
|
|
891d3e0 |
# The entire source code is Apache-2.0. Even code from grpc, which is
|
|
|
891d3e0 |
# BSD-3-Clause in its upstream, is intended to be Apache-2.0 in this project.
|
|
|
891d3e0 |
# (Google is the copyright holder for both projects, so it can relicense at
|
|
|
891d3e0 |
# will.) See https://github.com/google/flatbuffers/pull/7073.
|
|
|
891d3e0 |
License: Apache-2.0
|
|
|
c5236c6 |
URL: https://google.github.io/flatbuffers
|
|
|
2fee4a8 |
%global forgeurl https://github.com/google/flatbuffers
|
|
|
2fee4a8 |
Source0: %{forgeurl}/archive/v%{version}/%{name}-%{version}.tar.gz
|
|
|
e7399ea |
# Hand-written for Fedora in groff_man(7) format based on --help output
|
|
|
8251aff |
Source1: flatc.1
|
|
|
8251aff |
|
|
|
f43c907 |
# https://fedoraproject.org/wiki/Changes/EncourageI686LeafRemoval
|
|
|
f43c907 |
ExcludeArch: %{ix86}
|
|
|
f43c907 |
|
|
|
8251aff |
BuildRequires: gcc-c++
|
|
|
2c851e4 |
BuildRequires: cmake
|
|
|
3adb5b1 |
# The ninja backend should be slightly faster than make, with no disadvantages.
|
|
|
3adb5b1 |
BuildRequires: ninja-build
|
|
|
d987cfb |
%if %{with cpp_tests} && %{with cpp_grpc_test}
|
|
|
b7dac41 |
BuildRequires: cmake(absl)
|
|
|
b1b960a |
BuildRequires: cmake(protobuf)
|
|
|
b7dac41 |
BuildRequires: grpc-devel
|
|
|
b1b960a |
%endif
|
|
|
2c851e4 |
|
|
|
a347cb3 |
BuildRequires: python3-devel
|
|
|
d1a848d |
# Enables numpy integration tests
|
|
|
d1a848d |
BuildRequires: python3dist(numpy)
|
|
|
8251aff |
|
|
|
b7dac41 |
# From grpc/README.md:
|
|
|
b7dac41 |
#
|
|
|
b7dac41 |
# NOTE: files in `src/` are shared with the GRPC project, and maintained
|
|
|
b7dac41 |
# there (any changes should be submitted to GRPC instead). These files are
|
|
|
b7dac41 |
# copied from GRPC, and work with both the Protobuf and FlatBuffers code
|
|
|
b7dac41 |
# generator.
|
|
|
b7dac41 |
#
|
|
|
b7dac41 |
# It’s not clearly documented which GPRC version is excerpted, but see
|
|
|
67a46a9 |
# https://github.com/google/flatbuffers/pull/4305 for more details. We use
|
|
|
67a46a9 |
# _GRPC_VERSION from the WORKSPACE file as the bundled GRPC version, but we are
|
|
|
67a46a9 |
# not 100% certain that this is entirely correct.
|
|
|
b7dac41 |
#
|
|
|
b7dac41 |
# It is not possible to unbundle this because private/internal APIs are used.
|
|
|
67a46a9 |
Provides: bundled(grpc) = 1.49.0
|
|
|
8251aff |
|
|
|
ebf6a65 |
%global common_description %{expand:
|
|
|
d050eab |
FlatBuffers is a cross platform serialization library architected for maximum
|
|
|
d050eab |
memory efficiency. It allows you to directly access serialized data without
|
|
|
d050eab |
parsing/unpacking it first, while still having great forwards/backwards
|
|
|
ba92568 |
compatibility.}
|
|
|
ba92568 |
|
|
|
ebf6a65 |
%description %{common_description}
|
|
|
8251aff |
|
|
|
2c851e4 |
|
|
|
8251aff |
%package devel
|
|
|
8251aff |
Summary: Development files for %{name}
|
|
|
8251aff |
Requires: %{name}%{?_isa} = %{version}-%{release}
|
|
|
2c851e4 |
|
|
|
ebf6a65 |
%description devel %{common_description}
|
|
|
ba92568 |
|
|
|
ba92568 |
This package contains libraries and header files for developing applications
|
|
|
ba92568 |
that use FlatBuffers.
|
|
|
ba92568 |
|
|
|
ba92568 |
|
|
|
ba92568 |
%package compiler
|
|
|
ba92568 |
Summary: FlatBuffers compiler (flatc)
|
|
|
b7dac41 |
# The flatc compiler does not link against the shared library, so this could
|
|
|
b7dac41 |
# possibly be removed; we leave it for now to ensure there is no version skew
|
|
|
b7dac41 |
# across subpackages.
|
|
|
ba92568 |
Requires: %{name}%{?_isa} = %{version}-%{release}
|
|
|
ba92568 |
|
|
|
ebf6a65 |
%description compiler %{common_description}
|
|
|
ba92568 |
|
|
|
ba92568 |
This package contains flatc, the FlatBuffers compiler.
|
|
|
8251aff |
|
|
|
2c851e4 |
|
|
|
a7c3032 |
%package doc
|
|
|
a7c3032 |
Summary: Documentation and examples for FlatBuffers
|
|
|
a7c3032 |
|
|
|
a7c3032 |
BuildArch: noarch
|
|
|
a7c3032 |
|
|
|
a7c3032 |
%if %{with doc_pdf}
|
|
|
a7c3032 |
BuildRequires: doxygen
|
|
|
a7c3032 |
BuildRequires: doxygen-latex
|
|
|
a7c3032 |
# Required to format Python comments appropriately. Not yet packaged.
|
|
|
a7c3032 |
# BuildRequires: python3dist(doxypypy)
|
|
|
a7c3032 |
%endif
|
|
|
a7c3032 |
|
|
|
ebf6a65 |
%description doc %{common_description}
|
|
|
a7c3032 |
|
|
|
a7c3032 |
This package contains documentation and examples for FlatBuffers.
|
|
|
a7c3032 |
|
|
|
a7c3032 |
|
|
|
cb2dbe9 |
%package -n python3-flatbuffers
|
|
|
cb2dbe9 |
Summary: FlatBuffers serialization format for Python
|
|
|
cb2dbe9 |
|
|
|
cb2dbe9 |
BuildArch: noarch
|
|
|
cb2dbe9 |
|
|
|
cb2dbe9 |
Recommends: python3dist(numpy)
|
|
|
a347cb3 |
|
|
|
cb2dbe9 |
Provides: flatbuffers-python3 = %{version}-%{release}
|
|
|
cb2dbe9 |
Obsoletes: flatbuffers-python3 < 2.0.0-6
|
|
|
cb2dbe9 |
|
|
|
ebf6a65 |
%description -n python3-flatbuffers %{common_description}
|
|
|
cb2dbe9 |
|
|
|
cb2dbe9 |
This package contains the Python runtime library for use with the Flatbuffers
|
|
|
cb2dbe9 |
serialization format.
|
|
|
a347cb3 |
|
|
|
2c851e4 |
|
|
|
8251aff |
%prep
|
|
|
55f2dc8 |
%autosetup -p1
|
|
|
aea1cd2 |
# Remove unused directories that contain pre-compiled .jar files:
|
|
|
aea1cd2 |
rm -rvf android/ kotlin/
|
|
|
8251aff |
|
|
|
a7c3032 |
%if %{with doc_pdf}
|
|
|
a7c3032 |
# We enable the Doxygen PDF documentation as a substitute for HTML. We must
|
|
|
a7c3032 |
# enable GENERATE_LATEX and LATEX_BATCHMODE; the rest are precautionary and
|
|
|
a7c3032 |
# should already be set as we like them. We also disable GENERATE_HTML, since
|
|
|
a7c3032 |
# we will not use it.
|
|
|
a7c3032 |
sed -r -i \
|
|
|
a7c3032 |
-e "s/^([[:blank:]]*(GENERATE_LATEX|LATEX_BATCHMODE|USE_PDFLATEX|\
|
|
|
a7c3032 |
PDF_HYPERLINKS)[[:blank:]]*=[[:blank:]]*)NO[[:blank:]]*/\1YES/" \
|
|
|
a7c3032 |
-e "s/^([[:blank:]]*(LATEX_TIMESTAMP|GENERATE_HTML)\
|
|
|
a7c3032 |
[[:blank:]]*=[[:blank:]]*)YES[[:blank:]]*/\1NO/" \
|
|
|
a7c3032 |
./docs/source/doxyfile
|
|
|
a7c3032 |
%endif
|
|
|
a7c3032 |
|
|
|
a7c3032 |
%py3_shebang_fix samples
|
|
|
d1a848d |
# Fix paths in the Python test script to match how our build is organized:
|
|
|
d1a848d |
# - Use flatc from the buildroot, not the root of the extracted sources
|
|
|
d1a848d |
# - Use the proper python3 interpreter path from the RPM macro
|
|
|
d1a848d |
# - Don’t attempt to run tests with interpreters other than python3
|
|
|
d1a848d |
# - Add the buildroot python3_sitelib to PYTHONPATH so the flatbuffers
|
|
|
2208d6c |
# package can be found; the appropriate PYTHONPATH is supplied by could be
|
|
|
2208d6c |
# handled by %%{py3_test_envvars}, but the test script overrides it
|
|
|
d1a848d |
# - Make sure we don’t do coverage analysis even if python3-coverage is
|
|
|
d1a848d |
# somehow installed as an indirect dependency
|
|
|
d1a848d |
sed -r -i.upstream \
|
|
|
d1a848d |
-e 's|[^[:blank:]]*(/flatc)|%{buildroot}%{_bindir}\1|' \
|
|
|
d1a848d |
-e 's| python3 | %{python3} |' \
|
|
|
d1a848d |
-e 's|run_tests [^/]|# &|' \
|
|
|
d1a848d |
-e 's|PYTHONPATH=|&%{buildroot}%{python3_sitelib}:|' \
|
|
|
d1a848d |
-e 's|which coverage|/bin/false|' \
|
|
|
d1a848d |
tests/PythonTest.sh
|
|
|
a7c3032 |
|
|
|
2c851e4 |
|
|
|
cb2dbe9 |
%generate_buildrequires
|
|
|
cb2dbe9 |
pushd python >/dev/null
|
|
|
cb2dbe9 |
%pyproject_buildrequires
|
|
|
cb2dbe9 |
popd >/dev/null
|
|
|
cb2dbe9 |
|
|
|
cb2dbe9 |
|
|
|
c5236c6 |
%build
|
|
|
2107aeb |
# Needed for correct Python wheel version
|
|
|
2107aeb |
export VERSION='%{version}'
|
|
|
3adb5b1 |
%cmake -GNinja \
|
|
|
b1b960a |
-DCMAKE_BUILD_TYPE=Release \
|
|
|
d987cfb |
%if %{with cpp_tests}
|
|
|
b1b960a |
-DFLATBUFFERS_BUILD_TESTS:BOOL=ON \
|
|
|
d987cfb |
%if %{with cpp_grpc_test}
|
|
|
b1b960a |
-DFLATBUFFERS_BUILD_GRPCTEST:BOOL=ON \
|
|
|
b7dac41 |
-DGRPC_INSTALL_PATH:PATH=%{_prefix} \
|
|
|
b1b960a |
%endif
|
|
|
b1b960a |
%else
|
|
|
b1b960a |
-DFLATBUFFERS_BUILD_TESTS:BOOL=OFF \
|
|
|
b1b960a |
-DFLATBUFFERS_BUILD_GRPCTEST:BOOL=OFF \
|
|
|
b1b960a |
%endif
|
|
|
b1b960a |
-DFLATBUFFERS_BUILD_SHAREDLIB=ON \
|
|
|
b1b960a |
-DFLATBUFFERS_BUILD_FLATLIB=OFF \
|
|
|
b1b960a |
-DFLATBUFFERS_BUILD_FLATC=ON
|
|
|
19ed2da |
%cmake_build
|
|
|
a7c3032 |
|
|
|
a347cb3 |
pushd python
|
|
|
cb2dbe9 |
%pyproject_wheel
|
|
|
a347cb3 |
popd
|
|
|
8251aff |
|
|
|
a7c3032 |
%if %{with doc_pdf}
|
|
|
a7c3032 |
pushd docs/source
|
|
|
a7c3032 |
doxygen
|
|
|
a7c3032 |
popd
|
|
|
a7c3032 |
%make_build -C docs/latex
|
|
|
a7c3032 |
%endif
|
|
|
a7c3032 |
|
|
|
2c851e4 |
|
|
|
8251aff |
%install
|
|
|
19ed2da |
%cmake_install
|
|
|
a347cb3 |
pushd python
|
|
|
cb2dbe9 |
%pyproject_install
|
|
|
cb2dbe9 |
%pyproject_save_files flatbuffers
|
|
|
a347cb3 |
popd
|
|
|
7566006 |
mkdir -p %{buildroot}%{_mandir}/man1
|
|
|
8251aff |
cp -p %SOURCE1 %{buildroot}%{_mandir}/man1/flatc.1
|
|
|
8251aff |
|
|
|
2c851e4 |
|
|
|
8251aff |
%check
|
|
|
d987cfb |
%if %{with cpp_tests}
|
|
|
d050eab |
%ctest
|
|
|
8251aff |
%endif
|
|
|
d1a848d |
%if %{with py_tests}
|
|
|
2208d6c |
# The test script overrides PYTHONPATH and PYTHONDONTWRITEBYTECODE, but we’d
|
|
|
2208d6c |
# like to pass through any other environment variables that are set by
|
|
|
2208d6c |
# %%{py3_test_envvars}.
|
|
|
2208d6c |
%{py3_test_envvars} ./tests/PythonTest.sh
|
|
|
d1a848d |
%endif
|
|
|
d1a848d |
# Do an import-only “smoke test” even if we ran the Python tests; we are not
|
|
|
d1a848d |
# convinced that they cover all modules in the package.
|
|
|
cb2dbe9 |
%pyproject_check_import
|
|
|
8251aff |
|
|
|
2c851e4 |
|
|
|
8251aff |
%files
|
|
|
b1bfc9b |
%license LICENSE
|
|
|
ba92568 |
|
|
|
b7dac41 |
%{_libdir}/libflatbuffers.so.%{so_version}
|
|
|
8251aff |
|
|
|
2c851e4 |
|
|
|
8251aff |
%files devel
|
|
|
0a35a2f |
%{_includedir}/flatbuffers/
|
|
|
0a35a2f |
|
|
|
0386dc4 |
%{_libdir}/libflatbuffers.so
|
|
|
0a35a2f |
|
|
|
0a35a2f |
%{_libdir}/cmake/flatbuffers/
|
|
|
f844e59 |
%{_libdir}/pkgconfig/flatbuffers.pc
|
|
|
0a35a2f |
|
|
|
2c851e4 |
|
|
|
ba92568 |
%files compiler
|
|
|
ba92568 |
%{_bindir}/flatc
|
|
|
ba92568 |
%{_mandir}/man1/flatc.1*
|
|
|
ba92568 |
|
|
|
ba92568 |
|
|
|
a7c3032 |
%files doc
|
|
|
b1bfc9b |
%license LICENSE
|
|
|
54baf6e |
%doc CHANGELOG.md
|
|
|
b7dac41 |
%doc SECURITY.md
|
|
|
4049c8e |
%doc README.md
|
|
|
b7dac41 |
|
|
|
a7c3032 |
%if %{with doc_pdf}
|
|
|
a7c3032 |
%doc docs/latex/refman.pdf
|
|
|
a7c3032 |
%endif
|
|
|
a7c3032 |
|
|
|
54baf6e |
%doc examples/
|
|
|
b7dac41 |
%doc samples/
|
|
|
b7dac41 |
|
|
|
a7c3032 |
|
|
|
cb2dbe9 |
%files -n python3-flatbuffers -f %{pyproject_files}
|
|
|
b1bfc9b |
%license LICENSE
|
|
|
a347cb3 |
|
|
|
2c851e4 |
|
|
|
8251aff |
%changelog
|
|
|
5fb3a29 |
%autochangelog
|