%global forgeurl https://github.com/biojppm/c4fs # 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. %global commit 1abba005074022f07d2d9d11ec6a786f2a1f1380 Name: c4fs Summary: C++ file system utilities Version: 0.0.1 # This is the same as the version number. To prevent undetected soversion # bumps, we nevertheless express it separately. %global so_version 0.0.1 %forgemeta Release: %autorelease URL: %{forgeurl} License: MIT Source0: %{forgesource} # 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. Patch0: c4fs-1abba00-external-c4core.patch 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} Requires: cmake-filesystem %description devel The c4fs-devel package contains libraries and header files for developing applications that use c4fs. %prep %forgeautosetup -p1 # Remove/unbundle additional dependencies # c4project (CMake build scripts) rm -rvf ext/c4core/cmake cp -rvp %{_datadir}/cmake/c4project ext/c4core/cmake # Patch out download of doctest: awk '/^ if\(_DOCTEST\)$/ { x=1 } x != 1 x == 1 && /^ endif\(\)$/ { x=0 }' \ '%{_datadir}/cmake/c4project/c4Project.cmake' \ > 'ext/c4core/cmake/c4Project.cmake' # This comment fixes confused vim syntax highlighting: ' # 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): sed -r -i 's/\bdoctest\b//' test/CMakeLists.txt %build %cmake -DC4FS_BUILD_TESTS=ON -GNinja %cmake_build %install %cmake_install # Fix wrong installation paths for multilib; it would be nontrivial to patch # the source to get this right in the first place. 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/' 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