Skip to content

Commit 6320358

Browse files
j6tgitster
authored andcommitted
Makefile: unix sockets may not available on some platforms
Introduce a configuration option NO_UNIX_SOCKETS to exclude code that depends on Unix sockets and use it in MSVC and MinGW builds. Notice that unix-socket.h was missing from LIB_H before; fix that, too. Signed-off-by: Johannes Sixt <[email protected]> Helped-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e277097 commit 6320358

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

Makefile

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,8 @@ all::
143143
#
144144
# Define NO_IPV6 if you lack IPv6 support and getaddrinfo().
145145
#
146+
# Define NO_UNIX_SOCKETS if your system does not offer unix sockets.
147+
#
146148
# Define NO_SOCKADDR_STORAGE if your platform does not have struct
147149
# sockaddr_storage.
148150
#
@@ -427,8 +429,6 @@ PROGRAM_OBJS += show-index.o
427429
PROGRAM_OBJS += upload-pack.o
428430
PROGRAM_OBJS += http-backend.o
429431
PROGRAM_OBJS += sh-i18n--envsubst.o
430-
PROGRAM_OBJS += credential-cache.o
431-
PROGRAM_OBJS += credential-cache--daemon.o
432432

433433
PROGRAMS += $(patsubst %.o,git-%$X,$(PROGRAM_OBJS))
434434

@@ -701,7 +701,6 @@ LIB_OBJS += transport-helper.o
701701
LIB_OBJS += tree-diff.o
702702
LIB_OBJS += tree.o
703703
LIB_OBJS += tree-walk.o
704-
LIB_OBJS += unix-socket.o
705704
LIB_OBJS += unpack-trees.o
706705
LIB_OBJS += url.o
707706
LIB_OBJS += usage.o
@@ -1104,6 +1103,7 @@ ifeq ($(uname_S),Windows)
11041103
NO_SYS_POLL_H = YesPlease
11051104
NO_SYMLINK_HEAD = YesPlease
11061105
NO_IPV6 = YesPlease
1106+
NO_UNIX_SOCKETS = YesPlease
11071107
NO_SETENV = YesPlease
11081108
NO_UNSETENV = YesPlease
11091109
NO_STRCASESTR = YesPlease
@@ -1197,6 +1197,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))
11971197
NO_LIBGEN_H = YesPlease
11981198
NO_SYS_POLL_H = YesPlease
11991199
NO_SYMLINK_HEAD = YesPlease
1200+
NO_UNIX_SOCKETS = YesPlease
12001201
NO_SETENV = YesPlease
12011202
NO_UNSETENV = YesPlease
12021203
NO_STRCASESTR = YesPlease
@@ -1574,6 +1575,12 @@ ifdef NO_INET_PTON
15741575
LIB_OBJS += compat/inet_pton.o
15751576
BASIC_CFLAGS += -DNO_INET_PTON
15761577
endif
1578+
ifndef NO_UNIX_SOCKETS
1579+
LIB_OBJS += unix-socket.o
1580+
LIB_H += unix-socket.h
1581+
PROGRAM_OBJS += credential-cache.o
1582+
PROGRAM_OBJS += credential-cache--daemon.o
1583+
endif
15771584

15781585
ifdef NO_ICONV
15791586
BASIC_CFLAGS += -DNO_ICONV
@@ -2209,6 +2216,7 @@ ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT
22092216
@echo GIT_TEST_CMP_USE_COPIED_CONTEXT=YesPlease >>$@
22102217
endif
22112218
@echo GETTEXT_POISON=\''$(subst ','\'',$(subst ','\'',$(GETTEXT_POISON)))'\' >>$@
2219+
@echo NO_UNIX_SOCKETS=\''$(subst ','\'',$(subst ','\'',$(NO_UNIX_SOCKETS)))'\' >>$@
22122220

22132221
### Detect Tck/Tk interpreter path changes
22142222
ifndef NO_TCLTK

t/t0301-credential-cache.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ test_description='credential-cache tests'
44
. ./test-lib.sh
55
. "$TEST_DIRECTORY"/lib-credential.sh
66

7+
test -z "$NO_UNIX_SOCKETS" || {
8+
skip_all='skipping credential-cache tests, unix sockets not available'
9+
test_done
10+
}
11+
712
# don't leave a stale daemon running
813
trap 'code=$?; git credential-cache exit; (exit $code); die' EXIT
914

0 commit comments

Comments
 (0)