changeset 1520:b5517f47b1f1

Tracking and printing of version numbers (based on a patch by Austin Seipp)
author Adam Chlipala <adam@chlipala.net>
date Tue, 02 Aug 2011 13:33:38 -0400
parents ada582d07ae1
children 001638622c4f
files Makefile.am Makefile.in configure configure.ac src/config.sig src/config.sml.in src/main.mlton.sml
diffstat 7 files changed, 47 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile.am	Sun Jul 24 15:47:09 2011 -0400
+++ b/Makefile.am	Tue Aug 02 13:33:38 2011 -0400
@@ -4,6 +4,7 @@
 LIB      := @LIB@
 INCLUDE  := @INCLUDE@
 SITELISP := @SITELISP@
+VERSION  := @VERSION@
 
 LIB_UR   := $(LIB)/ur
 LIB_C    := $(LIB)/c
@@ -99,7 +100,7 @@
 uninstall-local: uninstall-local-main uninstall-emacs
 
 package:
-	hg archive -t tgz -X tests /tmp/urweb.tgz
+	hg archive -t tgz -X tests "/tmp/urweb-$(VERSION).tgz"
 
 reauto:
 	-autoreconf
--- a/Makefile.in	Sun Jul 24 15:47:09 2011 -0400
+++ b/Makefile.in	Tue Aug 02 13:33:38 2011 -0400
@@ -179,7 +179,7 @@
 SITELISP := @SITELISP@
 SQHEADER = @SQHEADER@
 STRIP = @STRIP@
-VERSION = @VERSION@
+VERSION := @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
@@ -818,7 +818,7 @@
 uninstall-local: uninstall-local-main uninstall-emacs
 
 package:
-	hg archive -t tgz -X tests /tmp/urweb.tgz
+	hg archive -t tgz -X tests "/tmp/urweb-$(VERSION).tgz"
 
 reauto:
 	-autoreconf
--- a/configure	Sun Jul 24 15:47:09 2011 -0400
+++ b/configure	Tue Aug 02 13:33:38 2011 -0400
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.68 for urweb 1.0.
+# Generated by GNU Autoconf 2.68 for urweb 20110715.
 #
 #
 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -567,8 +567,8 @@
 # Identity of this package.
 PACKAGE_NAME='urweb'
 PACKAGE_TARNAME='urweb'
-PACKAGE_VERSION='1.0'
-PACKAGE_STRING='urweb 1.0'
+PACKAGE_VERSION='20110715'
+PACKAGE_STRING='urweb 20110715'
 PACKAGE_BUGREPORT=''
 PACKAGE_URL=''
 
