Subject: [PATCH 2, proof of concept] autoconf: Use %configure in git.spec, autoconf dependency only in rpm target

From: Jakub Narebski <[email-masked]>
Date: Tue, 4 Jul 2006 16:09:35 +0200

This is __Proof of Concept__ patch, which makes use of predefined 
%configure rpm macro to define install dirs, using autoconf 
generated ./configure script.

This patch introduces dependency on autoconf _only_ for rpm target during
build process. 
---
Probably there is more portable way of ignoring diff exit status than 
using '|| true', and probably better way to generate 
"file creation"/"new file" patch from a working directory (only) file
(perhaps using git-diff too).

Sidenote 1: current git.spec.in doesn't allow building RPMS from a dirty
version: 
  error: line 3: Illegal char '-' in version: Version:    1.4.1.g1c7c-dirty
Is it intentional?

Sidenote 2: building rpm currently does compilation _twice_, once to generate
git-tar-tree, and once in the rpm build (in BuildRoot).

 Makefile    |    3 +++
 git.spec.in |    6 ++++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 3c2c257..8ad1a4a 100644
--- a/Makefile
+++ b/Makefile
@@ -721,6 +722,9 @@ dist: git.spec git-tar-tree
 	gzip -f -9 $(GIT_TARNAME).tar
 
 rpm: dist
+	autoconf
+	diff -Nu /dev/null configure > git-add-autoconf-configure.patch || true
+	gzip -f -9 git-add-autoconf-configure.patch
 	$(RPMBUILD) -ta $(GIT_TARNAME).tar.gz
 
 htmldocs = git-htmldocs-$(GIT_VERSION)
diff --git a/git.spec.in b/git.spec.in
index 8ccd256..9c02803 100644
--- a/git.spec.in
+++ b/git.spec.in
@@ -7,6 +7,7 @@ License: 	GPL
 Group: 		Development/Tools
 URL: 		http://kernel.org/pub/software/scm/git/
 Source: 	http://kernel.org/pub/software/scm/git/%{name}-%{version}.tar.gz
+Patch0: 	git-add-autoconf-configure.patch.gz
 BuildRequires:	zlib-devel >= 1.2, openssl-devel, curl-devel, expat-devel  %{!?_without_docs:, xmlto, asciidoc > 6.0.3}
 BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 Requires:	git-core, git-svn, git-cvs, git-arch, git-email, gitk
@@ -72,15 +73,16 @@ Git revision tree visualiser ('gitk')
 
 %prep
 %setup -q
+%patch0 -p0
 
 %build
+%configure
 make %{_smp_mflags} CFLAGS="$RPM_OPT_FLAGS" WITH_OWN_SUBPROCESS_PY=YesPlease \
-     prefix=%{_prefix} all %{!?_without_docs: doc}
+     all %{!?_without_docs: doc}
 
 %install
 rm -rf $RPM_BUILD_ROOT
 make %{_smp_mflags} DESTDIR=$RPM_BUILD_ROOT WITH_OWN_SUBPROCESS_PY=YesPlease \
-     prefix=%{_prefix} mandir=%{_mandir} \
      install %{!?_without_docs: install-doc}
 
 (find $RPM_BUILD_ROOT%{_bindir} -type f | grep -vE "arch|svn|cvs|email|gitk" | sed -e s@^$RPM_BUILD_ROOT@@)               > bin-man-doc-files
-- 
1.4.0