Skip to content

Commit 8d676d8

Browse files
committed
Merge branch 'gv/portable'
* gv/portable: test-lib: use DIFF definition from GIT-BUILD-OPTIONS build: propagate $DIFF to scripts Makefile: Tru64 portability fix Makefile: HP-UX 10.20 portability fixes Makefile: HPUX11 portability fixes Makefile: SunOS 5.6 portability fix inline declaration does not work on AIX Allow disabling "inline" Some platforms lack socklen_t type Make NO_{INET_NTOP,INET_PTON} configured independently Makefile: some platforms do not have hstrerror anywhere git-compat-util.h: some platforms with mmap() lack MAP_FAILED definition test_cmp: do not use "diff -u" on platforms that lack one fixup: do not unconditionally disable "diff -u" tests: use "test_cmp", not "diff", when verifying the result Do not use "diff" found on PATH while building and installing enums: omit trailing comma for portability Makefile: -lpthread may still be necessary when libc has only pthread stubs Rewrite dynamic structure initializations to runtime assignment Makefile: pass CPPFLAGS through to fllow customization Conflicts: Makefile wt-status.h
2 parents 919e06b + 5e87eae commit 8d676d8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+378
-162
lines changed

Documentation/install-webdoc.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ do
1212
then
1313
: did not match
1414
elif test -f "$T/$h" &&
15-
diff -u -I'Last updated [0-9][0-9]-[A-Z][a-z][a-z]-' "$T/$h" "$h"
15+
$DIFF -u -I'Last updated [0-9][0-9]-[A-Z][a-z][a-z]-' "$T/$h" "$h"
1616
then
1717
:; # up to date
1818
else

Makefile

Lines changed: 77 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ all::
88
# Define SANE_TOOL_PATH to a colon-separated list of paths to prepend
99
# to PATH if your tools in /usr/bin are broken.
1010
#
11+
# Define SOCKLEN_T to a suitable type (such as 'size_t') if your
12+
# system headers do not define a socklen_t type.
13+
#
14+
# Define INLINE to a suitable substitute (such as '__inline' or '') if git
15+
# fails to compile with errors about undefined inline functions or similar.
16+
#
1117
# Define SNPRINTF_RETURNS_BOGUS if your are on a system which snprintf()
1218
# or vsnprintf() return -1 instead of number of characters which would
1319
# have been written to the final string if enough space had been available.
@@ -249,7 +255,7 @@ endif
249255

250256
CFLAGS = -g -O2 -Wall
251257
LDFLAGS =
252-
ALL_CFLAGS = $(CFLAGS)
258+
ALL_CFLAGS = $(CPPFLAGS) $(CFLAGS)
253259
ALL_LDFLAGS = $(LDFLAGS)
254260
STRIP ?= strip
255261

@@ -286,18 +292,20 @@ lib = lib
286292
# DESTDIR=
287293
pathsep = :
288294

289-
export prefix bindir sharedir sysconfdir
295+
export prefix bindir sharedir sysconfdir gitwebdir
290296

291297
CC = gcc
292298
AR = ar
293299
RM = rm -f
300+
DIFF = diff
294301
TAR = tar
295302
FIND = find
296303
INSTALL = install
297304
RPMBUILD = rpmbuild
298305
TCL_PATH = tclsh
299306
TCLTK_PATH = wish
300307
PTHREAD_LIBS = -lpthread
308+
PTHREAD_CFLAGS =
301309

302310
export TCL_PATH TCLTK_PATH
303311

@@ -741,6 +749,13 @@ EXTLIBS =
741749
# because maintaining the nesting to match is a pain. If
742750
# we had "elif" things would have been much nicer...
743751

