@@ -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
@@ -1324,6 +1329,7 @@ BUILTIN_OBJS += builtin/write-tree.o
1324
1329
# upstream unnecessarily (making merging in future changes easier).
1325
1330
THIRD_PARTY_SOURCES += compat/inet_ntop.c
1326
1331
THIRD_PARTY_SOURCES += compat/inet_pton.c
1332
+ THIRD_PARTY_SOURCES += compat/mimalloc/%
1327
1333
THIRD_PARTY_SOURCES += compat/nedmalloc/%
1328
1334
THIRD_PARTY_SOURCES += compat/obstack.%
1329
1335
THIRD_PARTY_SOURCES += compat/poll/%
@@ -1597,10 +1603,23 @@ else
1597
1603
CURL_LIBCURL =
1598
1604
endif
1599
1605
1600
- ifndef CURL_LDFLAGS
1601
- CURL_LDFLAGS = $(eval CURL_LDFLAGS := $$(shell $$(CURL_CONFIG) --libs))$(CURL_LDFLAGS)
1606
+ ifdef LAZYLOAD_LIBCURL
1607
+ LAZYLOAD_LIBCURL_OBJ = compat/lazyload-curl.o
1608
+ OBJECTS += $(LAZYLOAD_LIBCURL_OBJ)
1609
+ # The `CURL_STATICLIB` constant must be defined to avoid seeing the functions
1610
+ # declared as DLL imports
1611
+ CURL_CFLAGS = -DCURL_STATICLIB
1612
+ ifneq ($(uname_S ) ,MINGW)
1613
+ ifneq ($(uname_S ) ,Windows)
1614
+ CURL_LIBCURL = -ldl
1615
+ endif
1616
+ endif
1617
+ else
1618
+ ifndef CURL_LDFLAGS
1619
+ CURL_LDFLAGS = $(eval CURL_LDFLAGS := $$(shell $$(CURL_CONFIG) --libs))$(CURL_LDFLAGS)
1620
+ endif
1621
+ CURL_LIBCURL += $(CURL_LDFLAGS)
1602
1622
endif
1603
- CURL_LIBCURL += $(CURL_LDFLAGS)
1604
1623
1605
1624
ifndef CURL_CFLAGS
1606
1625
CURL_CFLAGS = $(eval CURL_CFLAGS := $$(shell $$(CURL_CONFIG) --cflags))$(CURL_CFLAGS)
@@ -1621,7 +1640,7 @@ else
1621
1640
endif
1622
1641
ifdef USE_CURL_FOR_IMAP_SEND
1623
1642
BASIC_CFLAGS += -DUSE_CURL_FOR_IMAP_SEND
1624
- IMAP_SEND_BUILDDEPS = http.o
1643
+ IMAP_SEND_BUILDDEPS = http.o $(LAZYLOAD_LIBCURL_OBJ)
1625
1644
IMAP_SEND_LDFLAGS += $(CURL_LIBCURL)
1626
1645
endif
1627
1646
ifndef NO_EXPAT
@@ -2052,6 +2071,41 @@ ifdef USE_NED_ALLOCATOR
2052
2071
OVERRIDE_STRDUP = YesPlease
2053
2072
endif
2054
2073
2074
+ ifdef USE_MIMALLOC
2075
+ MIMALLOC_OBJS = \
2076
+ compat/mimalloc/alloc-aligned.o \
2077
+ compat/mimalloc/alloc.o \
2078
+ compat/mimalloc/arena.o \
2079
+ compat/mimalloc/bitmap.o \
2080
+ compat/mimalloc/heap.o \
2081
+ compat/mimalloc/init.o \
2082
+ compat/mimalloc/options.o \
2083
+ compat/mimalloc/os.o \
2084
+ compat/mimalloc/page.o \
2085
+ compat/mimalloc/random.o \
2086
+ compat/mimalloc/segment.o \
2087
+ compat/mimalloc/segment-cache.o \
2088
+ compat/mimalloc/stats.o
2089
+
2090
+ COMPAT_CFLAGS += -Icompat/mimalloc -DMI_DEBUG=0 -DUSE_MIMALLOC --std=gnu11
2091
+ COMPAT_OBJS += $(MIMALLOC_OBJS)
2092
+
2093
+ $(MIMALLOC_OBJS ) : COMPAT_CFLAGS += -DBANNED_H
2094
+
2095
+ $(MIMALLOC_OBJS ) : COMPAT_CFLAGS += \
2096
+ -Wno-attributes \
2097
+ -Wno-unknown-pragmas \
2098
+ -Wno-array-bounds
2099
+
2100
+ ifdef DEVELOPER
2101
+ $(MIMALLOC_OBJS ) : COMPAT_CFLAGS += \
2102
+ -Wno-pedantic \
2103
+ -Wno-declaration-after-statement \
2104
+ -Wno-old-style-definition \
2105
+ -Wno-missing-prototypes
2106
+ endif
2107
+ endif
2108
+
2055
2109
ifdef OVERRIDE_STRDUP
2056
2110
COMPAT_CFLAGS += -DOVERRIDE_STRDUP
2057
2111
COMPAT_OBJS += compat/strdup.o
@@ -2778,17 +2832,24 @@ compat/nedmalloc/nedmalloc.sp compat/nedmalloc/nedmalloc.o: EXTRA_CPPFLAGS = \
2778
2832
compat/nedmalloc/nedmalloc.sp : SP_EXTRA_FLAGS += -Wno-non-pointer-null
2779
2833
endif
2780
2834
2835
+ headless-git.o : compat/win32/headless.c GIT-CFLAGS
2836
+ $(QUIET_CC )$(CC ) $(ALL_CFLAGS ) $(COMPAT_CFLAGS ) \
2837
+ -fno-stack-protector -o $@ -c -Wall -Wwrite-strings $<
2838
+
2839
+ headless-git$X : headless-git.o git.res GIT-LDFLAGS
2840
+ $(QUIET_LINK )$(CC ) $(ALL_CFLAGS ) $(ALL_LDFLAGS ) -mwindows -o $@ $< git.res
2841
+
2781
2842
git-% $X : % .o GIT-LDFLAGS $(GITLIBS )
2782
2843
$(QUIET_LINK )$(CC ) $(ALL_CFLAGS ) -o $@ $(ALL_LDFLAGS ) $(filter % .o,$^ ) $(LIBS )
2783
2844
2784
2845
git-imap-send$X : imap-send.o $(IMAP_SEND_BUILDDEPS ) GIT-LDFLAGS $(GITLIBS )
2785
2846
$(QUIET_LINK )$(CC ) $(ALL_CFLAGS ) -o $@ $(ALL_LDFLAGS ) $(filter % .o,$^ ) \
2786
2847
$(IMAP_SEND_LDFLAGS ) $(LIBS )
2787
2848
2788
- git-http-fetch$X : http.o http-walker.o http-fetch.o GIT-LDFLAGS $(GITLIBS )
2849
+ git-http-fetch$X : http.o http-walker.o http-fetch.o $( LAZYLOAD_LIBCURL_OBJ ) GIT-LDFLAGS $(GITLIBS )
2789
2850
$(QUIET_LINK )$(CC ) $(ALL_CFLAGS ) -o $@ $(ALL_LDFLAGS ) $(filter % .o,$^ ) \
2790
2851
$(CURL_LIBCURL ) $(LIBS )
2791
- git-http-push$X : http.o http-push.o GIT-LDFLAGS $(GITLIBS )
2852
+ git-http-push$X : http.o http-push.o $( LAZYLOAD_LIBCURL_OBJ ) GIT-LDFLAGS $(GITLIBS )
2792
2853
$(QUIET_LINK )$(CC ) $(ALL_CFLAGS ) -o $@ $(ALL_LDFLAGS ) $(filter % .o,$^ ) \
2793
2854
$(CURL_LIBCURL ) $(EXPAT_LIBEXPAT ) $(LIBS )
2794
2855
@@ -2798,7 +2859,7 @@ $(REMOTE_CURL_ALIASES): $(REMOTE_CURL_PRIMARY)
2798
2859
ln -s $< $@ 2> /dev/null || \
2799
2860
cp $< $@
2800
2861
2801
- $(REMOTE_CURL_PRIMARY ) : remote-curl.o http.o http-walker.o GIT-LDFLAGS $(GITLIBS )
2862
+ $(REMOTE_CURL_PRIMARY ) : remote-curl.o http.o http-walker.o $( LAZYLOAD_LIBCURL_OBJ ) GIT-LDFLAGS $(GITLIBS )
2802
2863
$(QUIET_LINK )$(CC ) $(ALL_CFLAGS ) -o $@ $(ALL_LDFLAGS ) $(filter % .o,$^ ) \
2803
2864
$(CURL_LIBCURL ) $(EXPAT_LIBEXPAT ) $(LIBS )
2804
2865
@@ -3651,6 +3712,7 @@ clean: profile-clean coverage-clean cocciclean
3651
3712
$(RM ) po/git.pot po/git-core.pot
3652
3713
$(RM ) git.res
3653
3714
$(RM ) $(OBJECTS )
3715
+ $(RM ) headless-git.o
3654
3716
$(RM ) $(LIB_FILE ) $(XDIFF_LIB ) $(REFTABLE_LIB ) $(REFTABLE_TEST_LIB )
3655
3717
$(RM ) $(ALL_PROGRAMS ) $(SCRIPT_LIB ) $(BUILT_INS ) $(OTHER_PROGRAMS )
3656
3718
$(RM ) $(TEST_PROGRAMS )
@@ -3679,13 +3741,17 @@ endif
3679
3741
$(RM) GIT-SCRIPT-DEFINES GIT-PERL-DEFINES GIT-PERL-HEADER GIT-PYTHON-VARS
3680
3742
ifdef MSVC
3681
3743
$(RM) $(patsubst %.o,%.o.pdb,$(OBJECTS))
3744
+ $(RM) headless-git.o.pdb
3682
3745
$(RM) $(patsubst %.exe,%.pdb,$(OTHER_PROGRAMS))
3746
+ $(RM) $(patsubst %.exe,%.ilk,$(OTHER_PROGRAMS))
3683
3747
$(RM) $(patsubst %.exe,%.iobj,$(OTHER_PROGRAMS))
3684
3748
$(RM) $(patsubst %.exe,%.ipdb,$(OTHER_PROGRAMS))
3685
3749
$(RM) $(patsubst %.exe,%.pdb,$(PROGRAMS))
3750
+ $(RM) $(patsubst %.exe,%.ilk,$(PROGRAMS))
3686
3751
$(RM) $(patsubst %.exe,%.iobj,$(PROGRAMS))
3687
3752
$(RM) $(patsubst %.exe,%.ipdb,$(PROGRAMS))
3688
3753
$(RM) $(patsubst %.exe,%.pdb,$(TEST_PROGRAMS))
3754
+ $(RM) $(patsubst %.exe,%.ilk,$(TEST_PROGRAMS))
3689
3755
$(RM) $(patsubst %.exe,%.iobj,$(TEST_PROGRAMS))
3690
3756
$(RM) $(patsubst %.exe,%.ipdb,$(TEST_PROGRAMS))
3691
3757
$(RM) compat/vcbuild/MSVC-DEFS-GEN
0 commit comments