Sisyphus repository
Last update: 1 october 2023 | SRPMs: 18631 | Visits: 37735558
en ru br
ALT Linux repos
S:4.11.2-alt1

Group :: System/Libraries
RPM: libtlsh

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs and FR  Repocop 

Patch: libtlsh-4.9.3-alt.patch
Download


 .gear/rules                                        |  3 +
 .../tags/df5a0ab731a3a92bcc15755473cbc7fe698cbf85  |  6 ++
 .gear/tags/list                                    |  2 +
 .gear/tlsh.spec                                    | 89 ++++++++++++++++++++++
 py_ext/setup.py                                    | 26 ++-----
 src/CMakeLists.txt                                 |  3 +
 6 files changed, 109 insertions(+), 20 deletions(-)
diff --git a/.gear/rules b/.gear/rules
new file mode 100644
index 0000000..8cb1382
--- /dev/null
+++ b/.gear/rules
@@ -0,0 +1,3 @@
+tar: @version@:.
+spec: .gear/tlsh.spec
+diff: @version@:. . name=@name@-@version@-alt.patch
diff --git a/.gear/tags/df5a0ab731a3a92bcc15755473cbc7fe698cbf85 b/.gear/tags/df5a0ab731a3a92bcc15755473cbc7fe698cbf85
new file mode 100644
index 0000000..3b14ad5
--- /dev/null
+++ b/.gear/tags/df5a0ab731a3a92bcc15755473cbc7fe698cbf85
@@ -0,0 +1,6 @@
+object 22fa9a62068b92c63f2b5a87004a7a7ceaac1930
+type commit
+tag v3.4.5
+tagger scott_forman <lane_forman@trendmicro.com> 1453429825 -0800
+
+Tag for commit 22fa9a62068b92c63f2b5a87004a7a7ceaac1930 for version 3.4.5
diff --git a/.gear/tags/list b/.gear/tags/list
new file mode 100644
index 0000000..d151fef
--- /dev/null
+++ b/.gear/tags/list
@@ -0,0 +1,2 @@
+df5a0ab731a3a92bcc15755473cbc7fe698cbf85 v3.4.5
+2cb6a04fa5bec627a3c255aec7fb6c622fa2960a 4.9.3
diff --git a/.gear/tlsh.spec b/.gear/tlsh.spec
new file mode 100644
index 0000000..505ff8b
--- /dev/null
+++ b/.gear/tlsh.spec
@@ -0,0 +1,89 @@
+%define _unpackaged_files_terminate_build 1
+
+Name: libtlsh
+Version: 4.9.3
+Release: alt1
+
+Summary: Fuzzy text matching library
+Group: System/Libraries
+License: ASL 2.0
+Url: https://github.com/trendmicro/tlsh
+
+Source: %name-%version.tar
+Patch1: %name-%version-alt.patch
+
+BuildRequires: gcc-c++ cmake python3-devel ctest libstdc++-devel-static
+
+%define _description TLSH is a fuzzy matching library. \
+Given a byte stream with a minimum length of 50 bytes \
+TLSH generates a hash value which can be used for similarity comparisons. \
+Similar objects will have similar hash values which allows for \
+the detection of similar objects by comparing their hash values.  Note that \
+the byte stream should have a sufficient amount of complexity.  For example, \
+a byte stream of identical bytes will not generate a hash value.
+
+%description
+%_description
+
+%package devel
+Summary: Development files for TLSH
+Group: Development/C++
+%description devel
+This package contains development headers and libraries for TLSH.
+
+%_description
+
+%package -n python3-module-%name
+Summary: Python 3 interface for TLSH
+Group: Development/Python3
+%description -n python3-module-%name
+%_description
+
+%prep
+%setup
+%patch1 -p1
+
+%build
+%cmake -DTLSH_SHARED_LIBRARY=1
+%cmake_build
+
+pushd py_ext
+%python3_build
+popd
+
+%check
+make -C %_cmake__builddir test
+
+%install
+mkdir -p %buildroot%_libdir %buildroot%_includedir
+cp -a lib/libtlsh.so* %buildroot%_libdir/
+cp -a include %buildroot%_includedir/tlsh/
+
+pushd py_ext
+%python3_install
+popd
+
+%files
+%doc LICENSE NOTICE.txt README.md
+%doc TLSH_CTC_final.pdf
+%doc TLSH_Introduction.pdf
+%doc Attacking_LSH_and_Sim_Dig.pdf
+%_libdir/libtlsh.so.*
+
+%files devel
+%_includedir/tlsh
+%_libdir/libtlsh.so
+
+%files -n python3-module-%name
+%doc LICENSE NOTICE.txt README.md
+%python3_sitelibdir/*
+
+%changelog
+* Wed Sep 22 2021 Slava Aseev <ptrnine@altlinux.org> 4.9.3-alt1
+- update to latest upstream version
+- remove python2 build
+- enable tests
+
+* Wed Jan 16 2019 Slava Aseev <ptrnine@altlinux.org> 3.4.5-alt1
+- Initial build for ALT
+
diff --git a/py_ext/setup.py b/py_ext/setup.py
index c2160b6..25e5130 100644
--- a/py_ext/setup.py
+++ b/py_ext/setup.py
@@ -21,26 +21,12 @@ with open(join(realpath('..'), 'CMakeLists.txt'), 'r') as f:
     if m:
       tlsh_3b = ''
 
-if os.name == 'nt':
-  tlsh_module = Extension('tlsh', \
-    sources = ['tlshmodule.cpp', \
-      join(realpath('..'), 'src', 'tlsh.cpp'), \
-      join(realpath('..'), 'src', 'tlsh_impl.cpp'), \
-      join(realpath('..'), 'src', 'tlsh_util.cpp') \
-    ], \
-    include_dirs = [join(realpath('..'), 'include'),
-                    join(realpath('..'), 'Windows')],\
-    define_macros = [('WINDOWS', None),], \
-  )
-else:
-  tlsh_module = Extension('tlsh', \
-    sources = ['tlshmodule.cpp', \
-      join(realpath('..'), 'src', 'tlsh.cpp'), \
-      join(realpath('..'), 'src', 'tlsh_impl.cpp'), \
-      join(realpath('..'), 'src', 'tlsh_util.cpp') \
-    ], \
-    include_dirs = [join(realpath('..'), 'include')],
-  )
+tlsh_module = Extension('tlsh', \
+  sources = ['tlshmodule.cpp'], \
+  library_dirs = ['../lib'], \
+  libraries = ['tlsh'], \
+  include_dirs = [join(realpath('..'), 'include')], \
+)
 
 if tlsh_256 != '':
   tlsh_module.extra_compile_args.append(tlsh_256)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 327d5ab..fcb9915 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -75,6 +75,9 @@ if(TLSH_SHARED_LIBRARY EQUAL 1)
     set_target_properties(tlsh_shared PROPERTIES OUTPUT_NAME tlsh${BUILD_POSTFIX})
     set_target_properties(tlsh_shared PROPERTIES VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}"
                                                  SOVERSION "${VERSION_MAJOR}")
+
+    find_package(Threads REQUIRED)
+    target_link_libraries(tlsh_shared Threads::Threads)
 endif()
 
 if(TLSH_SHARED_LIBRARY)
 
design & coding: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
current maintainer: Michael Shigorin