752+
ifeq ($(uname_S),OSF1)
753+
# Need this for u_short definitions et al
754+
BASIC_CFLAGS += -D_OSF_SOURCE
755+
SOCKLEN_T = int
756+
NO_STRTOULL = YesPlease
757+
NO_NSEC = YesPlease
758+
endif
744759
ifeq ($(uname_S),Linux)
745760
NO_STRLCPY = YesPlease
746761
NO_MKSTEMPS = YesPlease
@@ -815,6 +830,18 @@ ifeq ($(uname_S),SunOS)
815830
NO_MKDTEMP = YesPlease
816831
NO_MKSTEMPS = YesPlease
817832
NO_REGEX = YesPlease
833+
ifeq ($(uname_R),5.6)
834+
SOCKLEN_T = int
835+
NO_HSTRERROR = YesPlease
836+
NO_IPV6 = YesPlease
837+
NO_SOCKADDR_STORAGE = YesPlease
838+
NO_UNSETENV = YesPlease
839+
NO_SETENV = YesPlease
840+
NO_STRLCPY = YesPlease
841+
NO_C99_FORMAT = YesPlease
842+
NO_STRTOUMAX = YesPlease
843+
GIT_TEST_CMP = cmp
844+
endif
818845
ifeq ($(uname_R),5.7)
819846
NEEDS_RESOLV = YesPlease
820847
NO_IPV6 = YesPlease
@@ -824,18 +851,21 @@ ifeq ($(uname_S),SunOS)
824851
NO_STRLCPY = YesPlease
825852
NO_C99_FORMAT = YesPlease
826853
NO_STRTOUMAX = YesPlease
854+
GIT_TEST_CMP = cmp
827855
endif
828856
ifeq ($(uname_R),5.8)
829857
NO_UNSETENV = YesPlease
830858
NO_SETENV = YesPlease
831859
NO_C99_FORMAT = YesPlease
832860
NO_STRTOUMAX = YesPlease
861+
GIT_TEST_CMP = cmp
833862
endif
834863
ifeq ($(uname_R),5.9)
835864
NO_UNSETENV = YesPlease
836865
NO_SETENV = YesPlease
837866
NO_C99_FORMAT = YesPlease
838867
NO_STRTOUMAX = YesPlease
868+
GIT_TEST_CMP = cmp
839869
endif
840870
INSTALL = /usr/ucb/install
841871
TAR = gtar
@@ -913,7 +943,13 @@ ifeq ($(uname_S),AIX)
913943
BASIC_CFLAGS += -D_LARGE_FILES
914944
ifeq ($(shell expr "$(uname_V)" : '[1234]'),1)
915945
NO_PTHREADS = YesPlease
946+
else
947+
PTHREAD_LIBS = -lpthread
916948
endif
949+
ifeq ($(shell expr "$(uname_V).$(uname_R)" : '5\.1'),3)
950+
INLINE=''
951+
endif
952+
GIT_TEST_CMP = cmp
917953
endif
918954
ifeq ($(uname_S),GNU)
919955
# GNU/Hurd
@@ -958,6 +994,7 @@ ifeq ($(uname_S),IRIX64)
958994
NEEDS_LIBGEN = YesPlease
959995
endif
960996
ifeq ($(uname_S),HP-UX)
997+
INLINE = __inline
961998
NO_IPV6=YesPlease
962999
NO_SETENV=YesPlease
9631000
NO_STRCASESTR=YesPlease
@@ -969,6 +1006,20 @@ ifeq ($(uname_S),HP-UX)
9691006
NO_HSTRERROR = YesPlease
9701007
NO_SYS_SELECT_H = YesPlease
9711008
SNPRINTF_RETURNS_BOGUS = YesPlease
1009+
NO_NSEC = YesPlease
1010+
ifeq ($(uname_R),B.11.00)
1011+
NO_INET_NTOP = YesPlease
1012+
NO_INET_PTON = YesPlease
1013+
endif
1014+
ifeq ($(uname_R),B.10.20)
1015+
# Override HP-UX 11.x setting:
1016+
INLINE =
1017+
SOCKLEN_T = size_t
1018+
NO_PREAD = YesPlease
1019+
NO_INET_NTOP = YesPlease
1020+
NO_INET_PTON = YesPlease
1021+
endif
1022+
GIT_TEST_CMP = cmp
9721023
endif
9731024
ifeq ($(uname_S),Windows)
9741025
GIT_VERSION := $(GIT_VERSION).MSVC
@@ -1094,6 +1145,14 @@ else
10941145
BROKEN_PATH_FIX = '/^\# @@BROKEN_PATH_FIX@@$$/d'
10951146
endif
10961147

1148+
ifneq (,$(INLINE))
1149+
BASIC_CFLAGS += -Dinline=$(INLINE)
1150+
endif
1151+
1152+
ifneq (,$(SOCKLEN_T))
1153+
BASIC_CFLAGS += -Dsocklen_t=$(SOCKLEN_T)
1154+
endif
1155+
10971156
ifeq ($(uname_S),Darwin)
10981157
ifndef NO_FINK
10991158
ifeq ($(shell test -d /sw/lib && echo y),y)
@@ -1365,6 +1424,7 @@ endif
13651424
ifdef NO_PTHREADS
13661425
BASIC_CFLAGS += -DNO_PTHREADS
13671426
else
1427+
BASIC_CFLAGS += $(PTHREAD_CFLAGS)
13681428
EXTLIBS += $(PTHREAD_LIBS)
13691429
LIB_OBJS += thread-utils.o
13701430
endif
@@ -1389,6 +1449,10 @@ ifdef USE_NED_ALLOCATOR
13891449
COMPAT_OBJS += compat/nedmalloc/nedmalloc.o
13901450
endif
13911451

