View | Details | Raw Unified | Return to bug 244381 | Differences between
and this patch

Collapse All | Expand All

(-)b/devel/tlsh/Makefile (+63 lines)
Added Link Here
1
# $FreeBSD$
2
3
PORTNAME=	tlsh
4
DISTVERSION=	3.17.0
5
CATEGORIES=	devel
6
MASTER_SITES=	GH
7
8
MAINTAINER=	cgull@glup.org
9
COMMENT=	Trend Micro Locality Sensitive Hash library and utilities
10
11
LICENSE=	APACHE20 BSD3CLAUSE
12
LICENSE_COMB=	dual
13
LICENSE_FILE=	${WRKSRC}/LICENSE
14
15
USES=		cmake
16
USE_LDCONFIG=	yes
17
USE_GITHUB=	yes
18
GH_ACCOUNT=	trendmicro
19
GH_PROJECT=	tlsh
20
21
# XXX STATIC option not supported by tlsh CMakeFiles
22
# These options don't actually work as needed for FreeBSD; the
23
# tlsh build always builds static libraries, and shared libraries are
24
# optional.
25
# OPTIONS_DEFINE=	STATIC
26
# OPTIONS_DEFAULT=
27
# STATIC_CMAKE_BOOL_OFF=	TLSH_SHARED_LIBRARY
28
29
OPTIONS_DEFINE=	DOCS
30
OPTIONS_DEFAULT=	DOCS
31
32
CMAKE_ARGS=	create_symlink tlsh_unittest tlsh
33
CMAKE_ON=	TLSH_SHARED_LIBRARY
34
35
TLSH_VERSION=	${PORTVERSION}
36
SHLIBVERMAJ=	${DISTVERSION:S/./ /g:[1]}
37
PLIST_SUB=	TLSH_VERSION=${TLSH_VERSION} SHLIBVER=${DISTVERSION} SHLIBVERMAJ=${SHLIBVERMAJ}
38
39
# XXX Testing/test.sh doesn't work with separated source and build directories
40
# TEST_TARGET=	test
41
42
post-build:
43
	${RLN} ${WRKSRC}/bin/tlsh_unittest ${WRKSRC}/bin/tlsh
44
45
# XXX tlsh's install is incomplete, finish it ourselves
46
# Rely on cmake install for library itself, add docs and command
47
# after.  tlsh's install only installs ${INCLUDEDIR}/tlsh.h, and skips
48
# version.h, so we must install both in ${INCLUDEDIR}/tlsh/
49
post-install:
50
	${MKDIR} ${STAGEDIR}${PREFIX}/include/tlsh
51
	${RM} ${STAGEDIR}${PREFIX}/include/tlsh.h
52
	${INSTALL_PROGRAM} ${WRKSRC}/bin/tlsh ${STAGEDIR}${PREFIX}/bin
53
	${INSTALL_PROGRAM} ${WRKSRC}/bin/tlsh_unittest ${STAGEDIR}${PREFIX}/bin
54
	${INSTALL_DATA} ${WRKSRC}/include/tlsh.h ${STAGEDIR}${PREFIX}/include/tlsh/
55
	${INSTALL_DATA} ${WRKSRC}/include/version.h ${STAGEDIR}${PREFIX}/include/tlsh/
56
57
post-install-DOCS-on:
58
	${MKDIR} ${STAGEDIR}${DOCSDIR}
59
	${INSTALL_MAN} ${WRKSRC}/README.md ${STAGEDIR}${DOCSDIR}
60
	${INSTALL_MAN} ${WRKSRC}/TLSH_Introduction.pdf ${STAGEDIR}${DOCSDIR}
61
	${INSTALL_MAN} ${WRKSRC}/TLSH_CTC_final.pdf ${STAGEDIR}${DOCSDIR}
62
63
.include <bsd.port.mk>
(-)b/devel/tlsh/distinfo (+3 lines)
Added Link Here
1
TIMESTAMP = 1581709654
2
SHA256 (trendmicro-tlsh-3.17.0_GH0.tar.gz) = 810cecdda1632ecb836278e5a58560d5b2b7911d02ed7419dc02b6a38e635985
3
SIZE (trendmicro-tlsh-3.17.0_GH0.tar.gz) = 2829248
(-)b/devel/tlsh/files/patch-Testing_test.sh (+240 lines)
Added Link Here
1
--- Testing/test.sh.orig	2020-02-16 01:55:44 UTC
2
+++ Testing/test.sh
3
@@ -1,4 +1,4 @@
4
-#!/bin/bash
5
+#!/bin/sh
6
 
