@@ -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
@@ -2779,17 +2833,24 @@ compat/nedmalloc/nedmalloc.sp compat/nedmalloc/nedmalloc.o: EXTRA_CPPFLAGS = \
2779
2833
compat/nedmalloc/nedmalloc.sp : SP_EXTRA_FLAGS += -Wno-non-pointer-null
2780
2834
endif
2781
2835
2836
+ headless-git.o : compat/win32/headless.c GIT-CFLAGS
2837
+ $(QUIET_CC )$(CC ) $(ALL_CFLAGS ) $(COMPAT_CFLAGS ) \
2838
+ -fno-stack-protector -o $@ -c -Wall -Wwrite-strings $<
2839
+
2840
+ headless-git$X : headless-git.o git.res GIT-LDFLAGS
2841
+ $(QUIET_LINK )$(CC ) $(ALL_CFLAGS ) $(ALL_LDFLAGS ) -mwindows -o $@ $< git.res
2842
+
2782
2843
git-% $X : % .o GIT-LDFLAGS $(GITLIBS )
2783
2844
$(QUIET_LINK )$(CC ) $(ALL_CFLAGS ) -o $@ $(ALL_LDFLAGS ) $(filter % .o,$^ ) $(LIBS )
2784
2845
2785
2846
git-imap-send$X : imap-send.o $(IMAP_SEND_BUILDDEPS ) GIT-LDFLAGS $(GITLIBS )
2786
2847
$(QUIET_LINK )$(CC ) $(ALL_CFLAGS ) -o $@ $(ALL_LDFLAGS ) $(filter % .o,$^ ) \
2787
2848
$(IMAP_SEND_LDFLAGS ) $(LIBS )
2788
2849
2789
- 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 )
2790
2851
$(QUIET_LINK )$(CC ) $(ALL_CFLAGS ) -o $@ $(ALL_LDFLAGS ) $(filter % .o,$^ ) \
2791
2852
$(CURL_LIBCURL ) $(LIBS )
2792
- 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 )
2793
2854
$(QUIET_LINK )$(CC ) $(ALL_CFLAGS ) -o $@ $(ALL_LDFLAGS ) $(filter % .o,$^ ) \
2794
2855
$(CURL_LIBCURL ) $(EXPAT_LIBEXPAT ) $(LIBS )
2795
2856
@@ -2799,7 +2860,7 @@ $(REMOTE_CURL_ALIASES): $(REMOTE_CURL_PRIMARY)
2799
2860
ln -s $< $@ 2> /dev/null || \
2800
2861
cp $< $@
2801
2862
2802
- $(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 )
2803
2864
$(QUIET_LINK )$(CC ) $(ALL_CFLAGS ) -o $@ $(ALL_LDFLAGS ) $(filter % .o,$^ ) \
2804
2865
$(CURL_LIBCURL ) $(EXPAT_LIBEXPAT ) $(LIBS )
2805
2866
@@ -3652,6 +3713,7 @@ clean: profile-clean coverage-clean cocciclean
3652
3713
$(RM ) po/git.pot po/git-core.pot
3653
3714
$(RM ) git.res
3654
3715
$(RM ) $(OBJECTS )
3716
+ $(RM ) headless-git.o
3655
3717
$(RM ) $(LIB_FILE ) $(XDIFF_LIB ) $(REFTABLE_LIB ) $(REFTABLE_TEST_LIB )
3656
3718
$(RM ) $(ALL_PROGRAMS ) $(SCRIPT_LIB ) $(BUILT_INS ) $(OTHER_PROGRAMS )
3657
3719
$(RM ) $(TEST_PROGRAMS )
@@ -3680,13 +3742,17 @@ endif
3680
3742
$(RM) GIT-SCRIPT-DEFINES GIT-PERL-DEFINES GIT-PERL-HEADER GIT-PYTHON-VARS
3681
3743
ifdef MSVC
3682
3744
$(RM) $(patsubst %.o,%.o.pdb,$(OBJECTS))
3745
+ $(RM) headless-git.o.pdb
3683
3746
$(RM) $(patsubst %.exe,%.pdb,$(OTHER_PROGRAMS))
3747
+ $(RM) $(patsubst %.exe,%.ilk,$(OTHER_PROGRAMS))
3684
3748
$(RM) $(patsubst %.exe,%.iobj,$(OTHER_PROGRAMS))
3685
3749
$(RM) $(patsubst %.exe,%.ipdb,$(OTHER_PROGRAMS))
3686
3750
$(RM) $(patsubst %.exe,%.pdb,$(PROGRAMS))
3751
+ $(RM) $(patsubst %.exe,%.ilk,$(PROGRAMS))
3687
3752
$(RM) $(patsubst %.exe,%.iobj,$(PROGRAMS))
3688
3753
$(RM) $(patsubst %.exe,%.ipdb,$(PROGRAMS))
3689
3754
$(RM) $(patsubst %.exe,%.pdb,$(TEST_PROGRAMS))
3755
+ $(RM) $(patsubst %.exe,%.ilk,$(TEST_PROGRAMS))
3690
3756
$(RM) $(patsubst %.exe,%.iobj,$(TEST_PROGRAMS))
3691
3757
$(RM) $(patsubst %.exe,%.ipdb,$(TEST_PROGRAMS))
3692
3758
$(RM) compat/vcbuild/MSVC-DEFS-GEN
0 commit comments