@@ -1301,7 +1301,7 @@
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures urweb 1.0 to adapt to many kinds of systems.
+\`configure' configures urweb 20110715 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1371,7 +1371,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of urweb 1.0:";;
+     short | recursive ) echo "Configuration of urweb 20110715:";;
    esac
   cat <<\_ACEOF
 
@@ -1474,7 +1474,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-urweb configure 1.0
+urweb configure 20110715
 generated by GNU Autoconf 2.68
 
 Copyright (C) 2010 Free Software Foundation, Inc.
@@ -1839,7 +1839,7 @@
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by urweb $as_me 1.0, which was
+It was created by urweb $as_me 20110715, which was
 generated by GNU Autoconf 2.68.  Invocation command line was
 
   $ $0 $@
@@ -2187,6 +2187,7 @@
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
+WORKING_VERSION=1
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -3965,7 +3966,7 @@
 
 # Define the identity of the package.
  PACKAGE='urweb'
- VERSION='1.0'
+ VERSION='20110715'
 
 
 # Some tools Automake needs.
@@ -12175,6 +12176,11 @@
    SQHEADER=sqlite3.h
 fi
 
+if test $WORKING_VERSION = "1"; then
+   VERSION="$VERSION + `hg identify || cat .hg_archival.txt || echo ?`"
+fi
+
+
 
 
 
@@ -12726,7 +12732,7 @@
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by urweb $as_me 1.0, which was
+This file was extended by urweb $as_me 20110715, which was
 generated by GNU Autoconf 2.68.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -12792,7 +12798,7 @@
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-urweb config.status 1.0
+urweb config.status 20110715
 configured by $0, generated by GNU Autoconf 2.68,
   with options \\"\$ac_cs_config\\"
 
@@ -14576,4 +14582,6 @@
   Postgres C header:   PGHEADER       $PGHEADER
   MySQL C header:      MSHEADER       $MSHEADER
   SQLite C header:     SQHEADER       $SQHEADER
+
+  Version:             $VERSION
 EOF
--- a/configure.ac	Sun Jul 24 15:47:09 2011 -0400
+++ b/configure.ac	Tue Aug 02 13:33:38 2011 -0400
@@ -1,4 +1,5 @@
-AC_INIT([urweb], [1.0])
+AC_INIT([urweb], [20110715])
+WORKING_VERSION=1
 AC_USE_SYSTEM_EXTENSIONS
 AM_INIT_AUTOMAKE([-Wall -Werror foreign no-define])
 AC_PROG_CC()
@@ -79,6 +80,10 @@
    SQHEADER=sqlite3.h
 fi
 
+if test [$WORKING_VERSION = "1"]; then
+   VERSION="$VERSION + `hg identify || cat .hg_archival.txt || echo ?`"
+fi
+
 AC_SUBST(CC)
 AC_SUBST(BIN)
 AC_SUBST(LIB)
@@ -88,6 +93,7 @@
 AC_SUBST(PGHEADER)
 AC_SUBST(MSHEADER)
 AC_SUBST(SQHEADER)
+AC_SUBST(VERSION)
 
 AC_CONFIG_FILES([
         Makefile
@@ -109,4 +115,6 @@
   Postgres C header:   PGHEADER       $PGHEADER
   MySQL C header:      MSHEADER       $MSHEADER
   SQLite C header:     SQHEADER       $SQHEADER
+
+  Version:             $VERSION
 EOF
--- a/src/config.sig	Sun Jul 24 15:47:09 2011 -0400
+++ b/src/config.sig	Tue Aug 02 13:33:38 2011 -0400
@@ -15,4 +15,7 @@
     val pgheader : string
     val msheader : string
     val sqheader : string
+
+    val versionNumber : string
+    val versionString : string
 end
--- a/src/config.sml.in	Sun Jul 24 15:47:09 2011 -0400
+++ b/src/config.sml.in	Tue Aug 02 13:33:38 2011 -0400
@@ -20,4 +20,7 @@
 val msheader = "@MSHEADER@"
 val sqheader = "@SQHEADER@"
 
+val versionNumber  = "@VERSION@"
+val versionString  = "The Ur/Web compiler, version " ^ versionNumber
+
 end
--- a/src/main.mlton.sml	Sun Jul 24 15:47:09 2011 -0400
+++ b/src/main.mlton.sml	Tue Aug 02 13:33:38 2011 -0400
@@ -32,9 +32,18 @@
 val tutorial = ref false
 val css = ref false
 
+fun printVersion () = (print (Config.versionString ^ "\n");
+		       OS.Process.exit OS.Process.success)
+fun printNumericVersion () = (print (Config.versionNumber ^ "\n");
+			      OS.Process.exit OS.Process.success)
+
 fun doArgs args =
     case args of
         [] => ()
+      | "-version" :: rest => 
+	printVersion ()
+      | "-numeric-version" :: rest =>
+	printNumericVersion ()
       | "-css" :: rest =>
         (css := true;
          doArgs rest)
@@ -119,7 +128,7 @@
 val job =
     case !sources of
         [file] => file
-      | _ => raise Fail "Zero or multiple job files specified"
+      | _ => printVersion ()
 
 val () =
     case (!css, !demo, !tutorial) of