2011-11-01 22:59:55 +04:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2011-11-01 23:29:38 +04:00
|
|
|
gui=
|
2011-11-01 23:32:55 +04:00
|
|
|
clean=
|
2011-11-01 23:29:38 +04:00
|
|
|
while test $# -gt 0
|
|
|
|
do
|
|
|
|
case "$1" in
|
|
|
|
--gui|--dev|--devenv|--vs|--visual-studio)
|
|
|
|
gui=t
|
|
|
|
;;
|
2011-11-01 23:32:55 +04:00
|
|
|
clean)
|
|
|
|
clean=t
|
|
|
|
;;
|
2011-11-01 23:29:38 +04:00
|
|
|
*)
|
2011-11-01 23:32:55 +04:00
|
|
|
echo "Usage: $0 [--vs] [clean]" >&2
|
2011-11-01 23:29:38 +04:00
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
2011-11-01 22:59:55 +04:00
|
|
|
cd /git
|
|
|
|
|
2011-11-01 23:32:55 +04:00
|
|
|
case "$clean" in
|
|
|
|
t)
|
|
|
|
case "$gui" in
|
|
|
|
t)
|
|
|
|
rm -rf git.sln libgit
|
|
|
|
;;
|
|
|
|
'')
|
|
|
|
make clean
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
exit
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2012-04-10 07:18:15 +04:00
|
|
|
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
|
|
|
|
|
2011-11-01 22:59:55 +04:00
|
|
|
test -d msvcgit || git clone git://repo.or.cz/msvcgit.git
|
|
|
|
|
|
|
|
vsvars=
|
|
|
|
type cl.exe 2> /dev/null ||
|
|
|
|
vsvars="$(ls -t \
|
|
|
|
"$PROGRAMFILES/Microsoft Visual Studio"*/Common7/Tools/vsvars32.bat |
|
|
|
|
head -n 1)"
|
|
|
|
|
2011-11-01 23:25:59 +04:00
|
|
|
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
|
2011-11-01 22:59:55 +04:00
|
|
|
|
2011-11-01 23:29:38 +04:00
|
|
|
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
|
2011-11-01 22:59:55 +04:00
|
|
|
|
|
|
|
cmd /c msvc-build.cmd
|
2011-11-01 23:25:59 +04:00
|
|
|
|
|
|
|
test -z "$config_mak" ||
|
|
|
|
mv $config_mak config.mak
|