2021-12-27 19:42:17 +00:00
|
|
|
# The project contains a version number, but a release has never been tagged.
|
|
|
|
# The project is normally used as a git submodule and referred to by commit
|
|
|
|
# hash.
|
2024-06-12 18:32:29 +00:00
|
|
|
%global commit 59cfbae26b821f4d4c50ff0775219cb739fa7f46
|
|
|
|
%global snapdate 20240622
|
2021-12-27 19:42:17 +00:00
|
|
|
|
2024-08-24 23:32:51 +00:00
|
|
|
# Upstream defaults to C++11, but recommends building c4core and rapidyaml with
|
|
|
|
# the same standard; and rapidyaml is built as C++14 because gtest 1.13.0 or
|
|
|
|
# later requires C++14 or later. Since c4fs supports the tests for c4core, it
|
|
|
|
# makes sense to apply the same advice here as well. See:
|
|
|
|
# https://github.com/biojppm/rapidyaml/issues/465#issuecomment-2307668270
|
|
|
|
%global cxx_std 14
|
|
|
|
|
2021-12-27 19:42:17 +00:00
|
|
|
Name: c4fs
|
|
|
|
Summary: C++ file system utilities
|
2024-02-27 13:31:28 +00:00
|
|
|
Version: 0.0.1^%{snapdate}git%{sub %{commit} 1 7}
|
2021-12-27 19:42:17 +00:00
|
|
|
# This is the same as the version number. To prevent undetected soversion
|
|
|
|
# bumps, we nevertheless express it separately.
|
|
|
|
%global so_version 0.0.1
|
|
|
|
Release: %autorelease
|
|
|
|
|
2022-07-31 02:35:24 +00:00
|
|
|
# SPDX
|
2021-12-27 19:42:17 +00:00
|
|
|
License: MIT
|
2022-07-31 02:35:24 +00:00
|
|
|
URL: https://github.com/biojppm/c4fs
|
2023-05-25 12:18:14 +00:00
|
|
|
Source: %{url}/archive/%{commit}/c4fs-%{commit}.tar.gz
|
2021-12-27 19:42:17 +00:00
|
|
|
|
|
|
|
# Upstream always wants to build with c4core as a git submodule, but we want to
|
|
|
|
# unbundle it and build with an external library. We therefore maintain this
|
|
|
|
# patch without sending it upstream.
|
2022-04-20 12:44:56 +00:00
|
|
|
Patch: c4fs-1abba00-external-c4core.patch
|
2021-12-27 19:42:17 +00:00
|
|
|
|
|
|
|
BuildRequires: gcc-c++
|
|
|
|
BuildRequires: cmake
|
|
|
|
BuildRequires: c4project
|
|
|
|
# Our choice; the default make backend should work just as well
|
|
|
|
BuildRequires: ninja-build
|
|
|
|
|
|
|
|
BuildRequires: cmake(c4core)
|
|
|
|
|
|
|
|
# For each header-only library, the guidelines require us to BR the -static
|
|
|
|
# package for tracking.
|
|
|
|
BuildRequires: doctest-devel
|
|
|
|
BuildRequires: doctest-static
|
|
|
|
|
|
|
|
%description
|
|
|
|
%{summary}.
|
|
|
|
|
|
|
|
|
|
|
|
%package devel
|
|
|
|
Summary: Development files for c4fs
|
|
|
|
|
|
|
|
Requires: c4fs%{?_isa} = %{version}-%{release}
|
|
|
|
Requires: c4core-devel%{?_isa}
|
|
|
|
|
|
|
|
%description devel
|
|
|
|
The c4fs-devel package contains libraries and header files for developing
|
|
|
|
applications that use c4fs.
|
|
|
|
|
|
|
|
|
|
|
|
%prep
|
2022-04-20 12:47:10 +00:00
|
|
|
%autosetup -n c4fs-%{commit} -p1
|
2021-12-27 19:42:17 +00:00
|
|
|
|
|
|
|
# Remove/unbundle additional dependencies
|
2022-04-25 11:54:26 +00:00
|
|
|
|
2021-12-27 19:42:17 +00:00
|
|
|
# c4project (CMake build scripts)
|
2022-04-25 11:54:26 +00:00
|
|
|
find ext
|
|
|
|
cp -rp '%{_datadir}/cmake/c4project' ext/c4core/cmake
|
|
|
|
|
2021-12-27 19:42:17 +00:00
|
|
|
# Do not try to link against a nonexistent doctest library (doctest is
|
|
|
|
# header-only, and we do not have the complete CMake project for doctest that
|
|
|
|
# would provide a target that knows this):
|
2022-04-25 11:54:26 +00:00
|
|
|
sed -r -i \
|
|
|
|
-e 's/(LIBS.*)\bdoctest\b/\1/' \
|
|
|
|
-e 's/(c4_setup_testing\()DOCTEST\)/\1\)/' \
|
|
|
|
test/CMakeLists.txt
|
2021-12-27 19:42:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
%build
|
2022-04-25 11:54:26 +00:00
|
|
|
# We can stop the CMake scripts from downloading doctest by setting
|
|
|
|
# C4FS_CACHE_DOWNLOAD_DOCTEST to any directory that exists.
|
|
|
|
%cmake -GNinja \
|
2024-08-24 23:32:51 +00:00
|
|
|
-DCMAKE_CXX_STANDARD=%{cxx_std} \
|
2022-04-25 11:54:26 +00:00
|
|
|
-DC4FS_CACHE_DOWNLOAD_DOCTEST:PATH=/ \
|
|
|
|
-DC4FS_BUILD_TESTS=ON
|
2021-12-27 19:42:17 +00:00
|
|
|
%cmake_build
|
|
|
|
|
|
|
|
|
|
|
|
%install
|
|
|
|
%cmake_install
|
|
|
|
# Fix wrong installation paths for multilib; it would be nontrivial to patch
|
2023-05-25 12:37:30 +00:00
|
|
|
# the source to get this right in the first place. The installation path is
|
|
|
|
# determined by the scripts in https://github.com/biojppm/cmake, packaged as
|
|
|
|
# c4project.
|
|
|
|
#
|
|
|
|
# Installation directory on Linux 64bit OS
|
|
|
|
# https://github.com/biojppm/rapidyaml/issues/256
|
2021-12-27 19:42:17 +00:00
|
|
|
if [ '%{_libdir}' != '%{_prefix}/lib' ]
|
|
|
|
then
|
|
|
|
mkdir -p '%{buildroot}%{_libdir}'
|
|
|
|
mv -v %{buildroot}%{_prefix}/lib/libc4fs.so* '%{buildroot}%{_libdir}/'
|
|
|
|
mkdir -p '%{buildroot}%{_libdir}/cmake'
|
|
|
|
mv -v %{buildroot}%{_prefix}/lib/cmake/c4fs '%{buildroot}%{_libdir}/cmake/'
|
2023-07-16 14:07:46 +00:00
|
|
|
find %{buildroot}%{_libdir}/cmake/c4fs -type f -name '*.cmake' -print0 |
|
|
|
|
xargs -r -t -0 sed -r -i "s@/lib/@/$(basename '%{_libdir}')/@"
|
2021-12-27 19:42:17 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
%check
|
|
|
|
%cmake_build --target c4fs-test-run-verbose
|
|
|
|
|
|
|
|
|
|
|
|
%files
|
|
|
|
%license LICENSE.txt
|
|
|
|
%doc README.md
|
|
|
|
%{_libdir}/libc4fs.so.%{so_version}
|
|
|
|
|
|
|
|
|
|
|
|
%files devel
|
|
|
|
# %%{_includedir}/c4 is owned by c4core-devel
|
|
|
|
%{_includedir}/c4/fs
|
|
|
|
%{_libdir}/libc4fs.so
|
|
|
|
%{_libdir}/cmake/c4fs
|
|
|
|
|
|
|
|
|
|
|
|
%changelog
|
|
|
|
%autochangelog
|