7
 ##################################
8
 # set CREATE_EXP_FILE=1 if you want this script to create the Expected Results for the regression tests
9
@@ -10,26 +10,23 @@ echoerr() { echo "$@" 1>&2; }
10
 ## Set LD_LIBRARY_PATH so that tlsh can pick up the tlsh shared library
11
 export LD_LIBRARY_PATH=../lib:$LD_LIBRARY_PATH
12
 BASEDIR=$(dirname $0)
13
-pushd $BASEDIR > /dev/null
14
+cd $BASEDIR
15
 
16
 if test ! -f ../bin/tlsh
17
 then
18
 	echoerr "error: (127), you must compile tlsh"
19
-        popd > /dev/null
20
 	exit 127
21
 fi
22
 
23
 if test ! -f ../bin/simple_unittest
24
 then
25
 	echoerr "error: (127), you must compile ../bin/simple_unittest"
26
-        popd > /dev/null
27
 	exit 127
28
 fi
29
 
30
 if test ! -f ../bin/tlsh_version
31
 then
32
 	echoerr "error: (127), you must compile ../bin/tlsh_version"
33
-        popd > /dev/null
34
 	exit 127
35
 fi
36
 
37
@@ -91,7 +88,6 @@ runit() {
38
 		if test $CREATE_EXP_FILE = 0
39
 		then
40
 			echoerr "error: (1), Expected Result file $EXPECTED_OUT does not exist"
41
-			popd > /dev/null
42
 			exit 1
43
 		else
44
 			echo "cp $TMP/example_data.out $EXPECTED_OUT"
45
@@ -103,7 +99,6 @@ runit() {
46
 		if test $CREATE_EXP_FILE = 0
47
 		then
48
 			echoerr "error: (1), Expected Result file $EXPECTED_ERR does not exist"
49
-			popd > /dev/null
50
 			exit 1
51
 		else
52
 			echo "cp $TMP/example_data.err $EXPECTED_ERR"
53
@@ -115,7 +110,6 @@ runit() {
54
 	if test ! $diffc = 0
55
 	then
56
 		echoerr "error: (1), diff $TMP/example_data.out $EXPECTED_OUT"
57
-		popd > /dev/null
58
 		exit 1
59
 	fi
60
 
61
@@ -123,7 +117,6 @@ runit() {
62
 	if test ! $diffc = 0
63
 	then
64
 		echoerr "error: (1), diff $TMP/example_data.err $EXPECTED_ERR"
65
-		popd > /dev/null
66
 		exit 1
67
 	fi
68
 
69
@@ -154,7 +147,6 @@ runit() {
70
 		if test $CREATE_EXP_FILE = 0
71
 		then
72
 			echoerr "error: (1), Expected Result file $EXPECTED_SCO does not exist"
73
-			popd > /dev/null
74
 			exit 1
75
 		else
76
 			echo "cp $TMP/example_data.scores $EXPECTED_SCO"
77
@@ -166,7 +158,6 @@ runit() {
78
 		if test $CREATE_EXP_FILE = 0
79
 		then
80
 			echoerr "error: (1), Expected Result file $EXPECTED_ERR does not exist"
81
-			popd > /dev/null
82
 			exit 1
83
 		else
84
 			echo "cp $TMP/example_data.err2 $EXPECTED_ERR"
85
@@ -178,14 +169,12 @@ runit() {
86
 	if test ! $diffc = 0
87
 	then
88
 		echoerr "error: (2), diff $TMP/example_data.scores $EXPECTED_SCO"
89
-		popd > /dev/null
90
 		exit 2
91
 	fi
92
 	diffc=`diff --ignore-all-space $TMP/example_data.err2 $EXPECTED_ERR | wc -l`
93
 	if test ! $diffc = 0
94
 	then
95
 		echoerr "error: (2), diff $TMP/example_data.err2 $EXPECTED_ERR"
96
-		popd > /dev/null
97
 		exit 2
98
 	fi
99
 
100
@@ -218,7 +207,6 @@ runit() {
101
 		if test $CREATE_EXP_FILE = 0
102
 		then
103
 			echoerr "error: (3), Expected Result file $EXPECTED_SCO does not exist"
104
-			popd > /dev/null
105
 			exit 1
106
 		else
107
 			echo "cp $TMP/example_data.scores.2 $EXPECTED_SCO"
108
@@ -230,7 +218,6 @@ runit() {
109
 	if test ! $diffc = 0
110
 	then
111
 		echoerr "error: (3) diff $TMP/example_data.scores.2 $EXPECTED_SCO"
112
-		popd > /dev/null
113
 		exit 3
114
 	fi
115
 
116
@@ -259,7 +246,6 @@ runit() {
117
 		if test $CREATE_EXP_FILE = 0
118
 		then
119
 			echoerr "error: ($testnum), Expected Result file $EXPECTED_SCO does not exist"
120
-			popd > /dev/null
121
 			exit 1
122
 		else
123
 			echo "cp $TMP/example_data.xref.scores $EXPECTED_SCO"
124
@@ -270,7 +256,6 @@ runit() {
125
 	diff --ignore-all-space $TMP/example_data.xref.scores $EXPECTED_SCO > /dev/null 2>/dev/null
126
 	if [ $? -ne 0 ]; then
127
 		echoerr "error: ($testnum), diff $TMP/example_data.xref.scores $EXPECTED_SCO"
128
-		popd > /dev/null
129
 		exit $testnum
130
 	fi
131
 
132
@@ -301,7 +286,6 @@ runit() {
133
 		if test $CREATE_EXP_FILE = 0
134
 		then
135
 			echoerr "error: ($testnum), Expected Result file $EXPECTED_SCO does not exist"
136
-			popd > /dev/null
137
 			exit 1
138
 		else
139
 			echo "cp $TMP/example_data.scores.2.T-201 $EXPECTED_SCO"
140
@@ -312,7 +296,6 @@ runit() {
141
 	diff --ignore-all-space $TMP/example_data.scores.2.T-201 $EXPECTED_SCO > /dev/null 2>/dev/null
142
 	if [ $? -ne 0 ]; then
143
 		echoerr "error: ($testnum) diff $TMP/example_data.scores.2.T-201 $EXPECTED_SCO"
144
-		popd > /dev/null
145
 		exit $testnum
146
 	fi
147
 
148
@@ -351,7 +334,6 @@ then
149
 	if test $CREATE_EXP_FILE = 0
150
 	then
151
 		echoerr "error: ($testnum), Expected Result file $EXPECTED_TESTLEN does not exist"
152
-		popd > /dev/null
153
 		exit 1
154
 	else
155
 		echo "cp $TMP/testlen.out $EXPECTED_TESTLEN"
156
@@ -362,7 +344,6 @@ fi
157
 diff --ignore-all-space $TMP/testlen.out $EXPECTED_TESTLEN > /dev/null 2>/dev/null
158
 if [ $? -ne 0 ]; then
159
 	echoerr "error: ($testnum) diff $TMP/testlen.out $EXPECTED_TESTLEN"
160
-	popd > /dev/null
161
 	exit $testnum
162
 fi
163
 echo "passed"
164
@@ -390,7 +371,6 @@ for file in small small2 ; do
165
 		if test $CREATE_EXP_FILE = 0
166
 		then
167
 			echoerr "error: ($testnum), Expected Result file $EXPECTED_TLSH does not exist"
168
-			popd > /dev/null
169
 			exit 1
170
 		else
171
 			echo "cp $TMP/$file.tlsh $EXPECTED_TLSH"
172
@@ -401,7 +381,6 @@ for file in small small2 ; do
173
 	diff --ignore-all-space $TMP/$file.tlsh $EXPECTED_TLSH
174
 	if [ $? -ne 0 ]; then
175
 		echoerr "error: ($testnum) $TMP/$file.tlsh $EXPECTED_TLSH"
176
-		popd > /dev/null
177
 		exit $testnum
178
 	fi
179
 done
180
@@ -432,14 +411,12 @@ EXPECTED_SCO=exp/example_data.$HASH.$CHKSUM.len.scores
181
 if test ! -f $EXPECTED_SCO
182
 then
183
 	echoerr "error: ($testnum), Expected Result file $EXPECTED_SCO does not exist"
184
-	popd > /dev/null
185
 	exit 1
186
 fi
187
 
188
 diff --ignore-all-space $TMP/example_data.scores.l2.T-201 $EXPECTED_SCO > /dev/null 2>/dev/null
189
 if [ $? -ne 0 ]; then
190
 	echoerr "error: ($testnum) diff $TMP/example_data.scores.l2.T-201 $EXPECTED_SCO"
191
-	popd > /dev/null
192
 	exit $testnum
193
 fi
194
 
195
@@ -454,7 +431,6 @@ echo "../bin/${TLSH_PROG} -T 201 -l2 -lcsv -l example_
196
 diff --ignore-all-space $TMP/example_data.scores.l2csv.T-201 $EXPECTED_SCO > /dev/null 2>/dev/null
197
 if [ $? -ne 0 ]; then
198
 	echoerr "error: ($testnum) diff $TMP/example_data.scores.l2csv.T-201 $EXPECTED_SCO"
199
-	popd > /dev/null
200
 	exit $testnum
201
 fi
202
 
203
@@ -480,14 +456,12 @@ EXPECTED_RES=exp/example_data.Week3.split.tlsh
204
 if test ! -f $EXPECTED_RES
205
 then
206
 	echoerr "error: ($testnum), Expected Result file $EXPECTED_RES does not exist"
207
-	popd > /dev/null
208
 	exit 1
209
 fi
210
 
211
 diff --ignore-all-space $TMP/example_data.Week3.split.tlsh $EXPECTED_RES > /dev/null 2>/dev/null
212
 if [ $? -ne 0 ]; then
213
 	echoerr "error: ($testnum) diff $TMP/example_data.Week3.split.tlsh $EXPECTED_RES"
214
-	popd > /dev/null
215
 	exit $testnum
216
 fi
217
 
218
@@ -512,7 +486,6 @@ then
219
 	if test $CREATE_EXP_FILE = 0
220
 	then
221
 		echoerr "error: ($testnum), Expected Result file $EXPECTED_STEST does not exist"
222
-		popd > /dev/null
223
 		exit 1
224
 	else
225
 		echo "cp $TMP/simple_unittest.out $EXPECTED_STEST"
226
@@ -523,13 +496,10 @@ fi
227
 diff --ignore-all-space $TMP/simple_unittest.out $EXPECTED_STEST > /dev/null 2>/dev/null
228
 if [ $? -ne 0 ]; then
229
 	echoerr "error: ($testnum) diff $TMP/simple_unittest.out $EXPECTED_STEST"
230
-        popd > /dev/null
231
-	exit -1
232
+	exit 255
233
 fi
234
 
235
 echo "passed all example data tests"
236
-
237
-popd > /dev/null
238
 
239
 echo
240
 echo "If you have made changes to the Tlsh python module, build and install it, and run python_test.sh"
(-)b/devel/tlsh/files/patch-src_CMakeLists.txt (+22 lines)
Added Link Here
1
--- src/CMakeLists.txt.orig	2020-02-16 00:07:55 UTC
2
+++ src/CMakeLists.txt
3
@@ -65,16 +65,15 @@ set_target_properties(tlsh PROPERTIES OUTPUT_NAME tlsh
4
 # it was causing problems when compiling / testing tools on Linux
5
 ##########################
6
 
7
-set(TLSH_SHARED_LIBRARY 0)
8
-if(TLSH_SHARED_LIBRARY EQUAL 1)
9
+if(TLSH_SHARED_LIBRARY)
10
     add_library(tlsh_shared SHARED ${TLSH_SRCS})
11
     set_target_properties(tlsh_shared PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib)
12
     set_target_properties(tlsh_shared PROPERTIES OUTPUT_NAME tlsh${BUILD_POSTFIX})
13
     set_target_properties(tlsh_shared PROPERTIES VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}"
14
-                                                 SOVERSION "0")
15
+                                                 SOVERSION "${VERSION_MAJOR}")
16
 endif()
17
 
18
-if(TLSH_SHARED_LIBRARY EQUAL 1)
19
+if(TLSH_SHARED_LIBRARY)
20
     install(TARGETS tlsh tlsh_shared DESTINATION lib)
21
 else()
22
     install(TARGETS tlsh             DESTINATION lib)
(-)b/devel/tlsh/pkg-descr (+6 lines)
Added Link Here
1
TLSH is a library implementing the "Trend Micro Locality Sensitive
2
Hash" fuzzy matching hash algorithm.
3
4
This port only installs the core C++ library.
5
6
WWW: https://github.com/trendmicro/tlsh/
(-)b/devel/tlsh/pkg-plist (+11 lines)
Added Link Here
1
bin/tlsh
2
bin/tlsh_unittest
3
include/tlsh/tlsh.h
4
include/tlsh/version.h
5
lib/libtlsh.a
6
lib/libtlsh.so
7
lib/libtlsh.so.%%SHLIBVERMAJ%%
8
lib/libtlsh.so.%%SHLIBVER%%
9
%%PORTDOCS%%%%DOCSDIR%%/README.md
10
%%PORTDOCS%%%%DOCSDIR%%/TLSH_Introduction.pdf
11
%%PORTDOCS%%%%DOCSDIR%%/TLSH_CTC_final.pdf

Return to bug 244381