Skip to content

Commit 455a7f3

Browse files
Junio C HamanoJunio C Hamano
authored andcommitted
More portability.
- The location of openssl development files got customizable. - The location of iconv development files got customizable. - Pass $TAR down to t5000 test so that the user can override with 'gmake TAR=gtar'. - Solaris 'bc' does not seem to grok "define abs()". There is no reason to use bc there -- expr would do. Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8098a17 commit 455a7f3

File tree

4 files changed

+34
-22
lines changed

4 files changed

+34
-22
lines changed

Makefile

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,18 +200,32 @@ endif
200200
ifndef NO_OPENSSL
201201
LIB_OBJS += epoch.o
202202
OPENSSL_LIBSSL = -lssl
203+
ifdef OPENSSLDIR
204+
# Again this may be problematic -- gcc does not always want -R.
205+
CFLAGS += -I$(OPENSSLDIR)/include
206+
OPENSSL_LINK = -L$(OPENSSLDIR)/lib -R$(OPENSSLDIR)/lib
207+
else
208+
OPENSSL_LINK =
209+
endif
203210
else
204211
DEFINES += '-DNO_OPENSSL'
205212
MOZILLA_SHA1 = 1
206213
OPENSSL_LIBSSL =
207214
endif
208215
ifdef NEEDS_SSL_WITH_CRYPTO
209-
LIB_4_CRYPTO = -lcrypto -lssl
216+
LIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto -lssl
210217
else
211-
LIB_4_CRYPTO = -lcrypto
218+
LIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto
212219
endif
213220
ifdef NEEDS_LIBICONV
214-
LIB_4_ICONV = -liconv
221+
ifdef ICONVDIR
222+
# Again this may be problematic -- gcc does not always want -R.
223+
CFLAGS += -I$(ICONVDIR)/include
224+
ICONV_LINK = -L$(ICONVDIR)/lib -R$(ICONVDIR)/lib
225+
else
226+
ICONV_LINK =
227+
endif
228+
LIB_4_ICONV = $(ICONV_LINK) -liconv
215229
else
216230
LIB_4_ICONV =
217231
endif

t/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
#GIT_TEST_OPTS=--verbose --debug
77
SHELL_PATH ?= $(SHELL)
8+
TAR ?= $(TAR)
89

910
T = $(wildcard t[0-9][0-9][0-9][0-9]-*.sh)
1011

t/t5000-tar-tree.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ test_expect_success \
5050

5151
test_expect_success \
5252
'validate file modification time' \
53-
'TZ=GMT tar tvf b.tar a/a |
53+
'TZ=GMT $TAR tvf b.tar a/a |
5454
awk \{print\ \$4,\ \(length\(\$5\)\<7\)\ ?\ \$5\":00\"\ :\ \$5\} \
5555
>b.mtime &&
5656
echo "2005-05-27 22:00:00" >expected.mtime &&
@@ -63,7 +63,7 @@ test_expect_success \
6363

6464
test_expect_success \
6565
'extract tar archive' \
66-
'(cd b && tar xf -) <b.tar'
66+
'(cd b && $TAR xf -) <b.tar'
6767

6868
test_expect_success \
6969
'validate filenames' \
@@ -80,7 +80,7 @@ test_expect_success \
8080

8181
test_expect_success \
8282
'extract tar archive with prefix' \
83-
'(cd c && tar xf -) <c.tar'
83+
'(cd c && $TAR xf -) <c.tar'
8484

8585
test_expect_success \
8686
'validate filenames with prefix' \

t/t6002-rev-list-bisect.sh

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,6 @@ test_description='Tests git-rev-list --bisect functionality'
77
. ./test-lib.sh
88
. ../t6000lib.sh # t6xxx specific functions
99

10-
bc_expr()
11-
{
12-
bc <<EOF
13-
scale=1
14-
define abs(x) {
15-
if (x>=0) { return (x); } else { return (-x); }
16-
}
17-
define floor(x) {
18-
save=scale; scale=0; result=x/1; scale=save; return (result);
19-
}
20-
$*
21-
EOF
22-
}
23-
2410
# usage: test_bisection max-diff bisect-option head ^prune...
2511
#
2612
# e.g. test_bisection 1 --bisect l1 ^l0
@@ -35,8 +21,19 @@ test_bisection_diff()
3521
_head=$1
3622
shift 1
3723
_bisection_size=$(git-rev-list $_bisection "$@" | wc -l)
38-
[ -n "$_list_size" -a -n "$_bisection_size" ] || error "test_bisection_diff failed"
39-
test_expect_success "bisection diff $_bisect_option $_head $* <= $_max_diff" "[ $(bc_expr "floor(abs($_list_size/2)-$_bisection_size)") -le $_max_diff ]"
24+
[ -n "$_list_size" -a -n "$_bisection_size" ] ||
25+
error "test_bisection_diff failed"
26+
27+
# Test if bisection size is close to half of list size within
28+
# tolerance.
29+
#
30+
_bisect_err=`expr $_list_size - $_bisection_size \* 2`
31+
test "$_bisect_err" -lt 0 && _bisect_err=`expr 0 - $_bisect_err`
32+
_bisect_err=`expr $_bisect_err / 2` ; # floor
33+
34+
test_expect_success \
35+
"bisection diff $_bisect_option $_head $* <= $_max_diff" \
36+
'test $_bisect_err -le $_max_diff'
4037
}
4138

4239
date >path0

0 commit comments

Comments
 (0)