From d727966ce805067e227fa96262005056fdfac448 Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Tue, 2 Aug 2011 13:33:38 -0400 Subject: Tracking and printing of version numbers (based on a patch by Austin Seipp) --- Makefile.am | 3 ++- Makefile.in | 4 ++-- configure | 28 ++++++++++++++++++---------- configure.ac | 10 +++++++++- src/config.sig | 3 +++ src/config.sml.in | 3 +++ src/main.mlton.sml | 11 ++++++++++- 7 files changed, 47 insertions(+), 15 deletions(-) diff --git a/Makefile.am b/Makefile.am index a700dd3d..45e7d7e0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4,6 +4,7 @@ BIN := @BIN@ LIB := @LIB@ INCLUDE := @INCLUDE@ SITELISP := @SITELISP@ +VERSION := @VERSION@ LIB_UR := $(LIB)/ur LIB_C := $(LIB)/c @@ -99,7 +100,7 @@ uninstall-local-main: 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 diff --git a/Makefile.in b/Makefile.in index 3b195936..c34449d5 100644 --- a/Makefile.in +++ b/Makefile.in @@ -179,7 +179,7 @@ SHELL = @SHELL@ 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-main: 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 diff --git a/configure b/configure index 334e2f2b..75c5110f 100755 --- a/configure +++ b/configure @@ -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 @@ MAKEFLAGS= # 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 @@ if test "$ac_init_help" = "long"; then # 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 @@ fi 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 @@ fi 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 @@ cat >config.log <<_ACEOF 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_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ 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 @@ fi # Define the identity of the package. PACKAGE='urweb' - VERSION='1.0' + VERSION='20110715' # Some tools Automake needs. @@ -12175,6 +12176,11 @@ if test -z $SQHEADER; then SQHEADER=sqlite3.h fi +if test $WORKING_VERSION = "1"; then + VERSION="$VERSION + `hg identify || cat .hg_archival.txt || echo ?`" +fi + + @@ -12726,7 +12732,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # 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 @@ _ACEOF 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 @@ Ur/Web configuration: Postgres C header: PGHEADER $PGHEADER MySQL C header: MSHEADER $MSHEADER SQLite C header: SQHEADER $SQHEADER + + Version: $VERSION EOF diff --git a/configure.ac b/configure.ac index 6103ac62..2cd5f2da 100644 --- a/configure.ac +++ b/configure.ac @@ -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 @@ if test [-z $SQHEADER]; then 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(GCCARGS) AC_SUBST(PGHEADER) AC_SUBST(MSHEADER) AC_SUBST(SQHEADER) +AC_SUBST(VERSION) AC_CONFIG_FILES([ Makefile @@ -109,4 +115,6 @@ Ur/Web configuration: Postgres C header: PGHEADER $PGHEADER MySQL C header: MSHEADER $MSHEADER SQLite C header: SQHEADER $SQHEADER + + Version: $VERSION EOF diff --git a/src/config.sig b/src/config.sig index da26da2f..98455a3c 100644 --- a/src/config.sig +++ b/src/config.sig @@ -15,4 +15,7 @@ signature CONFIG = sig val pgheader : string val msheader : string val sqheader : string + + val versionNumber : string + val versionString : string end diff --git a/src/config.sml.in b/src/config.sml.in index 3fc492ab..bb5648c9 100644 --- a/src/config.sml.in +++ b/src/config.sml.in @@ -20,4 +20,7 @@ val pgheader = "@PGHEADER@" val msheader = "@MSHEADER@" val sqheader = "@SQHEADER@" +val versionNumber = "@VERSION@" +val versionString = "The Ur/Web compiler, version " ^ versionNumber + end diff --git a/src/main.mlton.sml b/src/main.mlton.sml index 0c6f96ba..c26a9d10 100644 --- a/src/main.mlton.sml +++ b/src/main.mlton.sml @@ -32,9 +32,18 @@ val demo = ref (NONE : (string * bool) option) 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 () = doArgs (CommandLine.arguments ()) val job = case !sources of [file] => file - | _ => raise Fail "Zero or multiple job files specified" + | _ => printVersion () val () = case (!css, !demo, !tutorial) of -- cgit v1.2.3