@@ -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
@@ -1334,6 +1339,7 @@ BUILTIN_OBJS += builtin/write-tree.o
1334
1339
# upstream unnecessarily (making merging in future changes easier).
1335
1340
THIRD_PARTY_SOURCES += compat/inet_ntop.c
1336
1341
THIRD_PARTY_SOURCES += compat/inet_pton.c
1342
+ THIRD_PARTY_SOURCES += compat/mimalloc/%
1337
1343
THIRD_PARTY_SOURCES += compat/nedmalloc/%
1338
1344
THIRD_PARTY_SOURCES += compat/obstack.%
1339
1345
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
@@ -2812,10 +2868,10 @@ git-imap-send$X: imap-send.o $(IMAP_SEND_BUILDDEPS) GIT-LDFLAGS $(GITLIBS)
2812
2868
$(QUIET_LINK )$(CC ) $(ALL_CFLAGS ) -o $@ $(ALL_LDFLAGS ) $(filter % .o,$^ ) \
2813
2869
$(IMAP_SEND_LDFLAGS ) $(LIBS )
2814
2870
2815
- git-http-fetch$X : http.o http-walker.o http-fetch.o GIT-LDFLAGS $(GITLIBS )
2871
+ git-http-fetch$X : http.o http-walker.o http-fetch.o $( LAZYLOAD_LIBCURL_OBJ ) GIT-LDFLAGS $(GITLIBS )
2816
2872
$(QUIET_LINK )$(CC ) $(ALL_CFLAGS ) -o $@ $(ALL_LDFLAGS ) $(filter % .o,$^ ) \
2817
2873
$(CURL_LIBCURL ) $(LIBS )
2818
- git-http-push$X : http.o http-push.o GIT-LDFLAGS $(GITLIBS )
2874
+ git-http-push$X : http.o http-push.o $( LAZYLOAD_LIBCURL_OBJ ) GIT-LDFLAGS $(GITLIBS )
2819
2875
$(QUIET_LINK )$(CC ) $(ALL_CFLAGS ) -o $@ $(ALL_LDFLAGS ) $(filter % .o,$^ ) \
2820
2876
$(CURL_LIBCURL ) $(EXPAT_LIBEXPAT ) $(LIBS )
2821
2877
@@ -2825,7 +2881,7 @@ $(REMOTE_CURL_ALIASES): $(REMOTE_CURL_PRIMARY)
2825
2881
ln -s $< $@ 2> /dev/null || \
2826
2882
cp $< $@
2827
2883
2828
- $(REMOTE_CURL_PRIMARY ) : remote-curl.o http.o http-walker.o GIT-LDFLAGS $(GITLIBS )
2884
+ $(REMOTE_CURL_PRIMARY ) : remote-curl.o http.o http-walker.o $( LAZYLOAD_LIBCURL_OBJ ) GIT-LDFLAGS $(GITLIBS )
2829
2885
$(QUIET_LINK )$(CC ) $(ALL_CFLAGS ) -o $@ $(ALL_LDFLAGS ) $(filter % .o,$^ ) \
2830
2886
$(CURL_LIBCURL ) $(EXPAT_LIBEXPAT ) $(LIBS )
2831
2887
@@ -3715,12 +3771,15 @@ ifdef MSVC
3715
3771
$(RM) $(patsubst %.o,%.o.pdb,$(OBJECTS))
3716
3772
$(RM) headless-git.o.pdb
3717
3773
$(RM) $(patsubst %.exe,%.pdb,$(OTHER_PROGRAMS))
3774
+ $(RM) $(patsubst %.exe,%.ilk,$(OTHER_PROGRAMS))
3718
3775
$(RM) $(patsubst %.exe,%.iobj,$(OTHER_PROGRAMS))
3719
3776
$(RM) $(patsubst %.exe,%.ipdb,$(OTHER_PROGRAMS))
3720
3777
$(RM) $(patsubst %.exe,%.pdb,$(PROGRAMS))
3778
+ $(RM) $(patsubst %.exe,%.ilk,$(PROGRAMS))
3721
3779
$(RM) $(patsubst %.exe,%.iobj,$(PROGRAMS))
3722
3780
$(RM) $(patsubst %.exe,%.ipdb,$(PROGRAMS))
3723
3781
$(RM) $(patsubst %.exe,%.pdb,$(TEST_PROGRAMS))
3782
+ $(RM) $(patsubst %.exe,%.ilk,$(TEST_PROGRAMS))
3724
3783
$(RM) $(patsubst %.exe,%.iobj,$(TEST_PROGRAMS))
3725
3784
$(RM) $(patsubst %.exe,%.ipdb,$(TEST_PROGRAMS))
3726
3785
$(RM) compat/vcbuild/MSVC-DEFS-GEN
0 commit comments