Skip to content

Commit cf2ed25

Browse files
committed
Merge pull request #2974 from derrickstolee/maintenance-and-headless
Include Windows-specific maintenance and headless-git
2 parents 8168926 + f18bc14 commit cf2ed25

File tree

5 files changed

+77
-2
lines changed

5 files changed

+77
-2
lines changed

Makefile

+3
Original file line numberDiff line numberDiff line change
@@ -3836,12 +3836,15 @@ ifdef MSVC
38363836
$(RM) $(patsubst %.o,%.o.pdb,$(OBJECTS))
38373837
$(RM) headless-git.o.pdb
38383838
$(RM) $(patsubst %.exe,%.pdb,$(OTHER_PROGRAMS))
3839+
$(RM) $(patsubst %.exe,%.ilk,$(OTHER_PROGRAMS))
38393840
$(RM) $(patsubst %.exe,%.iobj,$(OTHER_PROGRAMS))
38403841
$(RM) $(patsubst %.exe,%.ipdb,$(OTHER_PROGRAMS))
38413842
$(RM) $(patsubst %.exe,%.pdb,$(PROGRAMS))
3843+
$(RM) $(patsubst %.exe,%.ilk,$(PROGRAMS))
38423844
$(RM) $(patsubst %.exe,%.iobj,$(PROGRAMS))
38433845
$(RM) $(patsubst %.exe,%.ipdb,$(PROGRAMS))
38443846
$(RM) $(patsubst %.exe,%.pdb,$(TEST_PROGRAMS))
3847+
$(RM) $(patsubst %.exe,%.ilk,$(TEST_PROGRAMS))
38453848
$(RM) $(patsubst %.exe,%.iobj,$(TEST_PROGRAMS))
38463849
$(RM) $(patsubst %.exe,%.ipdb,$(TEST_PROGRAMS))
38473850
$(RM) compat/vcbuild/MSVC-DEFS-GEN

compat/vcbuild/find_vs_env.bat

+7
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ REM ================================================================
9999

100100
SET sdk_dir=%WindowsSdkDir%
101101
SET sdk_ver=%WindowsSDKVersion%
102+
SET sdk_ver_bin_dir=%WindowsSdkVerBinPath%%tgt%
102103
SET si=%sdk_dir%Include\%sdk_ver%
103104
SET sdk_includes=-I"%si%ucrt" -I"%si%um" -I"%si%shared"
104105
SET sl=%sdk_dir%lib\%sdk_ver%
@@ -130,6 +131,7 @@ REM ================================================================
130131

131132
SET sdk_dir=%WindowsSdkDir%
132133
SET sdk_ver=%WindowsSDKVersion%
134+
SET sdk_ver_bin_dir=%WindowsSdkVerBinPath%bin\amd64
133135
SET si=%sdk_dir%Include\%sdk_ver%
134136
SET sdk_includes=-I"%si%ucrt" -I"%si%um" -I"%si%shared" -I"%si%winrt"
135137
SET sl=%sdk_dir%lib\%sdk_ver%
@@ -160,6 +162,11 @@ REM ================================================================
160162
echo msvc_includes=%msvc_includes%
161163
echo msvc_libs=%msvc_libs%
162164

165+
echo sdk_ver_bin_dir=%sdk_ver_bin_dir%
166+
SET X1=%sdk_ver_bin_dir:C:=/C%
167+
SET X2=%X1:\=/%
168+
echo sdk_ver_bin_dir_msys=%X2%
169+
163170
echo sdk_includes=%sdk_includes%
164171
echo sdk_libs=%sdk_libs%
165172

compat/vcbuild/scripts/clink.pl

