git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Philip Oakley <philipoakley@iee.org>
To: GitList <git@vger.kernel.org>
Cc: MsysGitList <msysgit@googlegroups.com>,
	Philip Oakley <philipoakley@iee.org>
Subject: [PATCH 16/17] msvc-build: add complete Microsoft Visual C compilation script
Date: Thu, 25 Jun 2015 01:03:52 +0100	[thread overview]
Message-ID: <1435190633-2208-17-git-send-email-philipoakley@iee.org> (raw)
In-Reply-To: <1435190633-2208-1-git-send-email-philipoakley@iee.org>

Implement the README to facilitate cross community development.
Include comments for those Windows folks not yet fully familiar
with bash commands.

This is identical to the msysgit script, except for the 'cd toplevel'
step, and comments for the edification of converts from Windows.
Original author: Johannes Schindelin (2011-11-01 3142da4 : Add a script
to make the MSVC build more convenient).

Signed-off-by: Philip Oakley <philipoakley@iee.org>
---

TODO:
Also resolve the cleaning of newer VS2010 products.
---
 compat/vcbuild/README             |  2 +-
 compat/vcbuild/scripts/msvc-build | 89 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 90 insertions(+), 1 deletion(-)
 create mode 100644 compat/vcbuild/scripts/msvc-build

diff --git a/compat/vcbuild/README b/compat/vcbuild/README
index 7548dc4..faaea69 100644
--- a/compat/vcbuild/README
+++ b/compat/vcbuild/README
@@ -58,4 +58,4 @@ The Steps of Build Git with VS2008
 
 Done!
 
-Or, use the Msysgit msvc-build script; available from that project.
+Or, use the msvc-build script; available from /compat/vcbuild/scripts/.
diff --git a/compat/vcbuild/scripts/msvc-build b/compat/vcbuild/scripts/msvc-build
new file mode 100644
index 0000000..52b925d
--- /dev/null
+++ b/compat/vcbuild/scripts/msvc-build
@@ -0,0 +1,89 @@
+#!/bin/sh
+
+# This msvc-build command should be executed from the msysgit directory level
+# This is so that the 'cd/git' step works and the subequent operations have the right msysgit super directory.
+set -e # Exit immediately if a command exits with a nonzero exit status.
+
+gui=
+clean=
+while test $# -gt 0
+do
+	case "$1" in
+	--gui|--dev|--devenv|--vs|--visual-studio)
+		gui=t
+		;;
+	clean)
+		clean=t
+		;;
+	*)
+		echo "Usage: $0 [--vs] [clean]" >&2
+		exit 1
+		;;
+	esac
+	shift
+done
+
+cd $(git rev-parse --show-toplevel)
+
+case "$clean" in
+t)
+	case "$gui" in
+	t)
+		rm -rf git.sln libgit
+		# remove all the new VS2010 stuff as well
+		# rm -rf git.sdf
+		;;
+	'')
+		make clean
+		# surely needs "make clean MSVC=1"
+		# otherwise it could assume the wrong make products [MinGW vs Windows].
+		;;
+	esac
+	exit
+	;;
+esac
+
+to_ignore="$(git ls-files --other --exclude-standard msvcgit msvc-build.cmd)"
+test -z "$to_ignore" || {
+	mkdir -p .git/info &&
+	echo "$to_ignore" |
+	sed 's/^/\//' >> .git/info/exclude
+} || exit
+
+test -d msvcgit || git clone git://repo.or.cz/msvcgit.git
+
+vsvars=
+# assume cl.exe will populate its relevant environment variables
+# if cl.exe does not exist, populate vsvars with the most recent Visual Studio path
+type cl.exe 2> /dev/null ||
+vsvars="$(ls -t \
+	"$PROGRAMFILES/Microsoft Visual Studio"*/Common7/Tools/vsvars32.bat |
+	head -n 1)"
+
+
+config_mak=
+# if a config.mak file (dot, not underscore) exists, back it up,
+# remember the backup file name in config_mak.
+test -f config.mak &&
+config_mak=config.mak.bup.$$ &&
+mv config.mak $config_mak
+
+cat > config.mak << EOF
+CFLAGS += -Imsvcgit/32bits/include
+LDFLAGS += -Lmsvcgit/32bits/lib
+EOF
+
+echo "call \"$vsvars\"" > msvc-build.cmd
+if test -z "$gui"
+then
+	echo 'make MSVC=1' >> msvc-build.cmd
+else
+	echo 'perl contrib/buildsystems/generate -g Vcproj' >> msvc-build.cmd
+	echo 'start git.sln' >> msvc-build.cmd
+fi
+
+cmd /c msvc-build.cmd
+
+# if we made a backup file (name in config_mak), then restore it.
+test -z "$config_mak" ||
+mv $config_mak config.mak
-- 
2.3.1

