@@ -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
@@ -1325,6 +1330,7 @@ BUILTIN_OBJS += builtin/write-tree.o
1325
1330
# upstream unnecessarily (making merging in future changes easier).
1326
1331
THIRD_PARTY_SOURCES += compat/inet_ntop.c
1327
1332
THIRD_PARTY_SOURCES += compat/inet_pton.c
1333
+ THIRD_PARTY_SOURCES += compat/mimalloc/%
1328
1334
THIRD_PARTY_SOURCES += compat/nedmalloc/%
1329
1335
THIRD_PARTY_SOURCES += compat/obstack.%
1330
1336
THIRD_PARTY_SOURCES += compat/poll/%
@@ -1598,10 +1604,23 @@ else
1598
1604
CURL_LIBCURL =
1599
1605
endif
1600
1606
1601
- ifndef CURL_LDFLAGS
1602
- CURL_LDFLAGS = $(eval CURL_LDFLAGS := $$(shell $$(CURL_CONFIG) --libs))$(CURL_LDFLAGS)
1607
+ ifdef LAZYLOAD_LIBCURL
1608
+ LAZYLOAD_LIBCURL_OBJ = compat/lazyload-curl.o
1609
+ OBJECTS += $(LAZYLOAD_LIBCURL_OBJ)
1610
+ # The `CURL_STATICLIB` constant must be defined to avoid seeing the functions
1611
+ # declared as DLL imports
1612
+ CURL_CFLAGS = -DCURL_STATICLIB
1613
+ ifneq ($(uname_S ) ,MINGW)
1614
+ ifneq ($(uname_S ) ,Windows)
1615
+ CURL_LIBCURL = -ldl
1616
+ endif
1617
+ endif
1618
+ else
1619
+ ifndef CURL_LDFLAGS
1620
+ CURL_LDFLAGS = $(eval CURL_LDFLAGS := $$(shell $$(CURL_CONFIG) --libs))$(CURL_LDFLAGS)
1621
+ endif
1622
+ CURL_LIBCURL += $(CURL_LDFLAGS)
1603
1623
endif
1604
- CURL_LIBCURL += $(CURL_LDFLAGS)
1605
1624
1606
1625
ifndef CURL_CFLAGS
1607
1626
CURL_CFLAGS = $(eval CURL_CFLAGS := $$(shell $$(CURL_CONFIG) --cflags))$(CURL_CFLAGS)
@@ -1622,7 +1641,7 @@ else
1622
1641
endif
1623
1642
ifdef USE_CURL_FOR_IMAP_SEND
1624
1643
BASIC_CFLAGS += -DUSE_CURL_FOR_IMAP_SEND
1625
- IMAP_SEND_BUILDDEPS = http.o
1644
+ IMAP_SEND_BUILDDEPS = http.o $(LAZYLOAD_LIBCURL_OBJ)
1626
1645
IMAP_SEND_LDFLAGS += $(CURL_LIBCURL)
1627
1646
endif
1628
1647
ifndef NO_EXPAT
@@ -2053,6 +2072,41 @@ ifdef USE_NED_ALLOCATOR
2053
2072
OVERRIDE_STRDUP = YesPlease
2054
2073
endif
2055
2074
2075
+ ifdef USE_MIMALLOC
2076
+ MIMALLOC_OBJS = \
2077
+ compat/mimalloc/alloc-aligned.o \
2078
+ compat/mimalloc/alloc.o \
2079
+ compat/mimalloc/arena.o \
2080
+ compat/mimalloc/bitmap.o \
2081
+ compat/mimalloc/heap.o \
2082
+ compat/mimalloc/init.o \
2083
+ compat/mimalloc/options.o \
2084
+ compat/mimalloc/os.o \
2085
+ compat/mimalloc/page.o \
2086
+ compat/mimalloc/random.o \
2087
+ compat/mimalloc/segment.o \
2088
+ compat/mimalloc/segment-cache.o \
2089
+ compat/mimalloc/stats.o
2090
+
2091
+ COMPAT_CFLAGS += -Icompat/mimalloc -DMI_DEBUG=0 -DUSE_MIMALLOC --std=gnu11
2092
+ COMPAT_OBJS += $(MIMALLOC_OBJS)
2093
+
2094
+ $(MIMALLOC_OBJS ) : COMPAT_CFLAGS += -DBANNED_H
2095
+
2096
+ $(MIMALLOC_OBJS ) : COMPAT_CFLAGS += \
2097
+ -Wno-attributes \
2098
+ -Wno-unknown-pragmas \
2099
+ -Wno-array-bounds
2100
+
2101
+ ifdef DEVELOPER
2102
+ $(MIMALLOC_OBJS ) : COMPAT_CFLAGS += \
2103
+ -Wno-pedantic \
2104
+ -Wno-declaration-after-statement \
2105
+ -Wno-old-style-definition \
2106
+ -Wno-missing-prototypes
2107
+ endif
2108
+ endif
2109
+
2056
2110
ifdef OVERRIDE_STRDUP
2057
2111
COMPAT_CFLAGS += -DOVERRIDE_STRDUP
2058
2112
COMPAT_OBJS += compat/strdup.o
@@ -2793,10 +2847,10 @@ git-imap-send$X: imap-send.o $(IMAP_SEND_BUILDDEPS) GIT-LDFLAGS $(GITLIBS)
2793
2847
$(QUIET_LINK )$(CC ) $(ALL_CFLAGS ) -o $@ $(ALL_LDFLAGS ) $(filter % .o,$^ ) \
2794
2848
$(IMAP_SEND_LDFLAGS ) $(LIBS )
2795
2849
2796
- git-http-fetch$X : http.o http-walker.o http-fetch.o GIT-LDFLAGS $(GITLIBS )
2850
+ git-http-fetch$X : http.o http-walker.o http-fetch.o $( LAZYLOAD_LIBCURL_OBJ ) GIT-LDFLAGS $(GITLIBS )
2797
2851
$(QUIET_LINK )$(CC ) $(ALL_CFLAGS ) -o $@ $(ALL_LDFLAGS ) $(filter % .o,$^ ) \
2798
2852
$(CURL_LIBCURL ) $(LIBS )
2799
- git-http-push$X : http.o http-push.o GIT-LDFLAGS $(GITLIBS )
2853
+ git-http-push$X : http.o http-push.o $( LAZYLOAD_LIBCURL_OBJ ) GIT-LDFLAGS $(GITLIBS )
2800
2854
$(QUIET_LINK )$(CC ) $(ALL_CFLAGS ) -o $@ $(ALL_LDFLAGS ) $(filter % .o,$^ ) \
2801
2855
$(CURL_LIBCURL ) $(EXPAT_LIBEXPAT ) $(LIBS )
2802
2856
@@ -2806,7 +2860,7 @@ $(REMOTE_CURL_ALIASES): $(REMOTE_CURL_PRIMARY)
2806
2860
ln -s $< $@ 2> /dev/null || \
2807
2861
cp $< $@
2808
2862
2809
- $(REMOTE_CURL_PRIMARY ) : remote-curl.o http.o http-walker.o GIT-LDFLAGS $(GITLIBS )
2863
+ $(REMOTE_CURL_PRIMARY ) : remote-curl.o http.o http-walker.o $( LAZYLOAD_LIBCURL_OBJ ) GIT-LDFLAGS $(GITLIBS )
2810
2864
$(QUIET_LINK )$(CC ) $(ALL_CFLAGS ) -o $@ $(ALL_LDFLAGS ) $(filter % .o,$^ ) \
2811
2865
$(CURL_LIBCURL ) $(EXPAT_LIBEXPAT ) $(LIBS )
2812
2866
@@ -3696,12 +3750,15 @@ ifdef MSVC
3696
3750
$(RM) $(patsubst %.o,%.o.pdb,$(OBJECTS))
3697
3751
$(RM) headless-git.o.pdb
3698
3752
$(RM) $(patsubst %.exe,%.pdb,$(OTHER_PROGRAMS))
3753
+ $(RM) $(patsubst %.exe,%.ilk,$(OTHER_PROGRAMS))
3699
3754
$(RM) $(patsubst %.exe,%.iobj,$(OTHER_PROGRAMS))
3700
3755
$(RM) $(patsubst %.exe,%.ipdb,$(OTHER_PROGRAMS))
3701
3756
$(RM) $(patsubst %.exe,%.pdb,$(PROGRAMS))
3757
+ $(RM) $(patsubst %.exe,%.ilk,$(PROGRAMS))
3702
3758
$(RM) $(patsubst %.exe,%.iobj,$(PROGRAMS))
3703
3759
$(RM) $(patsubst %.exe,%.ipdb,$(PROGRAMS))
3704
3760
$(RM) $(patsubst %.exe,%.pdb,$(TEST_PROGRAMS))
3761
+ $(RM) $(patsubst %.exe,%.ilk,$(TEST_PROGRAMS))
3705
3762
$(RM) $(patsubst %.exe,%.iobj,$(TEST_PROGRAMS))
3706
3763
$(RM) $(patsubst %.exe,%.ipdb,$(TEST_PROGRAMS))
3707
3764
$(RM) compat/vcbuild/MSVC-DEFS-GEN
0 commit comments