1452+
ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT
1453+
export GIT_TEST_CMP_USE_COPIED_CONTEXT
1454+
endif
1455+
13921456
ifeq ($(TCLTK_PATH),)
13931457
NO_TCLTK=NoThanks
13941458
endif
@@ -1451,6 +1515,7 @@ SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
14511515
PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
14521516
PYTHON_PATH_SQ = $(subst ','\'',$(PYTHON_PATH))
14531517
TCLTK_PATH_SQ = $(subst ','\'',$(TCLTK_PATH))
1518+
DIFF_SQ = $(subst ','\'',$(DIFF))
14541519

14551520
LIBS = $(GITLIBS) $(EXTLIBS)
14561521

@@ -1477,7 +1542,7 @@ endif
14771542
ALL_CFLAGS += $(BASIC_CFLAGS)
14781543
ALL_LDFLAGS += $(BASIC_LDFLAGS)
14791544

1480-
export TAR INSTALL DESTDIR SHELL_PATH
1545+
export DIFF TAR INSTALL DESTDIR SHELL_PATH
14811546

14821547

14831548
### Build rules
@@ -1539,6 +1604,7 @@ define cmd_munge_script
15391604
$(RM) $@ $@+ && \
15401605
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
15411606
-e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
1607+
-e 's|@@DIFF@@|$(DIFF_SQ)|' \
15421608
-e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
15431609
-e 's/@@NO_CURL@@/$(NO_CURL)/g' \
15441610
-e $(BROKEN_PATH_FIX) \
@@ -1884,11 +1950,18 @@ GIT-CFLAGS: FORCE
18841950
GIT-BUILD-OPTIONS: FORCE
18851951
@echo SHELL_PATH=\''$(subst ','\'',$(SHELL_PATH_SQ))'\' >$@
18861952
@echo PERL_PATH=\''$(subst ','\'',$(PERL_PATH_SQ))'\' >>$@
1953+
@echo DIFF=\''$(subst ','\'',$(subst ','\'',$(DIFF)))'\' >>$@
18871954
@echo PYTHON_PATH=\''$(subst ','\'',$(PYTHON_PATH_SQ))'\' >>$@
18881955
@echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@
18891956
@echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@
18901957
@echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@
18911958
@echo NO_PYTHON=\''$(subst ','\'',$(subst ','\'',$(NO_PYTHON)))'\' >>$@
1959+
ifdef GIT_TEST_CMP
1960+
@echo GIT_TEST_CMP=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_CMP)))'\' >>$@
1961+
endif
1962+
ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT
1963+
@echo GIT_TEST_CMP_USE_COPIED_CONTEXT=YesPlease >>$@
1964+
endif
18921965