-- 
-- 
*** Please reply-to-all at all times ***
*** (do not pretend to know who is subscribed and who is not) ***
*** Please avoid top-posting. ***
The msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.

You received this message because you are subscribed to the Google
Groups "msysGit" group.
To post to this group, send email to msysgit@googlegroups.com
To unsubscribe from this group, send email to
msysgit+unsubscribe@googlegroups.com
For more options, and view previous threads, visit this group at
http://groups.google.com/group/msysgit?hl=en_US?hl=en

--- 
You received this message because you are subscribed to the Google Groups "Git for Windows" group.
To unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

  parent reply	other threads:[~2015-06-25  0:02 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-25  0:03 [PATCH 00/17] Make the msvc-build scripts work again Philip Oakley
2015-06-25  0:03 ` [PATCH 01/17] .gitignore: improve MSVC ignore patterns Philip Oakley
2015-06-25 15:13   ` Junio C Hamano
2015-06-25 19:32     ` Philip Oakley
2015-06-25 20:22       ` Junio C Hamano
2015-06-25  0:03 ` [PATCH 02/17] .gitignore: ignore library directories created by MSVC VS2008 buildsystem Philip Oakley
2015-06-25  0:03 ` [PATCH 03/17] (msvc-build) Vcproj.pm: remove duplicate GUID Philip Oakley
2015-06-28  3:05   ` Eric Sunshine
2015-06-28  8:44     ` Philip Oakley
2015-06-25  0:03 ` [PATCH 04/17] Makefile: a dry-run can error out if no perl. Document the issue Philip Oakley
2015-06-25 15:24   ` Junio C Hamano
2015-06-25 19:33     ` Philip Oakley
2015-06-25 20:21       ` Junio C Hamano
2015-06-25 23:34         ` Philip Oakley
2015-07-14 22:42           ` Philip Oakley
2015-06-25  0:03 ` [PATCH 05/17] engine.pl: fix error message (lib->link) Philip Oakley
2015-06-25  0:03 ` [PATCH 06/17] engine.pl: Avoid complications with perl support Philip Oakley
2015-06-25  0:03 ` [PATCH 07/17] engine.pl: Properly accept quoted spaces in filenames Philip Oakley
2015-06-25  0:03 ` [PATCH 08/17] engine.pl: Fix i18n -o option in msvc buildsystem generator Philip Oakley
2015-06-25  0:03 ` [PATCH 09/17] engine.pl: ignore invalidcontinue.obj which is known to MSVC Philip Oakley
2015-06-25  0:03 ` [PATCH 10/17] engine.pl: name the msvc buildsystem's makedry error file Philip Oakley
2015-06-25  0:03 ` [PATCH 11/17] engine.pl: delete the captured stderr file if empty Philip Oakley
2015-06-25  0:03 ` [PATCH 12/17] engine.pl: add debug line to capture the dry-run Philip Oakley
2015-06-25  0:03 ` [PATCH 13/17] engine.pl: provide more debug print statements Philip Oakley
2015-06-29 21:27   ` Sebastian Schuberth
2015-07-07 22:18     ` Philip Oakley
2015-06-29 21:31   ` Sebastian Schuberth
2015-06-29 21:33   ` Sebastian Schuberth
2015-06-25  0:03 ` [PATCH 14/17] Vcproj.pm: list git.exe first to be startup project Philip Oakley
2015-06-25  0:03 ` [PATCH 15/17] vcbuild/readme: Improve layout and reference msvc-build script Philip Oakley
2015-06-25  0:03 ` Philip Oakley [this message]
2015-06-25  0:03 ` [PATCH 17/17] config.mak.uname: add MSVC No_SafeExeceptionHandler option Philip Oakley
2015-06-25 15:10 ` [PATCH 00/17] Make the msvc-build scripts work again Junio C Hamano
2015-06-25 19:31   ` Philip Oakley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1435190633-2208-17-git-send-email-philipoakley@iee.org \
    --to=philipoakley@iee.org \
    --cc=git@vger.kernel.org \
    --cc=msysgit@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).