%global optflags %{optflags} -O3 -fPIC -I%{_includedir}/libunwind

Summary:	Cryptographic filesystem for the cloud
Name:		cryfs
Version:	0.9.10
Release:	2
License:	LGPLv3+
Group:		File tools
Url:		https://github.com/cryfs/cryfs
Source0:	https://github.com/cryfs/cryfs/releases/download/%{version}/%{name}-%{version}.tar.gz
Patch0:		fix-for-UnionTech.patch
Patch1:     0001-modify-include-path.patch
BuildRequires:	cmake make python gcc-c++
BuildRequires:	boost-devel
BuildRequires:	pkgconfig(libcurl)
BuildRequires:	pkgconfig(fuse)
BuildRequires:	pkgconfig(openssl)
BuildRequires:	pkgconfig(cryptopp)
BuildRequires:	pkgconfig(libunwind)
Requires:	fuse

%description
CryFS provides a FUSE-based mount that encrypts file contents, file
sizes, metadata and directory structure. It uses encrypted same-size
blocks to store both the files themselves and the blocks' relations
to one another. These blocks are stored as individual files in the
base directory, which can then be synchronized to remote storage
(using an external tool).

%prep
%autosetup -p1 -n %{name}-%{version}
# Use system cryptopp
rm -rf vendor/cryptopp
find . -name "*.cpp" -o -name "*.h" |xargs sed -i -e 's,vendor_cryptopp,cryptopp,g'
sed -i -e '/cryptopp/d' vendor/CMakeLists.txt

%build
export LDFLAGS="%{__global_ldflags} -lboost_thread -lboost_program_options -lboost_filesystem -lcryptopp -lboost_chrono -lfuse"

%cmake \
    -DCMAKE_BUILD_TYPE=Release \
    -DBoost_USE_STATIC_LIBS=OFF \
    -DBUILD_TESTING=OFF \
    -DCRYFS_UPDATE_CHECKS=OFF \
    -DBUILD_TESTING=OFF

%make_build

%install
%make_install

%files
%doc README.md ChangeLog.txt
%license LICENSE
%{_bindir}/cryfs*
%{_mandir}/man?/cryfs*

%changelog
* Sun Sep 29 2024 zhuhongbo <zhuhongbo@uniontech.com> - 0.9.10-2
- fix: use accessible URL

* Tue Jul 26 2022 uoser <uoser@uniontech.com> - 0.9.10-1
- package init
