aboutsummaryrefslogtreecommitdiffstats
path: root/config.mak.uname
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2019-07-29 13:08:12 -0700
committerJunio C Hamano <gitster@pobox.com>2019-07-29 14:51:43 -0700
commit976aaedca0c6f64b37f4241bf06fa7ab06095986 (patch)
tree0f15613264916870a1ef948e34135a514159eeb9 /config.mak.uname
parent384a61bc6a8e6dc241d685acf4fb7b5a15003dbb (diff)
downloadgit-976aaedca0c6f64b37f4241bf06fa7ab06095986.tar.gz
msvc: add a Makefile target to pre-generate the Visual Studio solution
The entire idea of generating the VS solution makes only sense if we generate it via Continuous Integration; otherwise potential users would still have to download the entire Git for Windows SDK. If we pre-generate the Visual Studio solution, Git can be built entirely within Visual Studio, and the test scripts can be run in a regular Git for Windows (e.g. the Portable Git flavor, which does not include a full GCC toolchain and therefore weighs only about a tenth of Git for Windows' SDK). So let's just add a target in the Makefile that can be used to generate said solution; The generated files will then be committed so that they can be pushed to a branch ready to check out by Visual Studio users. To make things even more useful, we also generate and commit other files that are required to run the test suite, such as templates and bin-wrappers: with this, developers can run the test suite in a regular Git Bash after building the solution in Visual Studio. Note: for this build target, we do not actually need to initialize the `vcpkg` system, so we don't. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'config.mak.uname')
-rw-r--r--config.mak.uname61
1 files changed, 61 insertions, 0 deletions
diff --git a/config.mak.uname b/config.mak.uname
index 48a6723222..6d0ed923b8 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -25,10 +25,12 @@ include compat/vcbuild/MSVC-DEFS-GEN
# See if vcpkg and the vcpkg-build versions of the third-party
# libraries that we use are installed. We include the result
# to get $(vcpkg_*) variables defined for the Makefile.
+ifeq (,$(SKIP_VCPKG))
compat/vcbuild/VCPKG-DEFS: compat/vcbuild/vcpkg_install.bat
@"$<"
include compat/vcbuild/VCPKG-DEFS
endif
+endif
# We choose to avoid "if .. else if .. else .. endif endif"
# because maintaining the nesting to match is a pain. If
@@ -689,3 +691,62 @@ ifeq ($(uname_S),QNX)
NO_STRCASESTR = YesPlease
NO_STRLCPY = YesPlease
endif
+
+vcxproj:
+ # Require clean work tree
+ git update-index -q --refresh && \
+ git diff-files --quiet && \
+ git diff-index --cached --quiet HEAD --
+
+ # Make .vcxproj files and add them
+ unset QUIET_GEN QUIET_BUILT_IN; \
+ perl contrib/buildsystems/generate -g Vcxproj
+ git add -f git.sln {*,*/lib,t/helper/*}/*.vcxproj
+
+ # Add command-list.h
+ $(MAKE) MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 command-list.h
+ git add -f command-list.h
+
+ # Add scripts
+ rm -f perl/perl.mak
+ $(MAKE) MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 \
+ $(SCRIPT_LIB) $(SCRIPT_SH_GEN) $(SCRIPT_PERL_GEN)
+ # Strip out the sane tool path, needed only for building
+ sed -i '/^git_broken_path_fix ".*/d' git-sh-setup
+ git add -f $(SCRIPT_LIB) $(SCRIPT_SH_GEN) $(SCRIPT_PERL_GEN)
+
+ # Add Perl module
+ $(MAKE) $(LIB_PERL_GEN)
+ git add -f perl/build
+
+ # Add bin-wrappers, for testing
+ rm -rf bin-wrappers/
+ $(MAKE) MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 $(test_bindir_programs)
+ # Ensure that the GIT_EXEC_PATH is a Unix-y one, and that the absolute
+ # path of the repository is not hard-coded (GIT_EXEC_PATH will be set
+ # by test-lib.sh according to the current setup)
+ sed -i -e 's/^\(GIT_EXEC_PATH\)=.*/test -n "$${\1##*:*}" ||\
+ \1="$$(cygpath -u "$$\1")"/' \
+ -e "s|'$$(pwd)|\"\$$GIT_EXEC_PATH\"'|g" bin-wrappers/*
+ # Ensure that test-* helpers find the .dll files copied to top-level
+ sed -i 's|^PATH=.*|&:"$$GIT_EXEC_PATH"|' bin-wrappers/test-*
+ # We do not want to force hard-linking builtins
+ sed -i 's|\(git\)-\([-a-z]*\)\.exe"|\1.exe" \2|g' \
+ bin-wrappers/git-{receive-pack,upload-archive}
+ git add -f $(test_bindir_programs)
+ # remote-ext is a builtin, but invoked as if it were external
+ sed 's|receive-pack|remote-ext|g' \
+ <bin-wrappers/git-receive-pack >bin-wrappers/git-remote-ext
+ git add -f bin-wrappers/git-remote-ext
+
+ # Add templates
+ $(MAKE) -C templates
+ git add -f templates/boilerplates.made templates/blt/
+
+ # Add build options
+ $(MAKE) MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 GIT-BUILD-OPTIONS
+ git add -f GIT-BUILD-OPTIONS
+
+ # Commit the whole shebang
+ git commit -m "Generate Visual Studio solution" \
+ -m "Auto-generated by \`$(MAKE)$(MAKEFLAGS) $@\`"