[postgis-tickets] r14739 - Update make_dist.sh from trunk

Sandro Santilli strk at keybit.net
Thu Mar 3 02:38:17 PST 2016


Author: strk
Date: 2016-03-03 02:38:17 -0800 (Thu, 03 Mar 2016)
New Revision: 14739

Modified:
   branches/2.2/make_dist.sh
Log:
Update make_dist.sh from trunk

Closes #3165 and #3482

Modified: branches/2.2/make_dist.sh
===================================================================
--- branches/2.2/make_dist.sh	2016-03-03 09:22:13 UTC (rev 14738)
+++ branches/2.2/make_dist.sh	2016-03-03 10:38:17 UTC (rev 14739)
@@ -9,16 +9,56 @@
 # -- postgis-1.1.0.tar.gz 
 # sh make_dist.sh 1.1.0
 #
+# -- postgis-2.2.tar.gz  (from a branch)
+# sh make_dist.sh -b 2.2
+#
 # NOTE: will not work prior to 1.1.0
 #
+# ENVIRONMENT VARIABLES:
 #
+#   CONFIGURE_ARGS    passed to ./configure call
+#   MAKE              useed for builds (defaults to "make")
+#
+#
 
-tag=trunk
 version=dev
 
+# Define in environment if necessary to get postgis to configure,
+# which is only done to build comments.
+#CONFIGURE_ARGS=
+
+# Define in environment if Gnu make is not make (e.g., gmake).
+if [ "$MAKE" = "" ]; then
+    MAKE=make
+fi
+
+if [ -d ".git" ]; then
+ git=yes
+ # Extract tag from git or default to trunk
+ tag=`git branch | grep \* | awk '{print $2}'`
+else
+ git=no
+ # Extract tag from svn or default to trunk
+ tag=`svn info 2> /dev/null | grep ^URL | sed 's/.*\///'`
+ [ -z "$tag" ] && tag=trunk
+ [ "$tag" != "trunk" ] && tag=branches/$tag
+fi
+
 if [ -n "$1" ]; then
-	version="$1"
-	tag="tags/$version"
+  if [ "$1" = "-b" ]; then
+    shift
+    if [ "$git" = "yes" ]; then
+      tag=svn-$1
+    else
+      tag="$1"
+      [ "$tag" != "trunk" ] && tag="branches/$tag"
+    fi
+    branch=yes
+  else
+    version="$1"
+    tag="tags/$version"
+    [ "$git" = "yes" ] && tag=$1
+  fi
 fi
 
 outdir="postgis-$version"
@@ -28,11 +68,18 @@
 	exit 1
 fi
 
-echo "Exporting tag $tag"
-svnurl="http://svn.osgeo.org/postgis/$tag"
-svn export $svnurl "$outdir"
-if [ $? -gt 0 ]; then
-	exit 1
+if [ "$git" = "no" ]; then
+  echo "Exporting tag $tag"
+  svnurl="http://svn.osgeo.org/postgis/$tag"
+  svn export $svnurl "$outdir"
+  if [ $? -gt 0 ]; then
+    exit 1
+  fi
+else
+  git clone -b $tag . $outdir || exit 1
+  #cd $outdir
+  #git checkout $tag || exit 1
+  #cd -
 fi
 
 echo "Removing ignore files, make_dist.sh and HOWTO_RELEASE"
@@ -44,7 +91,7 @@
 owd="$PWD"
 cd "$outdir"
 ./autogen.sh
-./configure
+./configure ${CONFIGURE_ARGS}
 # generating postgis_svn_revision.h for >= 2.0.0 tags 
 if test -f utils/svn_repo_revision.pl; then 
 	echo "Generating postgis_svn_revision.h"
@@ -57,31 +104,36 @@
 echo "Generating documentation"
 owd="$PWD"
 cd "$outdir"/doc
-make comments
+${MAKE} comments
 if [ $? -gt 0 ]; then
 	exit 1
 fi
-make clean # won't drop the comment files
+${MAKE} clean # won't drop the comment files
 cd "$owd"
 
 # Run make distclean
 echo "Running make distclean"
 owd="$PWD"
 cd "$outdir"
-make distclean
+${MAKE} distclean
+if [ "$git" = "yes" ]; then
+  echo "Removing .git dir"
+  rm -rf .git
+fi
 cd "$owd"
 
 # Find a better version name when fetching
 # a development branch
-if test "$tag" = "trunk"; then
+if test "$version" = "dev"; then
   echo "Tweaking version for development snapshot"
-  VMAJ=`grep POSTGIS_MAJOR_VERSION "$outdir"/Version.config | cut -d= -f2`
-  VMIN=`grep POSTGIS_MINOR_VERSION "$outdir"/Version.config | cut -d= -f2`
-  VMIC=`grep POSTGIS_MICRO_VERSION "$outdir"/Version.config | cut -d= -f2`
+  VMAJ=`grep ^POSTGIS_MAJOR_VERSION "$outdir"/Version.config | cut -d= -f2`
+  VMIN=`grep ^POSTGIS_MINOR_VERSION "$outdir"/Version.config | cut -d= -f2`
+  VMIC=`grep ^POSTGIS_MICRO_VERSION "$outdir"/Version.config | cut -d= -f2`
   VREV=`cat "$outdir"/postgis_svn_revision.h | awk '{print $3}'`
   version="${VMAJ}.${VMIN}.${VMIC}-r${VREV}"
   newoutdir=postgis-${version}
-  mv -vi "$outdir" "$newoutdir"
+  rm -rf ${newoutdir}
+  mv -v "$outdir" "$newoutdir"
   outdir=${newoutdir}
 fi
 



More information about the postgis-tickets mailing list