@@ -467,6 +467,11 @@ include shared.mak
467
467
#
468
468
# CURL_LDFLAGS=-lcurl
469
469
#
470
+ # Define LAZYLOAD_LIBCURL to dynamically load the libcurl; This can be useful
471
+ # if Multiple libcurl versions exist (with different file names) that link to
472
+ # various SSL/TLS backends, to support the `http.sslBackend` runtime switch in
473
+ # such a scenario.
474
+ #
470
475
# === Optional library: libpcre2 ===
471
476
#
472
477
# 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/%
@@ -1616,10 +1622,23 @@ else
1616
1622
CURL_LIBCURL =
1617
1623
endif
1618
1624
1619
- ifndef CURL_LDFLAGS
1620
- CURL_LDFLAGS = $(eval CURL_LDFLAGS := $$(shell $$(CURL_CONFIG) --libs))$(CURL_LDFLAGS)
1625
+ ifdef LAZYLOAD_LIBCURL
1626
+ LAZYLOAD_LIBCURL_OBJ = compat/lazyload-curl.o
1627
+ OBJECTS += $(LAZYLOAD_LIBCURL_OBJ)
1628
+ # The `CURL_STATICLIB` constant must be defined to avoid seeing the functions
1629
+ # declared as DLL imports
1630
+ CURL_CFLAGS = -DCURL_STATICLIB
1631
+ ifneq ($(uname_S ) ,MINGW)
1632
+ ifneq ($(uname_S ) ,Windows)
1633
+ CURL_LIBCURL = -ldl
1634
+ endif
1635
+ endif
1636
+ else
1637
+ ifndef CURL_LDFLAGS
1638
+ CURL_LDFLAGS = $(eval CURL_LDFLAGS := $$(shell $$(CURL_CONFIG) --libs))$(CURL_LDFLAGS)
1639
+ endif
1640
+ CURL_LIBCURL += $(CURL_LDFLAGS)
1621
1641
endif
1622
- CURL_LIBCURL += $(CURL_LDFLAGS)
1623
1642
1624
1643
ifndef CURL_CFLAGS
1625
1644
CURL_CFLAGS = $(eval CURL_CFLAGS := $$(shell $$(CURL_CONFIG) --cflags))$(CURL_CFLAGS)
@@ -1640,7 +1659,7 @@ else
1640
1659
endif
1641
1660
ifdef USE_CURL_FOR_IMAP_SEND
1642
1661
BASIC_CFLAGS += -DUSE_CURL_FOR_IMAP_SEND
1643
- IMAP_SEND_BUILDDEPS = http.o
1662
+ IMAP_SEND_BUILDDEPS = http.o $(LAZYLOAD_LIBCURL_OBJ)
1644
1663
IMAP_SEND_LDFLAGS += $(CURL_LIBCURL)
1645
1664
endif
1646
1665
ifndef NO_EXPAT
@@ -2071,6 +2090,43 @@ ifdef USE_NED_ALLOCATOR
2071
2090
OVERRIDE_STRDUP = YesPlease
2072
2091
endif
2073
2092
2093
+ ifdef USE_MIMALLOC
2094
+ MIMALLOC_OBJS = \
2095
+ compat/mimalloc/alloc-aligned.o \
2096
+ compat/mimalloc/alloc.o \
2097
+ compat/mimalloc/arena.o \
2098
+ compat/mimalloc/bitmap.o \
2099
+ compat/mimalloc/heap.o \
2100
+ compat/mimalloc/init.o \
2101
+ compat/mimalloc/options.o \
2102
+ compat/mimalloc/os.o \
2103
+ compat/mimalloc/page.o \
2104
+ compat/mimalloc/random.o \
2105
+ compat/mimalloc/prim/windows/prim.o \
2106
+ compat/mimalloc/segment.o \
2107
+ compat/mimalloc/segment-cache.o \
2108
+ compat/mimalloc/segment-map.o \
2109
+ compat/mimalloc/stats.o
2110
+
2111
+ COMPAT_CFLAGS += -Icompat/mimalloc -DMI_DEBUG=0 -DUSE_MIMALLOC --std=gnu11
2112
+ COMPAT_OBJS += $(MIMALLOC_OBJS)
2113
+
2114
+ $(MIMALLOC_OBJS ) : COMPAT_CFLAGS += -DBANNED_H
2115
+
2116
+ $(MIMALLOC_OBJS ) : COMPAT_CFLAGS += \
2117
+ -Wno-attributes \
2118
+ -Wno-unknown-pragmas \
2119
+ -Wno-array-bounds
2120
+
2121
+ ifdef DEVELOPER
2122
+ $(MIMALLOC_OBJS ) : COMPAT_CFLAGS += \
2123
+ -Wno-pedantic \
2124
+ -Wno-declaration-after-statement \
2125
+ -Wno-old-style-definition \
2126
+ -Wno-missing-prototypes
2127
+ endif
2128
+ endif
2129
+
2074
2130
ifdef OVERRIDE_STRDUP
2075
2131
COMPAT_CFLAGS += -DOVERRIDE_STRDUP
2076
2132
COMPAT_OBJS += compat/strdup.o
@@ -2831,10 +2887,10 @@ git-imap-send$X: imap-send.o $(IMAP_SEND_BUILDDEPS) GIT-LDFLAGS $(GITLIBS)
2831
2887
$(QUIET_LINK )$(CC ) $(ALL_CFLAGS ) -o $@ $(ALL_LDFLAGS ) $(filter % .o,$^ ) \
2832
2888
$(IMAP_SEND_LDFLAGS ) $(LIBS )
2833
2889
2834
- git-http-fetch$X : http.o http-walker.o http-fetch.o GIT-LDFLAGS $(GITLIBS )
2890
+ git-http-fetch$X : http.o http-walker.o http-fetch.o $( LAZYLOAD_LIBCURL_OBJ ) GIT-LDFLAGS $(GITLIBS )
2835
2891
$(QUIET_LINK )$(CC ) $(ALL_CFLAGS ) -o $@ $(ALL_LDFLAGS ) $(filter % .o,$^ ) \
2836
2892
$(CURL_LIBCURL ) $(LIBS )
2837
- git-http-push$X : http.o http-push.o GIT-LDFLAGS $(GITLIBS )
2893
+ git-http-push$X : http.o http-push.o $( LAZYLOAD_LIBCURL_OBJ ) GIT-LDFLAGS $(GITLIBS )
2838
2894
$(QUIET_LINK )$(CC ) $(ALL_CFLAGS ) -o $@ $(ALL_LDFLAGS ) $(filter % .o,$^ ) \
2839
2895
$(CURL_LIBCURL ) $(EXPAT_LIBEXPAT ) $(LIBS )
2840
2896
@@ -2844,7 +2900,7 @@ $(REMOTE_CURL_ALIASES): $(REMOTE_CURL_PRIMARY)
2844
2900
ln -s $< $@ 2> /dev/null || \
2845
2901
cp $< $@
2846
2902
2847
- $(REMOTE_CURL_PRIMARY ) : remote-curl.o http.o http-walker.o GIT-LDFLAGS $(GITLIBS )
2903
+ $(REMOTE_CURL_PRIMARY ) : remote-curl.o http.o http-walker.o $( LAZYLOAD_LIBCURL_OBJ ) GIT-LDFLAGS $(GITLIBS )
2848
2904
$(QUIET_LINK )$(CC ) $(ALL_CFLAGS ) -o $@ $(ALL_LDFLAGS ) $(filter % .o,$^ ) \
2849
2905
$(CURL_LIBCURL ) $(EXPAT_LIBEXPAT ) $(LIBS )
2850
2906
@@ -3734,12 +3790,15 @@ ifdef MSVC
3734
3790
$(RM) $(patsubst %.o,%.o.pdb,$(OBJECTS))
3735
3791
$(RM) headless-git.o.pdb
3736
3792
$(RM) $(patsubst %.exe,%.pdb,$(OTHER_PROGRAMS))
3793
+ $(RM) $(patsubst %.exe,%.ilk,$(OTHER_PROGRAMS))
3737
3794
$(RM) $(patsubst %.exe,%.iobj,$(OTHER_PROGRAMS))
3738
3795
$(RM) $(patsubst %.exe,%.ipdb,$(OTHER_PROGRAMS))
3739
3796
$(RM) $(patsubst %.exe,%.pdb,$(PROGRAMS))
3797
+ $(RM) $(patsubst %.exe,%.ilk,$(PROGRAMS))
3740
3798
$(RM) $(patsubst %.exe,%.iobj,$(PROGRAMS))
3741
3799
$(RM) $(patsubst %.exe,%.ipdb,$(PROGRAMS))
3742
3800
$(RM) $(patsubst %.exe,%.pdb,$(TEST_PROGRAMS))
3801
+ $(RM) $(patsubst %.exe,%.ilk,$(TEST_PROGRAMS))
3743
3802
$(RM) $(patsubst %.exe,%.iobj,$(TEST_PROGRAMS))
3744
3803
$(RM) $(patsubst %.exe,%.ipdb,$(TEST_PROGRAMS))
3745
3804
$(RM) compat/vcbuild/MSVC-DEFS-GEN
0 commit comments