commit:     37439b919b964ea73f3675bdc40cd8ad56a674c5
Author:     Thomas Bracht Laumann Jespersen <t <AT> laumann <DOT> xyz>
AuthorDate: Sat Jun  4 20:37:38 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Jun  7 19:58:39 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=37439b91

dev-libs/tlsh: initial import

The first of two packages to add fuzzy-matching support for diffoscope.

Signed-off-by: Thomas Bracht Laumann Jespersen <t <AT> laumann.xyz>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-libs/tlsh/Manifest                             |  1 +
 .../tlsh/files/tlsh-4.8.2-gnuinstalldirs.patch     | 37 ++++++++++++++++++++++
 dev-libs/tlsh/files/tlsh-4.8.2-respect-flags.patch | 21 ++++++++++++
 dev-libs/tlsh/metadata.xml                         | 12 +++++++
 dev-libs/tlsh/tlsh-4.8.2.ebuild                    | 33 +++++++++++++++++++
 5 files changed, 104 insertions(+)

diff --git a/dev-libs/tlsh/Manifest b/dev-libs/tlsh/Manifest
new file mode 100644
index 000000000000..2425a1db29ee
--- /dev/null
+++ b/dev-libs/tlsh/Manifest
@@ -0,0 +1 @@
+DIST tlsh-4.8.2.tar.gz 3345458 BLAKE2B 
27d5eece16bb36225b9ae8b3d3a9d055a0f214fffae08a58c39211c3d918dd842497315a62237b291ee1055dfadad78826bbd24f7b9d88f510e9a31f74654039
 SHA512 
5355c7734f5356a3a7a31ccc078254835871fc0369f1889a34131a0f810735201c68f674eb18e975b6a03a32e5c284899ca9ffdc1f583e42192188c172d2aad0

diff --git a/dev-libs/tlsh/files/tlsh-4.8.2-gnuinstalldirs.patch 
b/dev-libs/tlsh/files/tlsh-4.8.2-gnuinstalldirs.patch
new file mode 100644
index 000000000000..d30363de6d74
--- /dev/null
+++ b/dev-libs/tlsh/files/tlsh-4.8.2-gnuinstalldirs.patch
@@ -0,0 +1,37 @@
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -51,7 +51,7 @@
+ # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 
ADVISED
+ # OF THE POSSIBILITY OF SUCH DAMAGE.
+ 
+-cmake_minimum_required(VERSION 2.6)
++cmake_minimum_required(VERSION 2.8.5)
+ 
+ project(TLSH)
+ 
+@@ -133,6 +133,8 @@ else(CMAKE_BUILD_TYPE STREQUAL Debug)
+     endif()
+ endif(CMAKE_BUILD_TYPE STREQUAL Debug)
+ 
++include(GNUInstallDirs)
++
+ if(MSVC)
+     add_definitions(-DWINDOWS -DTLSH_LIB)
+     include_directories(Windows)
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -78,10 +78,10 @@ if(TLSH_SHARED_LIBRARY EQUAL 1)
+ endif()
+ 
+ if(TLSH_SHARED_LIBRARY)
+-    install(TARGETS tlsh_static tlsh_shared DESTINATION lib)
++    install(TARGETS tlsh_static tlsh_shared DESTINATION 
${CMAKE_INSTALL_LIBDIR})
+ else()
+-    install(TARGETS tlsh_static             DESTINATION lib)
++    install(TARGETS tlsh_static             DESTINATION 
${CMAKE_INSTALL_LIBDIR})
+ endif()
+ 
+-install(FILES ../include/tlsh.h DESTINATION include/tlsh)
+-install(FILES ../include/tlsh_version.h DESTINATION include/tlsh)
++install(FILES ../include/tlsh.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/tlsh)
++install(FILES ../include/tlsh_version.h DESTINATION 
${CMAKE_INSTALL_INCLUDEDIR}/tlsh)

diff --git a/dev-libs/tlsh/files/tlsh-4.8.2-respect-flags.patch 
b/dev-libs/tlsh/files/tlsh-4.8.2-respect-flags.patch
new file mode 100644
index 000000000000..fc22b9a1d521
--- /dev/null
+++ b/dev-libs/tlsh/files/tlsh-4.8.2-respect-flags.patch
@@ -0,0 +1,21 @@
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -126,7 +126,7 @@ if (CMAKE_BUILD_TYPE STREQUAL Debug)
+     endif()
+ else(CMAKE_BUILD_TYPE STREQUAL Debug)
+     if(CMAKE_COMPILER_IS_GNUCXX)
+-        set(CMAKE_CXX_FLAGS "-O2 -fvisibility=internal")  ## Remove TlshImpl 
symbols
++        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=internal")  ## 
Remove TlshImpl symbols
+     endif()
+     if(MSVC)
+         set(CMAKE_CXX_FLAGS "/O2")        ## Optimize
+@@ -142,8 +142,7 @@ endif()
+ 
+ # user can override CXX; make sure tests link and load properly regardless of 
LD_LIBRARY_PATH
+ if(CMAKE_COMPILER_IS_GNUCXX)
+-    set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc")
+-    set(CMAKE_EXE_LINKER_FLAGS "-static-libstdc++")
++    set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++")
+ endif()
+ 
+ enable_testing()

diff --git a/dev-libs/tlsh/metadata.xml b/dev-libs/tlsh/metadata.xml
new file mode 100644
index 000000000000..89e6a410f9e7
--- /dev/null
+++ b/dev-libs/tlsh/metadata.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+       <maintainer type="person" proxied="yes">
+               <email>[email protected]</email>
+               <name>Thomas Bracht Laumann Jespersen</name>
+       </maintainer>
+       <maintainer type="person" proxied="proxy">
+               <email>[email protected]</email>
+               <name>Sam James</name>
+       </maintainer>
+</pkgmetadata>

diff --git a/dev-libs/tlsh/tlsh-4.8.2.ebuild b/dev-libs/tlsh/tlsh-4.8.2.ebuild
new file mode 100644
index 000000000000..00ff3ec45270
--- /dev/null
+++ b/dev-libs/tlsh/tlsh-4.8.2.ebuild
@@ -0,0 +1,33 @@
+# Copyright 2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+CMAKE_IN_SOURCE_BUILD=1
+inherit cmake
+
+DESCRIPTION="Fuzzy matching library"
+HOMEPAGE="https://github.com/trendmicro/tlsh";
+SRC_URI="https://github.com/trendmicro/${PN}/archive/${PV}.tar.gz -> 
${P}.tar.gz"
+
+LICENSE="|| ( Apache-2.0 BSD )"
+SLOT="0"
+KEYWORDS="~amd64"
+
+PATCHES=(
+       "${FILESDIR}"/${P}-gnuinstalldirs.patch
+       "${FILESDIR}"/${P}-respect-flags.patch
+)
+
+src_configure() {
+       local mycmakeargs=(
+               -DTLSH_CHECKSUM_1B=1
+               -DTLSH_SHARED_LIBRARY=1
+       )
+       cmake_src_configure
+}
+
+src_install() {
+       cmake_src_install
+       find "${ED}" -name '*.a' -delete || die # Remove the static lib
+}

Reply via email to