+17
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
my @lflags = ();
1616
my $is_linking = 0;
1717
my $is_debug = 0;
18+
my $is_gui = 0;
1819
while (@ARGV) {
1920
my $arg = shift @ARGV;
2021
if ("$arg" eq "-DDEBUG") {
@@ -67,7 +68,11 @@
6768
}
6869
push(@args, $lib);
6970
} elsif ("$arg" eq "-lexpat") {
71+
if ($is_debug) {
72+
push(@args, "libexpatd.lib");
73+
} else {
7074
push(@args, "libexpat.lib");
75+
}
7176
} elsif ("$arg" =~ /^-L/ && "$arg" ne "-LTCG") {
7277
$arg =~ s/^-L/-LIBPATH:/;
7378
push(@lflags, $arg);
@@ -119,11 +124,23 @@
119124
push(@cflags, "-wd4996");
120125
} elsif ("$arg" =~ /^-W[a-z]/) {
121126
# let's ignore those
127+
} elsif ("$arg" eq "-fno-stack-protector") {
128+
# eat this
129+
} elsif ("$arg" eq "-mwindows") {
130+
$is_gui = 1;
122131
} else {
123132
push(@args, $arg);
124133
}
125134
}
126135
if ($is_linking) {
136+
if ($is_gui) {
137+
push(@args, "-ENTRY:wWinMainCRTStartup");
138+
push(@args, "-SUBSYSTEM:WINDOWS");
139+
} else {
140+
push(@args, "-ENTRY:wmainCRTStartup");
141+
push(@args, "-SUBSYSTEM:CONSOLE");
142+
}
143+
127144
push(@args, @lflags);
128145
unshift(@args, "link.exe");
129146
} else {

compat/vcbuild/scripts/rc.pl

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/usr/bin/perl -w
2+
######################################################################
3+
# Compile Resources on Windows
4+
#
5+
# This is a wrapper to facilitate the compilation of Git with MSVC
6+
# using GNU Make as the build system. So, instead of manipulating the
7+
# Makefile into something nasty, just to support non-space arguments
8+
# etc, we use this wrapper to fix the command line options
9+
#
10+
######################################################################
11+
use strict;
12+
my @args = ();
13+
my @input = ();
14+
15+
while (@ARGV) {
16+
my $arg = shift @ARGV;
17+
if ("$arg" =~ /^-[dD]/) {
18+
# GIT_VERSION gets passed with too many
19+
# layers of dquote escaping.
20+
$arg =~ s/\\"/"/g;
21+
22+
push(@args, $arg);
23+
24+
} elsif ("$arg" eq "-i") {
25+
my $arg = shift @ARGV;
26+
# TODO complain if NULL or is dashed ??
27+
push(@input, $arg);
28+
29+
} elsif ("$arg" eq "-o") {
30+
my $arg = shift @ARGV;
31+
# TODO complain if NULL or is dashed ??
32+
push(@args, "-fo$arg");
33+
34+
} else {
35+
push(@args, $arg);
36+
}
37+
}
38+
39+
push(@args, "-nologo");
40+
push(@args, "-v");
41+
push(@args, @input);
42+
43+
unshift(@args, "rc.exe");
44+
printf("**** @args\n");
45+
46+
exit (system(@args) != 0);

config.mak.uname

+4-2
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ ifeq ($(uname_S),Windows)
451451
# link.exe next to, and required by, cl.exe, we have to prepend this
452452
# onto the existing $PATH.
453453
#
454-
SANE_TOOL_PATH ?= $(msvc_bin_dir_msys)
454+
SANE_TOOL_PATH ?= $(msvc_bin_dir_msys):$(sdk_ver_bin_dir_msys)
455455
HAVE_ALLOCA_H = YesPlease
456456
NO_PREAD = YesPlease
457457
NEEDS_CRYPTO_WITH_SSL = YesPlease
@@ -513,12 +513,14 @@ endif
513513
compat/win32/trace2_win32_process_info.o \
514514
compat/win32/dirent.o
515515
COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DDETECT_MSYS_TTY -DENSURE_MSYSTEM_IS_SET -DNOGDI -DHAVE_STRING_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\".exe\"
516-
BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -ENTRY:wmainCRTStartup -SUBSYSTEM:CONSOLE
516+
BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO
517517
# invalidcontinue.obj allows Git's source code to close the same file
518518
# handle twice, or to access the osfhandle of an already-closed stdout
519519
# See https://msdn.microsoft.com/en-us/library/ms235330.aspx
520520
EXTLIBS = user32.lib advapi32.lib shell32.lib wininet.lib ws2_32.lib invalidcontinue.obj kernel32.lib ntdll.lib
521+
GITLIBS += git.res
521522
PTHREAD_LIBS =
523+
RC = compat/vcbuild/scripts/rc.pl
522524
lib =
523525
BASIC_CFLAGS += $(vcpkg_inc) $(sdk_includes) $(msvc_includes)
524526
ifndef DEBUG

0 commit comments

Comments
 (0)