From ec04f32481f34d38fac7fddbc2e1f9f09eaf552e Mon Sep 17 00:00:00 2001
From: Juan RP <xtraeme@gmail.com>
Date: Tue, 30 Sep 2008 15:22:57 +0200
Subject: [PATCH] Pass consistent arguments to configure script if
 build_style=gnu_configure, so that we can install the info files into the
 same directory, as well as not requiring passing stuff from random templates.

While here use merge-info from Xstow to merge two info dir files.

As bonus I added git-1.6.0.2 and its dependencies, based on work done by
morr@. Thank you!

A git package built with pkgfs is fully functional now, enjoy!

--HG--
extra : convert_revision : 97c0b5c4b24cc6d63594f0f467349b13ea553980
---
 dependencies/curl-7.18.0-deps.db | Bin 0 -> 1024 bytes
 dependencies/git-1.6.0.2-deps.db | Bin 0 -> 1024 bytes
 dependencies/libidn-1.9-deps.db  | Bin 0 -> 1024 bytes
 pkgfs.sh                         |  57 +++++++++++++++++++++++++++----
 templates/curl-7.18.0.tmpl       |  15 ++++++++
 templates/git-1.6.0.2.tmpl       |  25 ++++++++++++++
 templates/libidn-1.9.tmpl        |  23 +++++++++++++
 templates/ruby-1.8.7-p72.tmpl    |   3 +-
 8 files changed, 115 insertions(+), 8 deletions(-)
 create mode 100644 dependencies/curl-7.18.0-deps.db
 create mode 100644 dependencies/git-1.6.0.2-deps.db
 create mode 100644 dependencies/libidn-1.9-deps.db
 create mode 100755 templates/curl-7.18.0.tmpl
 create mode 100644 templates/git-1.6.0.2.tmpl
 create mode 100755 templates/libidn-1.9.tmpl

diff --git a/dependencies/curl-7.18.0-deps.db b/dependencies/curl-7.18.0-deps.db
new file mode 100644
index 0000000000000000000000000000000000000000..f6860e94865cc0d8ac824b7da5f127687a442fc8
GIT binary patch
literal 1024
zcmYc?WMyDx00Jfu0Rajy#wb1PLx2&<hoB@N#_)vk39=xP{3vs1h5#$j+1wzfr=%7X
RGvs6@Wv1lm8tPesgaFsk2b2H+

literal 0
HcmV?d00001

diff --git a/dependencies/git-1.6.0.2-deps.db b/dependencies/git-1.6.0.2-deps.db
new file mode 100644
index 0000000000000000000000000000000000000000..622c5fea6c16bc1d632bda6d1fc72966ddac7c1b
GIT binary patch
literal 1024
zcmYc?WMyDx00Jfu0Rajy#wb1PLx2&<hoB@N#&Cx546-1S{3vs9hX5<kdCDLsrlb}W
qGo<GxW~b^J>sc5oq*fFpmgpMk8R!`*B$pQD=$h*pTId;olmY-@R1MAm

literal 0
HcmV?d00001

diff --git a/dependencies/libidn-1.9-deps.db b/dependencies/libidn-1.9-deps.db
new file mode 100644
index 0000000000000000000000000000000000000000..8427ba199dc213cdc6130779b0f95f2e2aebbc9b
GIT binary patch
literal 1024
zcmYc?WMyDx00Jfu0Rajy#wb1PLx2&<hoB@N#&Cr32(loO{3vs9h5#$jS=u0{rKA=V
yGZbW}>n7*trDdk;8t54rE97J*mE`B==o;x6>6s-e6r>jA=$h&o8t55-v;Y9m0}#ys

literal 0
HcmV?d00001

diff --git a/pkgfs.sh b/pkgfs.sh
index 4fcd46de4b..061a43d559 100755
--- a/pkgfs.sh
+++ b/pkgfs.sh
@@ -121,6 +121,32 @@ run_file()
 
 }
 
