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

Collapse All | Expand All

(-)b/devel/tlsh/Makefile (+66 lines)
Added Link Here
1
# Created by: John Hood <cgull@glup.org>
2
#
3
# This project periodically versions its work, but doesn't always tag
4
# and release those versions.  In that case both DISTVERSION and
5
# GH_TAGNAME can be used to get a version.
6
7
PORTNAME=	tlsh
8
DISTVERSION=	4.7.2
9
CATEGORIES=	devel
10
11
MAINTAINER=	cgull@glup.org
12
COMMENT=	Trend Micro Locality Sensitive Hash library and utilities
13
14
LICENSE=	APACHE20 BSD3CLAUSE
15
LICENSE_COMB=	dual
16
LICENSE_FILE=	${WRKSRC}/LICENSE
17
18
USES=		cmake
19
USE_GITHUB=	yes
20
GH_ACCOUNT=	trendmicro
21
GH_TAGNAME=	d842e75
22
USE_LDCONFIG=	yes
23
24
CMAKE_ARGS=	create_symlink \
25
		tlsh \
26
		tlsh_unittest
27
CMAKE_ON=	TLSH_SHARED_LIBRARY
28
29
# XXX Testing/test.sh is too dumb to work with separated source and build directories.
30
TEST_TARGET=	test
31
32
_TLSH_VERSION=	${PORTVERSION}
33
_SHLIBVERMAJ=	${DISTVERSION:S/./ /g:[1]}
34
PLIST_SUB=	SHLIBVER=${DISTVERSION} \
35
		SHLIBVERMAJ=${_SHLIBVERMAJ} \
36
		TLSH_VERSION=${_TLSH_VERSION}
37
38
OPTIONS_DEFINE=	DOCS
39
# The tlsh build always builds static libraries, and shared libraries
40
# are optional.  The STATIC option is the reverse, and can't be used
41
# with tlsh.
42
# OPTIONS_DEFINE=	STATIC
43
# OPTIONS_DEFAULT=
44
# STATIC_CMAKE_BOOL_OFF=	TLSH_SHARED_LIBRARY
45
46
post-build:
47
	${RLN} ${WRKSRC}/bin/tlsh_unittest ${WRKSRC}/bin/tlsh
48
49
do-install-DOCS-on:
50
	${MKDIR} ${STAGEDIR}${DOCSDIR}
51
	${INSTALL_MAN} ${WRKSRC}/README.md ${STAGEDIR}${DOCSDIR}
52
	${INSTALL_MAN} ${WRKSRC}/TLSH_Introduction.pdf ${STAGEDIR}${DOCSDIR}
53
	${INSTALL_MAN} ${WRKSRC}/TLSH_CTC_final.pdf ${STAGEDIR}${DOCSDIR}
54
55
# rely on cmake install for library itself, add docs and command after.
56
# XXX tlsh's install only installs ${INCLUDEDIR}/tlsh.h, and skips version.h,
57
# so we must install both in ${INCLUDEDIR}/tlsh/
58
post-install:
59
	${MKDIR} ${STAGEDIR}${PREFIX}/include/tlsh
60
	${RM} ${STAGEDIR}${PREFIX}/include/tlsh.h
61
	${INSTALL_PROGRAM} ${WRKSRC}/bin/tlsh ${STAGEDIR}${PREFIX}/bin
62
	${INSTALL_PROGRAM} ${WRKSRC}/bin/tlsh_unittest ${STAGEDIR}${PREFIX}/bin
63
	${INSTALL_DATA} ${WRKSRC}/include/tlsh.h ${STAGEDIR}${PREFIX}/include/tlsh/
64
	${INSTALL_DATA} ${WRKSRC}/include/version.h ${STAGEDIR}${PREFIX}/include/tlsh/
65
66
.include <bsd.port.mk>
(-)b/devel/tlsh/distinfo (+3 lines)
Added Link Here
1
TIMESTAMP = 1630608937
2
SHA256 (trendmicro-tlsh-4.7.2-d842e75_GH0.tar.gz) = 2cdcc05cd20026839f8b0d6b42a40b5c83d99b4620ff3c1770218167ebc4937d
3
SIZE (trendmicro-tlsh-4.7.2-d842e75_GH0.tar.gz) = 3345166
(-)b/devel/tlsh/files/patch-Testing_test.sh (+268 lines)
Added Link Here
1
--- Testing/test.sh.orig	2020-12-10 01:30:11 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
@@ -8,7 +8,7 @@ CREATE_EXP_FILE=0
10
 echoerr() { echo "$@" 1>&2; }
