Add a new merge strategy by Fredrik Kuivinen.

I really wanted to try this out, instead of asking for an adjustment
to the 'git merge' driver and waiting.  For now the new strategy is
called 'fredrik' and not in the list of default strategies to be tried.

The script wants Python 2.4 so this commit also adjusts Debian and RPM
build procecure files.

Signed-off-by: Junio C Hamano <junkio@cox.net>
diff --git a/Makefile b/Makefile
index 41461fa..5b028b1 100644
--- a/Makefile
+++ b/Makefile
@@ -48,6 +48,7 @@
 prefix = $(HOME)
 bindir = $(prefix)/bin
 template_dir = $(prefix)/share/git-core/templates/
+GIT_PYTHON_DIR = $(prefix)/share/git-core/python
 # DESTDIR=
 
 CC = gcc
@@ -81,6 +82,9 @@
 	git-archimport.perl git-cvsimport.perl git-relink.perl \
 	git-rename.perl git-shortlog.perl
 
+SCRIPT_PYTHON = \
+	git-merge-fredrik.py
+
 # The ones that do not have to link with lcrypto nor lz.
 SIMPLE_PROGRAMS = \
 	git-get-tar-commit-id git-mailinfo git-mailsplit git-stripspace \
@@ -105,6 +109,9 @@
 	git-upload-pack git-verify-pack git-write-tree \
 	$(SIMPLE_PROGRAMS)
 
+PYMODULES = \
+	gitMergeCommon.py
+
 ifdef WITH_SEND_EMAIL
 	SCRIPT_PERL += git-send-email.perl
 endif
@@ -150,6 +157,9 @@
 ifndef PERL_PATH
 	PERL_PATH = /usr/bin/perl
 endif
+ifndef PYTHON_PATH
+	PYTHON_PATH = /usr/bin/python
+endif
 
 ifndef NO_OPENSSL
 	LIB_OBJS += epoch.o
@@ -189,7 +199,9 @@
 DEFINES += '-DSHA1_HEADER=$(SHA1_HEADER)'
 
 SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) \
-	  $(patsubst %.perl,%,$(SCRIPT_PERL)) gitk
+	  $(patsubst %.perl,%,$(SCRIPT_PERL)) \
+	  $(patsubst %.py,%,$(SCRIPT_PYTHON)) \
+	  gitk
 
 ### Build rules
 
@@ -214,6 +226,13 @@
 	sed -e '1s|#!.*perl|#!$(PERL_PATH)|' $@.perl >$@
 	chmod +x $@
 
+$(patsubst %.py,%,$(SCRIPT_PYTHON)) : % : %.py
+	rm -f $@
+	sed -e '1s|#!.*python|#!$(PYTHON_PATH)|' \
+	    -e 's|@@GIT_PYTHON_PATH@@|$(GIT_PYTHON_DIR)|g' \
+		$@.py >$@
+	chmod +x $@
+
 %.o: %.c
 	$(CC) -o $*.o -c $(ALL_CFLAGS) $<
 %.o: %.S
@@ -274,6 +293,8 @@
 	$(INSTALL) git-revert $(DESTDIR)$(bindir)/git-cherry-pick
 	sh ./cmd-rename.sh $(DESTDIR)$(bindir)
 	$(MAKE) -C templates install
+	$(INSTALL) -m755 -d $(DESTDIR)$(GIT_PYTHON_DIR)
+	$(INSTALL) $(PYMODULES) $(DESTDIR)$(GIT_PYTHON_DIR)
 
 install-doc:
 	$(MAKE) -C Documentation install