Ensure that when building a tarball with make_dist.sh the revision is read from the tag in the remote svn repository.
This should cover both development and distribution cases.
git-svn-id: http://svn.osgeo.org/postgis/trunk@9079
b70326c6-7e19-0410-871a-
916f4a2858ee
# todo: add all subdirs
SUBDIRS = liblwgeom libpgcommon postgis regress @RASTER@ @TOPOLOGY@ loader utils @EXTENSIONS@
+PERL = @PERL@
+
# todo: add more rules here, like uninstall, clean...
all install uninstall noop clean distclean check:
for s in $(SUBDIRS); do \
echo "PostGIS was built successfully. Ready to install."; \
fi
+all: svnrevision.h
+
install: all
uninstall: docs-uninstall comments-uninstall
svnrebase: authors.git
git svn rebase --authors-file authors.git
+svnrevision.h: .FORCE
+ $(PERL) utils/svn_repo_revision.pl
.PHONY: utils liblwgeom ChangeLog.svn raster
+
+.FORCE:
fi
echo "Exporting tag $tag"
-#cvs export -r "$tag" -d "$outdir" postgis
-svn export "http://svn.osgeo.org/postgis/$tag" "$outdir"
+svnurl="http://svn.osgeo.org/postgis/$tag"
+svn export $svnurl "$outdir"
if [ $? -gt 0 ]; then
exit 1
fi
echo "Running autogen.sh; ./configure"
owd="$PWD"
cd "$outdir"
+perl utils/svn_repo_revision.pl $svnurl
./autogen.sh
./configure
#make
#
# Also they are all dependent on postgis_config.h
#
-$(PG_OBJS): ../liblwgeom/.libs/liblwgeom.a ../libpgcommon/libpgcommon.a ../postgis_config.h
+$(PG_OBJS): ../liblwgeom/.libs/liblwgeom.a ../libpgcommon/libpgcommon.a ../postgis_config.h ../svnrevision.h
+
+../svnrevision.h:
+ $(MAKE) -C .. svnrevision.h
# Borrow the $libdir substitution from PGXS but customise by adding the version number
%.sql: %.sql.in
--- /dev/null
+#!/usr/bin/perl
+
+use Cwd;
+my $cwd = &Cwd::cwd();
+
+my $svn_exe = `which svn`;
+
+my $target = "local";
+
+$target = $ARGV[0] if $ARGV[0];
+
+# Don't muck with things if you can't find svn
+exit(0) if ( ! $svn_exe );
+
+# Don't muck with thinks if you aren't in an svn repository
+if ( $target eq "local" && ! -d ".svn" ) {
+ exit(0);
+}
+
+# Read the svn revision number
+my $svn_info;
+if ( $target eq "local" ) {
+ $svn_info = `svn info`;
+} else {
+ $svn_info = `svn info $target`;
+}
+
+if ( $svn_info =~ /Last Changed Rev: (\d+)/ ) {
+ my $rev = $1;
+ open(OUT,">$cwd/svnrevision.h");
+ print OUT "#define SVNREV $rev\n";
+ close(OUT);
+}
+else {
+ die "Unable to find revision in svn info\n";
+}