11
 
12
 BASEDIR=$(dirname $0)
13
-pushd $BASEDIR > /dev/null
14
+cd $BASEDIR
15
 
16
 LISTOPTION=1
17
 JSONOPTION=1
18
@@ -34,14 +34,12 @@ echo "TLSH_PROG=$TLSH_PROG"
19
 if test ! -f $TLSH_PROG
20
 then
21
 	echoerr "error: (127), you must compile $TLSH_PROG"
22
-        popd > /dev/null
23
 	exit 127
24
 fi
25
 
26
 if test ! -f $SIMP_PROG
27
 then
28
 	echoerr "error: (127), you must compile $SIMP_PROG"
29
-        popd > /dev/null
30
 	exit 127
31
 fi
32
 
33
@@ -104,7 +102,6 @@ runit() {
34
 	if test ! -f $TMP/example_data.out
35
 	then
36
 		echoerr "error: (1), $TMP/example_data.out does not exist"
37
-		popd > /dev/null
38
 		exit 1
39
 	fi
40
 	EXPECTED_OUT=exp/example_data.$HASH.$CHKSUM.$XLEN.out_EXP
41
@@ -114,7 +111,6 @@ runit() {
42
 		if test $CREATE_EXP_FILE = 0
43
 		then
44
 			echoerr "error: (1), Expected Result file $EXPECTED_OUT does not exist"
45
-			popd > /dev/null
46
 			exit 1
47
 		else
48
 			echo "cp $TMP/example_data.out $EXPECTED_OUT"
49
@@ -126,7 +122,6 @@ runit() {
50
 		if test $CREATE_EXP_FILE = 0
51
 		then
52
 			echoerr "error: (1), Expected Result file $EXPECTED_ERR does not exist"
53
-			popd > /dev/null
54
 			exit 1
55
 		else
56
 			echo "cp $TMP/example_data.err $EXPECTED_ERR"
57
@@ -137,7 +132,6 @@ runit() {
58
 	if test ! $diffc = 0
59
 	then
60
 		echoerr "error: (1), diff $TMP/example_data.out $EXPECTED_OUT"
61
-		popd > /dev/null
62
 		exit 1
63
 	fi
64
 
65
@@ -145,7 +139,6 @@ runit() {
66
 	if test ! $diffc = 0
67
 	then
68
 		echoerr "error: (1), diff $TMP/example_data.err $EXPECTED_ERR"
69
-		popd > /dev/null
70
 		exit 1
71
 	fi
72
 
73
@@ -160,7 +153,6 @@ runit() {
74
 		if test ! $diffc = 0
75
 		then
76
 			echoerr "error: (1), diff $TMP/example_data.json_out $EXPECTED_OUT"
77
-			popd > /dev/null
78
 			exit 1
79
 		fi
80
 		echo "passed"
81
@@ -194,7 +186,6 @@ runit() {
82
 		if test $CREATE_EXP_FILE = 0
83
 		then
84
 			echoerr "error: (1), Expected Result file $EXPECTED_SCO does not exist"
85
-			popd > /dev/null
86
 			exit 1
87
 		else
88
 			echo "cp $TMP/example_data.scores $EXPECTED_SCO"
89
@@ -206,7 +197,6 @@ runit() {
90
 		if test $CREATE_EXP_FILE = 0
91
 		then
92
 			echoerr "error: (1), Expected Result file $EXPECTED_ERR does not exist"
93
-			popd > /dev/null
94
 			exit 1
95
 		else
96
 			echo "cp $TMP/example_data.err2 $EXPECTED_ERR"
97
@@ -218,14 +208,12 @@ runit() {
98
 	if test ! $diffc = 0
99
 	then
100
 		echoerr "error: (2), diff $TMP/example_data.scores $EXPECTED_SCO"
101
-		popd > /dev/null
102
 		exit 2
103
 	fi
104
 	diffc=`diff --ignore-all-space $TMP/example_data.err2 $EXPECTED_ERR | wc -l`
105
 	if test ! $diffc = 0
106
 	then
107
 		echoerr "error: (2), diff $TMP/example_data.err2 $EXPECTED_ERR"
108
-		popd > /dev/null
109
 		exit 2
110
 	fi
111
 
112
@@ -260,7 +248,6 @@ runit() {
113
 			if test $CREATE_EXP_FILE = 0
114
 			then
115
 				echoerr "error: (3), Expected Result file $EXPECTED_SCO does not exist"
116
-				popd > /dev/null
117
 				exit 1
118
 			else
119
 				echo "cp $TMP/example_data.scores.2 $EXPECTED_SCO"
120
@@ -272,7 +259,6 @@ runit() {
121
 		if test ! $diffc = 0
122
 		then
123
 			echoerr "error: (3) diff $TMP/example_data.scores.2 $EXPECTED_SCO"
124
-			popd > /dev/null
125
 			exit 3
126
 		fi
127
 
128
@@ -304,7 +290,6 @@ runit() {
129
 		if test $CREATE_EXP_FILE = 0
130
 		then
131
 			echoerr "error: ($testnum), Expected Result file $EXPECTED_SCO does not exist"
132
-			popd > /dev/null
133
 			exit 1
134
 		else
135
 			echo "cp $TMP/example_data.xref.scores $EXPECTED_SCO"
136
@@ -315,7 +300,6 @@ runit() {
137
 	diff --ignore-all-space $TMP/example_data.xref.scores $EXPECTED_SCO > /dev/null 2>/dev/null
138
 	if [ $? -ne 0 ]; then
139
 		echoerr "error: ($testnum), diff $TMP/example_data.xref.scores $EXPECTED_SCO"
140
-		popd > /dev/null
141
 		exit $testnum
142
 	fi
143
 
144
@@ -334,7 +318,6 @@ runit() {
145
 		diff --ignore-all-space $TMP/example_data.xref.json_scores $EXPECTED_SCO > /dev/null 2>/dev/null
146
 		if [ $? -ne 0 ]; then
147
 			echoerr "error: ($testnum), diff $TMP/example_data.xref.json_scores $EXPECTED_SCO"
148
-			popd > /dev/null
149
 			exit $testnum
150
 		fi
151
 		echo "passed"
152
@@ -370,7 +353,6 @@ runit() {
153
 			if test $CREATE_EXP_FILE = 0
154
 			then
155
 				echoerr "error: ($testnum), Expected Result file $EXPECTED_SCO does not exist"
156
-				popd > /dev/null
157
 				exit 1
158
 			else
159
 				echo "cp $TMP/example_data.scores.2.T-201 $EXPECTED_SCO"
160
@@ -381,7 +363,6 @@ runit() {
161
 		diff --ignore-all-space $TMP/example_data.scores.2.T-201 $EXPECTED_SCO > /dev/null 2>/dev/null
162
 		if [ $? -ne 0 ]; then
163
 			echoerr "error: ($testnum) diff $TMP/example_data.scores.2.T-201 $EXPECTED_SCO"
164
-			popd > /dev/null
165
 			exit $testnum
166
 		fi
167
 		echo "passed"
168
@@ -398,7 +379,6 @@ runit
169
 if test "$1" = "_go"
170
 then
171
 	echo "passed all example data tests (for go implementation)"
172
-	popd > /dev/null
173
 	exit 0
174
 fi
175
 runit "-xlen"
176
@@ -428,7 +408,6 @@ then
177
 	if test $CREATE_EXP_FILE = 0
178
 	then
179
 		echoerr "error: ($testnum), Expected Result file $EXPECTED_TESTLEN does not exist"
180
-		popd > /dev/null
181
 		exit 1
182
 	else
183
 		echo "cp $TMP/testlen.out $EXPECTED_TESTLEN"
184
@@ -439,7 +418,6 @@ fi
185
 diff --ignore-all-space $TMP/testlen.out $EXPECTED_TESTLEN > /dev/null 2>/dev/null
186
 if [ $? -ne 0 ]; then
187
 	echoerr "error: ($testnum) diff $TMP/testlen.out $EXPECTED_TESTLEN"
188
-	popd > /dev/null
189
 	exit $testnum
190
 fi
191
 echo "passed"
192
@@ -467,7 +445,6 @@ for file in small small2 ; do
193
 		if test $CREATE_EXP_FILE = 0
194
 		then
195
 			echoerr "error: ($testnum), Expected Result file $EXPECTED_TLSH does not exist"
196
-			popd > /dev/null
197
 			exit 1
198
 		else
199
 			echo "cp $TMP/$file.tlsh $EXPECTED_TLSH"
200
@@ -478,7 +455,6 @@ for file in small small2 ; do
201
 	diff --ignore-all-space $TMP/$file.tlsh $EXPECTED_TLSH
202
 	if [ $? -ne 0 ]; then
203
 		echoerr "error: ($testnum) $TMP/$file.tlsh $EXPECTED_TLSH"
204
-		popd > /dev/null
205
 		exit $testnum
206
 	fi
207
 done
208
@@ -511,14 +487,12 @@ then
209
 	if test ! -f $EXPECTED_SCO
210
 	then
211
 		echoerr "error: ($testnum), Expected Result file $EXPECTED_SCO does not exist"
212
-		popd > /dev/null
213
 		exit 1
214
 	fi
215
 
216
 	diff --ignore-all-space $TMP/example_data.scores.l2.T-201 $EXPECTED_SCO > /dev/null 2>/dev/null
217
 	if [ $? -ne 0 ]; then
218
 		echoerr "error: ($testnum) diff $TMP/example_data.scores.l2.T-201 $EXPECTED_SCO"
219
-		popd > /dev/null
220
 		exit $testnum
221
 	fi
222
 
223
@@ -533,7 +507,6 @@ then
224
 	diff --ignore-all-space $TMP/example_data.scores.l2csv.T-201 $EXPECTED_SCO > /dev/null 2>/dev/null
225
 	if [ $? -ne 0 ]; then
226
 		echoerr "error: ($testnum) diff $TMP/example_data.scores.l2csv.T-201 $EXPECTED_SCO"
227
-		popd > /dev/null
228
 		exit $testnum
229
 	fi
230
 
231
@@ -563,14 +536,12 @@ then
232
 	if test ! -f $EXPECTED_RES
233
 	then
234
 		echoerr "error: ($testnum), Expected Result file $EXPECTED_RES does not exist"
235
-		popd > /dev/null
236
 		exit 1
237
 	fi
238
 
239
 	diff --ignore-all-space $TMP/example_data.Week3.split.tlsh $EXPECTED_RES > /dev/null 2>/dev/null
240
 	if [ $? -ne 0 ]; then
241
 		echoerr "error: ($testnum) diff $TMP/example_data.Week3.split.tlsh $EXPECTED_RES"
242
-		popd > /dev/null
243
 		exit $testnum
244
 	fi
245
 
246
@@ -598,7 +569,6 @@ then
247
 	if test $CREATE_EXP_FILE = 0
248
 	then
249
 		echoerr "error: ($testnum), Expected Result file $EXPECTED_STEST does not exist"
250
-		popd > /dev/null
251
 		exit 1
252
 	else
253
 		echo "cp $TMP/simple_unittest.out $EXPECTED_STEST"
254
@@ -609,13 +579,10 @@ fi
255
 diff --ignore-all-space $TMP/simple_unittest.out $EXPECTED_STEST > /dev/null 2>/dev/null
256
 if [ $? -ne 0 ]; then
257
 	echoerr "error: ($testnum) diff $TMP/simple_unittest.out $EXPECTED_STEST"
258
-        popd > /dev/null
259
-	exit -1
260
+	exit 255
261
 fi
262
 
263
 echo "passed all example data tests"
264
-
265
-popd > /dev/null
266
 
267
 echo
268
 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 (+4 lines)
Added Link Here
1
TLSH is a fuzzy matching library implementing a locality-sensitive
2
hash algorithm.  Authored by Trend Micro.
3
4
This port only includes the core C++ library.
(-)b/devel/tlsh/pkg-plist (+12 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
@comment
10
%%PORTDOCS%%%%DOCSDIR%%/README.md
11
%%PORTDOCS%%%%DOCSDIR%%/TLSH_Introduction.pdf
12
%%PORTDOCS%%%%DOCSDIR%%/TLSH_CTC_final.pdf

Return to bug 244381