From df0fa603d091eb92e9ce7d2be969ae78a11057e2 Mon Sep 17 00:00:00 2001 From: Graydon Hoare Date: Sat, 3 Jul 2010 00:27:33 -0700 Subject: [PATCH] Add version-stamp machinery (and put "Draft + datestamp" into doc footer). --- doc/Makefile | 8 ++++++-- doc/rust.texi | 21 ++++++++++++++++++++- src/Makefile | 16 +++++++++++----- src/boot/driver/main.ml | 7 +++++++ src/boot/me/dwarf.ml | 2 +- 5 files changed, 45 insertions(+), 9 deletions(-) diff --git a/doc/Makefile b/doc/Makefile index 081a723b9d6..8e07a9a19f0 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -1,10 +1,14 @@ all: rust.pdf rust.html -%.pdf: %.texi +version.texi: Makefile + git log -1 \ + --format='@macro gitversion%n%h %ci%n@end macro%n' >$@ + +%.pdf: %.texi version.texi texi2pdf $< -%.html: %.texi +%.html: %.texi version.texi makeinfo --html --ifhtml --force --no-split --output=$@ $< clean: diff --git a/doc/rust.texi b/doc/rust.texi index c36a099babc..0f0a0f446f8 100644 --- a/doc/rust.texi +++ b/doc/rust.texi @@ -6,15 +6,23 @@ @c %**end of header @syncodeindex fn cp +@include version.texi @ifinfo This manual is for the ``Rust'' programming language. + +@uref{http://github.com/graydon/rust} + +Version: @gitversion + + Copyright 2006-2010 Graydon Hoare Copyright 2009-2010 Mozilla Foundation -All rights reserved (for the time being). +See accompanying LICENSE.txt for terms. + @end ifinfo @dircategory Programming @@ -30,13 +38,24 @@ All rights reserved (for the time being). @page @vskip 0pt plus 1filll + + +@uref{http://github.com/graydon/rust} + +Version: @gitversion + +@sp 2 + Copyright @copyright{} 2006-2010 Graydon Hoare Copyright @copyright{} 2009-2010 Mozilla Foundation See accompanying LICENSE.txt for terms. + @end titlepage +@everyfooting @| @emph{-- Draft @today --} @| + @ifnottex @node Top @top Top diff --git a/src/Makefile b/src/Makefile index fa02a2a228a..93cb0b11af5 100644 --- a/src/Makefile +++ b/src/Makefile @@ -209,7 +209,7 @@ endif # List them in link order. # Nobody calculates the link-order DAG automatically, sadly. -UTIL_BOT_MLS := $(addprefix boot/util/, fmt.ml common.ml bits.ml) +UTIL_BOT_MLS := $(addprefix boot/util/, version.ml fmt.ml common.ml bits.ml) DRIVER_BOT_MLS := $(addprefix boot/driver/, session.ml) BE_MLS := $(addprefix boot/be/, x86.ml ra.ml pe.ml elf.ml \ macho.ml) @@ -256,10 +256,16 @@ STDLIB_INPUTS := $(wildcard lib/*.rc lib/*.rs lib/*/*.rs) COMPILER_CRATE := comp/rustc.rc COMPILER_INPUTS := $(wildcard comp/*.rc comp/*.rs comp/*/*.rs) -all: $(CFG_COMPILER) $(MKFILES) boot/fe/lexer.ml +GENERATED := boot/fe/lexer.ml boot/util/version.ml + +all: $(CFG_COMPILER) $(MKFILES) $(GENERATED) + +boot/util/version.ml: Makefile + $(CFG_QUIET)git log -1 \ + --format='let version = "prerelease (%h %ci)";;' >$@ loc: - wc -l $(BOOT_MLS) $(RUNTIME_CS) $(RUNTIME_HDR) + $(CFG_QUIET)wc -l $(BOOT_MLS) $(RUNTIME_CS) $(RUNTIME_HDR) $(CFG_RUNTIME): $(RUNTIME_OBJS) $(MKFILES) $(RUNTIME_HDR) @$(call CFG_ECHO, compile: $<) @@ -742,7 +748,7 @@ tidy: $(CFG_QUIET) python etc/tidy.py \ $(wildcard ../*.txt) \ ../README \ - $(filter-out boot/fe/lexer.ml $(PKG_3RDPARTY), $(PKG_FILES)) + $(filter-out $(GENERATED) $(PKG_3RDPARTY), $(PKG_FILES)) clean: @$(call CFG_ECHO, cleaning) @@ -750,7 +756,7 @@ clean: $(CFG_QUIET)rm -f $(BOOT_CMOS) $(BOOT_CMIS) $(BOOT_CMXS) $(BOOT_OBJS) $(CFG_QUIET)rm -f $(CFG_COMPILER) $(CFG_QUIET)rm -f $(ML_DEPFILES) $(C_DEPFILES) $(CRATE_DEPFILES) - $(CFG_QUIET)rm -f boot/fe/lexer.ml + $(CFG_QUIET)rm -f $(GENERATED) $(CFG_QUIET)rm -f $(CFG_BOOT) $(CFG_RUNTIME) $(CFG_STDLIB) $(CFG_QUIET)rm -f $(TEST_RPASS_EXES_X86) $(TEST_RPASS_OUTS_X86) $(CFG_QUIET)rm -f $(TEST_RPASS_EXES_LLVM) $(TEST_RPASS_OUTS_LLVM) diff --git a/src/boot/driver/main.ml b/src/boot/driver/main.ml index 5655604d3f2..9cb068efe06 100644 --- a/src/boot/driver/main.ml +++ b/src/boot/driver/main.ml @@ -118,6 +118,11 @@ let dump_meta (filename:filename) : unit = exit 0 ;; +let print_version _ = + Printf.fprintf stdout "rustboot %s\n" Version.version; + exit 0; +;; + let flag f opt desc = (opt, Arg.Unit f, desc) ;; @@ -206,6 +211,8 @@ let argspecs = "report metadata from DWARF info in compiled file, then exit"); ("-rdeps", Arg.Unit (fun _ -> sess.Session.sess_report_deps <- true), "report dependencies of input, then exit"); + ("-version", Arg.Unit (fun _ -> print_version()), + "print version information, then exit"); ] @ (Glue.alt_argspecs sess) ;; diff --git a/src/boot/me/dwarf.ml b/src/boot/me/dwarf.ml index 5fd8638f4a5..a568db417bd 100644 --- a/src/boot/me/dwarf.ml +++ b/src/boot/me/dwarf.ml @@ -2238,7 +2238,7 @@ let dwarf_visitor (SEQ [| uleb abbrev_code; (* DW_AT_producer: DW_FORM_string *) - ZSTRING "Rustboot pre-release"; + ZSTRING ("Rustboot " ^ Version.version); (* DW_AT_language: DW_FORM_data4 *) WORD (word_ty_mach, IMM 0x2L); (* DW_LANG_C *) (* DW_AT_name: DW_FORM_string *)