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