6117463
%undefine __cmake_in_source_build
47af0d7
Name:           tlsh
1212f92
Version:        4.11.2
b70ab6d
Release:        %autorelease
47af0d7
Summary:        Fuzzy text matching library
47af0d7
85db777
License:        Apache-2.0
47af0d7
URL:            https://github.com/trendmicro/tlsh
0e30304
Source0:        https://github.com/trendmicro/tlsh/archive/%{version}/tlsh-%{version}.tar.gz
47af0d7
85db777
# https://github.com/trendmicro/tlsh/pull/128
85db777
Patch:          0001-python-use-setuptools-instead-of-distutils.patch
85db777
Patch:          0002-python-drop-pointless-line-continuations.patch
85db777
47af0d7
BuildRequires:  cmake
47af0d7
BuildRequires:  gcc-c++
47af0d7
BuildRequires:  python3-devel
85db777
BuildRequires:  python3dist(setuptools)
47af0d7
0e30304
%global _description %{expand:
85db777
TLSH is a fuzzy matching library. Given a byte stream with a minimum length of
85db777
256 bytes (and a minimum amount of randomness), TLSH generates a hash value
85db777
which can be used for similarity comparisons.  Similar objects will have similar
85db777
hash values which allows for the detection of similar objects by comparing their
85db777
hash values.}
47af0d7
127b61d
%description %_description
47af0d7
0e30304
%package doc
0e30304
Summary: Documentation for TLSH
0e30304
BuildArch: noarch
47af0d7
0e30304
%description doc
47af0d7
%{summary}.
47af0d7
47af0d7
%package -n python3-tlsh
47af0d7
Summary:        Python 3 interface for TLSH
47af0d7
%{?python_provide:%python_provide python3-tlsh}
0e30304
Obsoletes: tlsh < 3.17.0
0e30304
Obsoletes: tlsh-devel < 3.17.0
47af0d7
127b61d
%description -n python3-tlsh %_description
47af0d7
47af0d7
This package contains the %{summary}.
47af0d7
47af0d7
%prep
85db777
%autosetup -p1
47af0d7
# I'm just loving cmake more every day
47af0d7
echo 'set(CMAKE_CXX_FLAGS "%{optflags} -fPIC")' | \
47af0d7
     tee -a src/CMakeLists.txt |\
47af0d7
     tee -a test/CMakeLists.txt |\
47af0d7
     tee -a utils/CMakeLists.txt
47af0d7
d486a63
sed -r -i '/CMAKE_EXE_LINKER_FLAGS.*-static-libstdc/d' CMakeLists.txt
d486a63
47af0d7
%build
6117463
%cmake
6117463
%cmake_build
47af0d7
pushd py_ext
47af0d7
%py3_build
47af0d7
popd
47af0d7
47af0d7
%install
47af0d7
pushd py_ext
47af0d7
%py3_install
47af0d7
popd
47af0d7
47af0d7
%global _docdir_fmt %{name}
47af0d7
47af0d7
%check
47af0d7
bin/simple_unittest
97d7ece
bin/timing_unittest
47af0d7
# just check if we get 0 for identical files, and non-zero for different files
47af0d7
bin/tlsh_unittest -c bin/tlsh_unittest -f bin/tlsh_unittest | grep -E '\b0\b'
47af0d7
bin/tlsh_unittest -c bin/tlsh_unittest -f bin/simple_unittest | grep -vE '\b0\b'
47af0d7
47af0d7
PYTHONPATH=%{buildroot}%{python3_sitearch} %{__python3} \
47af0d7
        -c "import tlsh; print(tlsh.hash(open('LICENSE', 'rb').read()))"
47af0d7
19b5c46
%ldconfig_scriptlets
47af0d7
0e30304
%files doc
47af0d7
%license LICENSE NOTICE.txt
47af0d7
%doc README.md
47af0d7
%doc TLSH_CTC_final.pdf
47af0d7
%doc TLSH_Introduction.pdf
47af0d7
%doc Attacking_LSH_and_Sim_Dig.pdf
47af0d7
47af0d7
%files -n python3-tlsh
47af0d7
%license LICENSE NOTICE.txt
47af0d7
%doc README.md
47af0d7
%{python3_sitearch}/*
47af0d7
47af0d7
%changelog
b70ab6d
%autochangelog