+#
+# This function merges two GNU info dirs into one and puts the result
+# into PKGFS_MASTERDIR/share/info/dir.
+#
+merge_infodir_tmpl()
+{
+	local pkgname="$1"
+	local merge_info_cmd="$PKGFS_MASTERDIR/bin/merge-info"
+
+	[ -z "$pkgname" ] && return 1
+	[ ! -r "$PKGFS_MASTERDIR/share/info/dir" ] && return 1
+	[ ! -r "$PKGFS_DESTDIR/$pkgname/share/info/dir" ] && return 1
+
+	$merge_info_cmd -d $PKGFS_MASTERDIR/share/info/dir 	\
+		$PKGFS_DESTDIR/$pkgname/share/info/dir -o 	\
+		$PKGFS_MASTERDIR/share/info/dir.new
+	if [ "$?" -ne 0 ]; then
+		echo -n "*** WARNING: there was an error merging info dir from"
+		echo " $pkgname, aborting ***"
+		return 1
+	fi
+
+	$mv_cmd -f $PKGFS_MASTERDIR/share/info/dir.new \
+		$PKGFS_MASTERDIR/share/info/dir
+}
+
 info_tmpl()
 {
 	local tmpl="$1"
@@ -448,7 +474,8 @@ build_tmpl_sources()
 	# For now, just set LDFLAGS.
 	#
 	LDFLAGS="$LDFLAGS -L$PKGFS_MASTERDIR/lib -Wl,-R$PKGFS_MASTERDIR/lib"
-	export LDFLAGS
+	PKG_CONFIG="$PKGFS_MASTERDIR/bin/pkg-config"
+	export LDFLAGS PKG_CONFIG PKG_CONFIG_LIBDIR
 
 	#
 	# Packages using GNU autoconf
@@ -459,8 +486,15 @@ build_tmpl_sources()
 		done
 
 		cd $pkg_builddir
-		./configure	--prefix="$PKGFS_MASTERDIR" ${configure_args} \
-				--mandir="$PKGFS_DESTDIR/$pkgname/man"
+		#
+		# Pass consistent arguments to not have unexpected
+		# surprises later.
+		#
+		./configure	--prefix="$PKGFS_MASTERDIR" \
+				--exec-prefix="$PKGFS_DESTDIR/$pkgname" \
+				--mandir="$PKGFS_DESTDIR/$pkgname/man" \
+				--infodir="$PKGFS_DESTDIR/$pkgname/share/info" \
+				${configure_args}
 
 	#
 	# Packages using propietary configure scripts.
@@ -503,7 +537,7 @@ build_tmpl_sources()
 		exit 1
 	fi
 
-	unset LDFLAGS
+	unset LDFLAGS PKG_CONFIG
 
 	echo ">>> Installed \`$pkgname' into $PKGFS_DESTDIR/$pkgname."
 
@@ -519,11 +553,22 @@ build_tmpl_sources()
 stow_tmpl()
 {
 	local pkg="$1"
+	local infodir_pkg="share/info/dir"
+	local infodir_master="$PKGFS_MASTERDIR/share/info/dir"
 
 	[ -z "$pkg" ] && return 2
 
+	if [ -r "$PKGFS_DESTDIR/$pkg/$infodir_pkg" ]; then
+		merge_infodir_tmpl ${pkg}
+	fi
+
+	if [ -r "$PKGFS_DESTDIR/$pkg/$infodir_pkg" -a -r "$infodir_master" ]; then
+		xstow_args="$xstow_args -i-file-in-dir $infodir_pkg"
+	fi
+
 	$PKGFS_XSTOW_CMD -dir $PKGFS_DESTDIR -target $PKGFS_MASTERDIR \
-		${xstow_args} $PKGFS_DESTDIR/$pkg
+		${xstow_args} -pd-targets $PKGFS_MASTERDIR \
+		$PKGFS_DESTDIR/$pkg
 	if [ "$?" -ne 0 ]; then
 		echo "*** ERROR: couldn't create symlinks for \`$pkg' ***"
 		exit 1
@@ -550,7 +595,7 @@ unstow_tmpl()
 	fi
 
 	$PKGFS_XSTOW_CMD -dir $PKGFS_DESTDIR -target $PKGFS_MASTERDIR \
-		-D $PKGFS_DESTDIR/$pkg
+		-D -ignore $PKGFS_DESTDIR/$pkg/share/info/dir $PKGFS_DESTDIR/$pkg
 	if [ "$?" -ne 0 ]; then
 		exit 1
 	else
diff --git a/templates/curl-7.18.0.tmpl b/templates/curl-7.18.0.tmpl
new file mode 100755
index 0000000000..394f72f9b4
--- /dev/null
+++ b/templates/curl-7.18.0.tmpl
@@ -0,0 +1,15 @@
+# Template file for 'curl-7.18.0'
+pkgname=curl-7.18.0
+extract_sufx=".tar.bz2"
+url=http://curl.haxx.se/download/
+build_style=gnu_configure
+short_desc="Client that groks URLs"
+maintainer="Juan RP <xtraeme@gmail.com>"
+checksum=f25ec844e7ef6221719439b3214fd3c3a42f5604
+long_desc="
+ Curl is a command line tool for transferring files with URL syntax, supporting
+ FTP, FTPS, HTTP, HTTPS, GOPHER, TELNET, DICT, FILE and LDAP. Curl supports
+ HTTPS certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP form based upload,
+ proxies, cookies, user+password authentication (Basic, Digest, NTLM, Negotiate,
+ kerberos...), file transfer resume, proxy tunneling and a busload of other
+ useful tricks."
diff --git a/templates/git-1.6.0.2.tmpl b/templates/git-1.6.0.2.tmpl
new file mode 100644
index 0000000000..fe56c61c34
--- /dev/null
+++ b/templates/git-1.6.0.2.tmpl
@@ -0,0 +1,25 @@
+# Template build file for 'git-1.6.0.2".
+pkgname=git-1.6.0.2
+extract_sufx=".tar.bz2"
+url=http://www.kernel.org/pub/software/scm/git
+build_style=gnu_configure
+configure_args="--with-shell=/bin/sh --with-perl=$PKGFS_MASTERDIR/bin/perl
+ --with-curl --without-tcltk --with-expat"
+# Looks like git is ignoring some stuff from autoconf, so pass our stuff
+# directly to it through the environment.
+export CPPFLAGS="-I$PKGFS_MASTERDIR/include"
+export CURLDIR="$PKGFS_MASTERDIR"
+make_cmd="$PKGFS_MASTERDIR/bin/gmake"
+short_desc="GIT Tree History Storage Tool"
+maintainer="Daniel Horecki <morr@morr.pl>"
+checksum=eb91ca256d0fbcc956f91ad02da659d9b322261d
+long_desc="
+ GIT is a \"directory content manager\" designed to handle absolutely massive
+ projects with speed and efficiency, and the release of the 2.6.12 (and later)
+ versions of the Linux kernel as well as more and more other projects switching
+ to it would indicate that it does this task well.
+
+ GIT falls in the category of distributed version control software, similar
+ to e.g. GNU Arch or Monotone (or, in the commercial world, BitKeeper). Every
+ GIT working directory is a full-fledged repository with full revision tracking
+ capabilities, not dependent on network access to a central server."
diff --git a/templates/libidn-1.9.tmpl b/templates/libidn-1.9.tmpl
new file mode 100755
index 0000000000..cad4dd130d
--- /dev/null
+++ b/templates/libidn-1.9.tmpl
@@ -0,0 +1,23 @@
+# Template file for 'libidn-1.9'
+pkgname=libidn-1.9
+extract_sufx=".tar.gz"
+url=http://ftp.gnu.org/gnu/libidn
+build_style=gnu_configure
+configure_env="EMACS=/bin/false"
+configure_args="--disable-csharp --disable-java"
+short_desc="Internationalized Domain Names command line tool"
+maintainer="Juan RP <xtraeme@gmail.com>"
+checksum=3b2217f015965600b69983cf831746a591f0680e
+long_desc="
+ GNU Libidn is an implementation of the Stringprep, Punycode, and IDNA
+ specifications defined by the IETF Internationalized Domain Names (IDN)
+ working group. It is used to prepare internationalized strings (such as
+ domain name labels, usernames, and passwords) in order to increase the
+ likelihood that string input and string comparison work in ways that make
+ sense for typical users throughout the world.
+
+ The library contains a generic Stringprep implementation that does Unicode
+ 3.2 NFKC normalization, mapping and prohibition of characters, and
+ bidirectional character handling. Profiles for iSCSI, Kerberos 5, Nameprep,
+ SASL, and XMPP are included. Punycode and ASCII Compatible Encoding (ACE) via
+ IDNA are supported."
diff --git a/templates/ruby-1.8.7-p72.tmpl b/templates/ruby-1.8.7-p72.tmpl
index 3208edd2fa..becb0e7b1b 100644
--- a/templates/ruby-1.8.7-p72.tmpl
+++ b/templates/ruby-1.8.7-p72.tmpl
@@ -3,8 +3,7 @@ pkgname=ruby-1.8.7-p72
 extract_sufx=".tar.bz2"
 url=ftp://ftp.ruby-lang.org/pub/ruby/1.8
 build_style=gnu_configure
-configure_args="--enable-pthread --enable-shared
- --exec-prefix=$PKGFS_DESTDIR/$pkgname"
+configure_args="--enable-pthread --enable-shared"
 short_desc="Ruby programming language"
 maintainer="Daniel Horecki <morr@morr.pl>"
 checksum=07bf0d6987ba111aed988093c569fb66ba54891b