summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packaging/flatbuffers.manifest5
-rw-r--r--packaging/flatbuffers.pc.in5
-rw-r--r--packaging/flatbuffers.spec108
3 files changed, 118 insertions, 0 deletions
diff --git a/packaging/flatbuffers.manifest b/packaging/flatbuffers.manifest
new file mode 100644
index 00000000..017d22d3
--- /dev/null
+++ b/packaging/flatbuffers.manifest
@@ -0,0 +1,5 @@
+<manifest>
+ <request>
+ <domain name="_"/>
+ </request>
+</manifest>
diff --git a/packaging/flatbuffers.pc.in b/packaging/flatbuffers.pc.in
new file mode 100644
index 00000000..50db13fd
--- /dev/null
+++ b/packaging/flatbuffers.pc.in
@@ -0,0 +1,5 @@
+Name: flatbuffers
+Description: memory efficient serialization library
+Version: @version@
+Libs: -L@libdir@ -lflatbuffers
+Cflags: -I@includedir@
diff --git a/packaging/flatbuffers.spec b/packaging/flatbuffers.spec
new file mode 100644
index 00000000..92b9223e
--- /dev/null
+++ b/packaging/flatbuffers.spec
@@ -0,0 +1,108 @@
+Name: flatbuffers
+Summary: cross platform serialization library
+Version: 23.5.26
+Release: 1%{?dist}
+Group: Development/Libraries
+Packager: Yongjoo Ahn <yongjoo1.ahn@samsung.com>
+License: Apache-2.0
+Source0: %{name}-%{version}.tar.gz
+Source1: %{name}.manifest
+
+BuildRequires: cmake
+BuildRequires: sed
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+
+%description
+FlatBuffers is a cross platform serialization library architected for maximum
+memory efficiency. It allows you to directly access serialized data without
+parsing/unpacking it first, while still having great forwards/backwards
+compatibility.
+
+%package devel
+Summary: Development package to use flatbuffers
+Group: Development/Libraries
+Requires: %{name} = %{version}-%{release}
+%description devel
+This package provides headers and other miscellaneous files required to use flatbuffers.
+
+%package python
+Summary: Python subpackage to use flatbuffers
+Group: Development/Libraries
+Requires: %{name} = %{version}-%{release}
+Requires: python3-devel
+%description python
+This package provides flatbuffers python API.
+
+%prep
+%setup -q
+cp %{SOURCE1} .
+
+%build
+export CFLAGS+=" -fno-lto"
+export CXXFLAGS+=" -fno-lto"
+pushd python
+export VERSION="23.5.26"
+%{_bindir}/python3 setup.py build
+popd
+
+# flatbuffers build occasionally fails when using -j${BUILD_THREADS} with an error similar to:
+# /mnt/source/flatbuffers/flatbuffers-1.6.0/samples/sample_binary.cpp:19:17: error: 'MyGame' has not been declared
+# /mnt/source/flatbuffers/flatbuffers-1.6.0/samples/sample_binary.cpp:19:25: error: 'Sample' is not a namespace-name
+# ...
+# Disabling build tests gets rid of this flakiness and makes the compilation faster.
+%{cmake} \
+ -DFLATBUFFERS_INSTALL=ON \
+ -DFLATBUFFERS_BUILD_SHAREDLIB=ON \
+ -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE \
+ -DFLATBUFFERS_BUILD_TESTS=OFF \
+ -DCMAKE_INSTALL_INCLUDEDIR=%{_includedir} \
+ -DCMAKE_INSTALL_LIBDIR=%{_libdir} \
+ -DCMAKE_INSTALL_BINDIR=%{_bindir} \
+ -DFB_CMAKE_DIR=%{_libdir}/cmake \
+ -DCMAKE_BUILD_TYPE=Release .
+%{__make} %{?_smp_mflags}
+
+%install
+%{__make} DESTDIR=%{?buildroot:%{buildroot}} install
+install -D -m 644 packaging/%{name}.pc.in %{buildroot}%{_libdir}/pkgconfig/%{name}.pc
+sed -i 's#@version@#%{version}#g' %{buildroot}%{_libdir}/pkgconfig/%{name}.pc
+sed -i 's#@libdir@#%{_libdir}#g' %{buildroot}%{_libdir}/pkgconfig/%{name}.pc
+sed -i 's#@includedir@#%{_includedir}#g' %{buildroot}%{_libdir}/pkgconfig/%{name}.pc
+mkdir -p %{buildroot}/%{python3_sitelib}/flatbuffers
+pushd python
+export VERSION="23.5.26"
+%{_bindir}/python3 setup.py install --prefix=%{_prefix} --root=%{buildroot}
+rm -r %{buildroot}/%{python3_sitelib}/*.egg-info
+rm -r %{buildroot}/%{python3_sitelib}/flatbuffers/__pycache__
+popd
+
+%post -p /sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+%files
+%defattr(-,root,root,-)
+%manifest %{name}.manifest
+%license LICENSE
+%{_libdir}/libflatbuffers.so.*
+
+%files devel
+%defattr(-,root,root,-)
+%{_bindir}/flatc
+%{_includedir}/flatbuffers
+%{_libdir}/libflatbuffers.a
+%{_libdir}/cmake/flatbuffers/*
+%{_libdir}/libflatbuffers.so
+%{_libdir}/pkgconfig/flatbuffers.pc
+
+%files python
+%defattr(-,root,root,-)
+%manifest %{name}.manifest
+%license LICENSE
+%{python3_sitelib}/flatbuffers/
+
+%changelog
+* Wed Jan 01 2024 Yongjoo Ahn <yongjoo1.ahn@samsung.com>
+- Release of 23.5.26
+