18931966
### Detect Tck/Tk interpreter path changes
18941967
ifndef NO_TCLTK
@@ -1983,7 +2056,7 @@ install: all
19832056
$(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install
19842057
ifndef NO_PERL
19852058
$(MAKE) -C perl prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install
1986-
$(MAKE) -C gitweb gitwebdir=$(gitwebdir_SQ) install
2059+
$(MAKE) -C gitweb install
19872060
endif
19882061
ifndef NO_PYTHON
19892062
$(MAKE) -C git_remote_helpers prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install

aclocal.m4

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
dnl Check for socklen_t: historically on BSD it is an int, and in
2+
dnl POSIX 1g it is a type of its own, but some platforms use different
3+
dnl types for the argument to getsockopt, getpeername, etc. So we
4+
dnl have to test to find something that will work.
5+
AC_DEFUN([TYPE_SOCKLEN_T],
6+
[
7+
AC_CHECK_TYPE([socklen_t], ,[
8+
AC_MSG_CHECKING([for socklen_t equivalent])
9+
AC_CACHE_VAL([git_cv_socklen_t_equiv],
10+
[
11+
# Systems have either "struct sockaddr *" or
12+
# "void *" as the second argument to getpeername
13+
git_cv_socklen_t_equiv=
14+
for arg2 in "struct sockaddr" void; do
15+
for t in int size_t unsigned long "unsigned long"; do
16+
AC_TRY_COMPILE([
17+
#include <sys/types.h>
18+
#include <sys/socket.h>
19+
20+
int getpeername (int, $arg2 *, $t *);
21+
],[
22+
$t len;
23+
getpeername(0,0,&len);
24+
],[
25+
git_cv_socklen_t_equiv="$t"
26+
break 2
27+
])
28+
done
29+
done
30+
31+
if test "x$git_cv_socklen_t_equiv" = x; then
32+
AC_MSG_ERROR([Cannot find a type to use in place of socklen_t])
33+
fi
34+
])
35+
AC_MSG_RESULT($git_cv_socklen_t_equiv)
36+
AC_DEFINE_UNQUOTED(socklen_t, $git_cv_socklen_t_equiv,
37+
[type to use in place of socklen_t if not defined])],
38+
[#include <sys/types.h>
39+
#include <sys/socket.h>])
40+
])

attr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ int git_checkattr(const char *path, int, struct git_attr_check *);
3434
enum git_attr_direction {
3535
GIT_ATTR_CHECKIN,
3636
GIT_ATTR_CHECKOUT,
37-
GIT_ATTR_INDEX,
37+
GIT_ATTR_INDEX
3838
};
3939
void git_attr_set_direction(enum git_attr_direction, struct index_state *);
4040

builtin/add.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,12 +261,14 @@ static int edit_patch(int argc, const char **argv, const char *prefix)
261261
{
262262
char *file = xstrdup(git_path("ADD_EDIT.patch"));
263263
const char *apply_argv[] = { "apply", "--recount", "--cached",
264-
file, NULL };
264+
NULL, NULL };
265265
struct child_process child;
266266
struct rev_info rev;
267267
int out;
268268
struct stat st;
269269

270+
apply_argv[3] = file;
271+
270272
git_config(git_diff_basic_config, NULL); /* no "diff" UI options */
271273

272274
if (read_cache() < 0)

builtin/apply.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,15 @@ static enum ws_error_action {
5656
nowarn_ws_error,
5757
warn_on_ws_error,
5858
die_on_ws_error,
59-
correct_ws_error,
59+
correct_ws_error
6060
} ws_error_action = warn_on_ws_error;
6161
static int whitespace_error;
6262
static int squelch_whitespace_errors = 5;
6363
static int applied_after_fixing_ws;
6464

6565
static enum ws_ignore {
6666
ignore_ws_none,
67-
ignore_ws_change,
67+
ignore_ws_change
6868
} ws_ignore_action = ignore_ws_none;
6969

7070

builtin/blame.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -733,10 +733,11 @@ static int pass_blame_to_parent(struct scoreboard *sb,
733733
{
734734
int last_in_target;
735735
mmfile_t file_p, file_o;
736-
struct blame_chunk_cb_data d = { sb, target, parent, 0, 0 };
736+
struct blame_chunk_cb_data d;
737737
xpparam_t xpp;
738738
xdemitconf_t xecfg;
739-
739+
memset(&d, 0, sizeof(d));
740+
d.sb = sb; d.target = target; d.parent = parent;
740741
last_in_target = find_last_in_target(sb, target);
741742
if (last_in_target < 0)
742743
return 1; /* nothing remains for this target */
@@ -875,10 +876,11 @@ static void find_copy_in_blob(struct scoreboard *sb,
875876
const char *cp;
876877
int cnt;
877878
mmfile_t file_o;
878-
struct handle_split_cb_data d = { sb, ent, parent, split, 0, 0 };
879+
struct handle_split_cb_data d;
879880
xpparam_t xpp;
880881
xdemitconf_t xecfg;
881-
882+
memset(&d, 0, sizeof(d));
883+
d.sb = sb; d.ent = ent; d.parent = parent; d.split = split;
882884
/*
883885
* Prepare mmfile that contains only the lines in ent.
884886
*/

builtin/branch.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ enum color_branch {
4343
BRANCH_COLOR_PLAIN = 1,
4444
BRANCH_COLOR_REMOTE = 2,
4545
BRANCH_COLOR_LOCAL = 3,
46-
BRANCH_COLOR_CURRENT = 4,
46+
BRANCH_COLOR_CURRENT = 4
4747
};
4848

4949
static enum merge_filter {
5050
NO_FILTER = 0,
5151
SHOW_NOT_MERGED,
52-
SHOW_MERGED,
52+
SHOW_MERGED
5353
} merge_filter;
5454
static unsigned char merge_filter_ref[20];
5555

builtin/cat-file.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,9 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name)
118118

119119
/* custom pretty-print here */
120120
if (type == OBJ_TREE) {
121-
const char *ls_args[3] = {"ls-tree", obj_name, NULL};
121+
const char *ls_args[3] = { NULL };
122+
ls_args[0] = "ls-tree";
123+
ls_args[1] = obj_name;
122124
return cmd_ls_tree(2, ls_args, NULL);
123125
}
124126

builtin/checkout.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,8 @@ static int check_tracking_name(const char *refname, const unsigned char *sha1,
636636

637637
static const char *unique_tracking_name(const char *name)
638638
{
639-
struct tracking_name_data cb_data = { name, NULL, 1 };
639+
struct tracking_name_data cb_data = { NULL, NULL, 1 };
640+
cb_data.name = name;
640641
for_each_ref(check_tracking_name, &cb_data);
641642
if (cb_data.unique)
642643
return cb_data.remote;

0 commit comments

Comments
 (0)