@@ -464,6 +464,11 @@ include shared.mak
464
464
#
465
465
# CURL_LDFLAGS=-lcurl
466
466
#
467
+ # Define LAZYLOAD_LIBCURL to dynamically load the libcurl; This can be useful
468
+ # if Multiple libcurl versions exist (with different file names) that link to
469
+ # various SSL/TLS backends, to support the `http.sslBackend` runtime switch in
470
+ # such a scenario.
471
+ #
467
472
# === Optional library: libpcre2 ===
468
473
#
469
474
# Define USE_LIBPCRE if you have and want to use libpcre. Various
@@ -1340,6 +1345,7 @@ BUILTIN_OBJS += builtin/write-tree.o
1340
1345
# upstream unnecessarily (making merging in future changes easier).
1341
1346
THIRD_PARTY_SOURCES += compat/inet_ntop.c
1342
1347
THIRD_PARTY_SOURCES += compat/inet_pton.c
1348
+ THIRD_PARTY_SOURCES += compat/mimalloc/%
1343
1349
THIRD_PARTY_SOURCES += compat/nedmalloc/%
1344
1350
THIRD_PARTY_SOURCES += compat/obstack.%
1345
1351
THIRD_PARTY_SOURCES += compat/poll/%
@@ -1622,10 +1628,23 @@ else
1622
1628
CURL_LIBCURL =
1623
1629
endif
1624
1630
1625
- ifndef CURL_LDFLAGS
1626
- CURL_LDFLAGS = $(eval CURL_LDFLAGS := $$(shell $$(CURL_CONFIG) --libs))$(CURL_LDFLAGS)
1631
+ ifdef LAZYLOAD_LIBCURL
1632
+ LAZYLOAD_LIBCURL_OBJ = compat/lazyload-curl.o
1633
+ OBJECTS += $(LAZYLOAD_LIBCURL_OBJ)
1634
+ # The `CURL_STATICLIB` constant must be defined to avoid seeing the functions
1635
+ # declared as DLL imports
1636
+ CURL_CFLAGS = -DCURL_STATICLIB
1637
+ ifneq ($(uname_S ) ,MINGW)
1638
+ ifneq ($(uname_S ) ,Windows)
1639
+ CURL_LIBCURL = -ldl
1640
+ endif
1641
+ endif
1642
+ else
1643
+ ifndef CURL_LDFLAGS
1644
+ CURL_LDFLAGS = $(eval CURL_LDFLAGS := $$(shell $$(CURL_CONFIG) --libs))$(CURL_LDFLAGS)
1645
+ endif
1646
+ CURL_LIBCURL += $(CURL_LDFLAGS)
1627
1647
endif
1628
- CURL_LIBCURL += $(CURL_LDFLAGS)
1629
1648
1630
1649
ifndef CURL_CFLAGS
1631
1650
CURL_CFLAGS = $(eval CURL_CFLAGS := $$(shell $$(CURL_CONFIG) --cflags))$(CURL_CFLAGS)
@@ -1646,7 +1665,7 @@ else
1646
1665
endif
1647
1666
ifdef USE_CURL_FOR_IMAP_SEND
1648
1667
BASIC_CFLAGS += -DUSE_CURL_FOR_IMAP_SEND
1649
- IMAP_SEND_BUILDDEPS = http.o
1668
+ IMAP_SEND_BUILDDEPS = http.o $(LAZYLOAD_LIBCURL_OBJ)
1650
1669
IMAP_SEND_LDFLAGS += $(CURL_LIBCURL)
1651
1670
endif
1652
1671
ifndef NO_EXPAT
@@ -2077,6 +2096,43 @@ ifdef USE_NED_ALLOCATOR
2077
2096
OVERRIDE_STRDUP = YesPlease
2078
2097
endif
2079
2098
2099
+ ifdef USE_MIMALLOC
2100
+ MIMALLOC_OBJS = \
2101
+ compat/mimalloc/alloc-aligned.o \
2102
+ compat/mimalloc/alloc.o \
2103
+ compat/mimalloc/arena.o \
2104
+ compat/mimalloc/bitmap.o \
2105
+ compat/mimalloc/heap.o \
2106
+ compat/mimalloc/init.o \
2107
+ compat/mimalloc/options.o \
2108
+ compat/mimalloc/os.o \
2109
+ compat/mimalloc/page.o \
2110
+ compat/mimalloc/random.o \
2111
+ compat/mimalloc/prim/windows/prim.o \
2112
+ compat/mimalloc/segment.o \
2113
+ compat/mimalloc/segment-cache.o \
2114
+ compat/mimalloc/segment-map.o \
2115
+ compat/mimalloc/stats.o
2116
+
2117
+ COMPAT_CFLAGS += -Icompat/mimalloc -DMI_DEBUG=0 -DUSE_MIMALLOC --std=gnu11
2118
+ COMPAT_OBJS += $(MIMALLOC_OBJS)
2119
+
2120
+ $(MIMALLOC_OBJS ) : COMPAT_CFLAGS += -DBANNED_H
2121
+
2122
+ $(MIMALLOC_OBJS ) : COMPAT_CFLAGS += \
2123
+ -Wno-attributes \
2124
+ -Wno-unknown-pragmas \
2125
+ -Wno-array-bounds
2126
+
2127
+ ifdef DEVELOPER
2128
+ $(MIMALLOC_OBJS ) : COMPAT_CFLAGS += \
2129
+ -Wno-pedantic \
2130
+ -Wno-declaration-after-statement \
2131
+ -Wno-old-style-definition \
2132
+ -Wno-missing-prototypes
2133
+ endif
2134
+ endif
2135
+
2080
2136
ifdef OVERRIDE_STRDUP
2081
2137
COMPAT_CFLAGS += -DOVERRIDE_STRDUP
2082
2138
COMPAT_OBJS += compat/strdup.o
@@ -2818,10 +2874,10 @@ git-imap-send$X: imap-send.o $(IMAP_SEND_BUILDDEPS) GIT-LDFLAGS $(GITLIBS)
2818
2874
$(QUIET_LINK )$(CC ) $(ALL_CFLAGS ) -o $@ $(ALL_LDFLAGS ) $(filter % .o,$^ ) \
2819
2875
$(IMAP_SEND_LDFLAGS ) $(LIBS )
2820
2876
2821
- git-http-fetch$X : http.o http-walker.o http-fetch.o GIT-LDFLAGS $(GITLIBS )
2877
+ git-http-fetch$X : http.o http-walker.o http-fetch.o $( LAZYLOAD_LIBCURL_OBJ ) GIT-LDFLAGS $(GITLIBS )
2822
2878
$(QUIET_LINK )$(CC ) $(ALL_CFLAGS ) -o $@ $(ALL_LDFLAGS ) $(filter % .o,$^ ) \
2823
2879
$(CURL_LIBCURL ) $(LIBS )
2824
- git-http-push$X : http.o http-push.o GIT-LDFLAGS $(GITLIBS )
2880
+ git-http-push$X : http.o http-push.o $( LAZYLOAD_LIBCURL_OBJ ) GIT-LDFLAGS $(GITLIBS )
2825
2881
$(QUIET_LINK )$(CC ) $(ALL_CFLAGS ) -o $@ $(ALL_LDFLAGS ) $(filter % .o,$^ ) \
2826
2882
$(CURL_LIBCURL ) $(EXPAT_LIBEXPAT ) $(LIBS )
2827
2883
@@ -2831,7 +2887,7 @@ $(REMOTE_CURL_ALIASES): $(REMOTE_CURL_PRIMARY)
2831
2887
ln -s $< $@ 2> /dev/null || \
2832
2888
cp $< $@
2833
2889
2834
- $(REMOTE_CURL_PRIMARY ) : remote-curl.o http.o http-walker.o GIT-LDFLAGS $(GITLIBS )
2890
+ $(REMOTE_CURL_PRIMARY ) : remote-curl.o http.o http-walker.o $( LAZYLOAD_LIBCURL_OBJ ) GIT-LDFLAGS $(GITLIBS )
2835
2891
$(QUIET_LINK )$(CC ) $(ALL_CFLAGS ) -o $@ $(ALL_LDFLAGS ) $(filter % .o,$^ ) \
2836
2892
$(CURL_LIBCURL ) $(EXPAT_LIBEXPAT ) $(LIBS )
2837
2893
@@ -3721,12 +3777,15 @@ ifdef MSVC
3721
3777
$(RM) $(patsubst %.o,%.o.pdb,$(OBJECTS))
3722
3778
$(RM) headless-git.o.pdb
3723
3779
$(RM) $(patsubst %.exe,%.pdb,$(OTHER_PROGRAMS))
3780
+ $(RM) $(patsubst %.exe,%.ilk,$(OTHER_PROGRAMS))
3724
3781
$(RM) $(patsubst %.exe,%.iobj,$(OTHER_PROGRAMS))
3725
3782
$(RM) $(patsubst %.exe,%.ipdb,$(OTHER_PROGRAMS))
3726
3783
$(RM) $(patsubst %.exe,%.pdb,$(PROGRAMS))
3784
+ $(RM) $(patsubst %.exe,%.ilk,$(PROGRAMS))
3727
3785
$(RM) $(patsubst %.exe,%.iobj,$(PROGRAMS))
3728
3786
$(RM) $(patsubst %.exe,%.ipdb,$(PROGRAMS))
3729
3787
$(RM) $(patsubst %.exe,%.pdb,$(TEST_PROGRAMS))
3788
+ $(RM) $(patsubst %.exe,%.ilk,$(TEST_PROGRAMS))
3730
3789
$(RM) $(patsubst %.exe,%.iobj,$(TEST_PROGRAMS))
3731
3790
$(RM) $(patsubst %.exe,%.ipdb,$(TEST_PROGRAMS))
3732
3791
$(RM) compat/vcbuild/MSVC-DEFS-GEN
0 commit comments