From: Adam Dickmeiss Date: Tue, 18 Nov 2008 08:27:13 +0000 (+0100) Subject: Added script to auto-generate version-info on Windows. X-Git-Tag: v3.0.40~48 X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=32e16c37ce5b2d1ed0b3e6edfb48fd5ae1ec24b3;p=yaz-moved-to-github.git Added script to auto-generate version-info on Windows. --- diff --git a/src/Makefile.am b/src/Makefile.am index 354e49d..b27f1fe 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -18,7 +18,7 @@ illdata_DATA=ill9702.asn item-req.asn ill.tcl oclc-ill-req-ext.asn EXTRA_DIST=$(tabdata_DATA) $(illdata_DATA) \ charconv.tcl codetables.xml codetables-iso5426.xml \ csvtodiag.tcl csvtobib1.tcl csvtosrw.tcl bib1.csv srw.csv \ - csvtosru_update.tcl sru_update.csv \ + csvtosru_update.tcl sru_update.csv mk_version.tcl \ oidtoc.tcl oid.csv sc_test.c YAZCOMP=$(top_srcdir)/util/yaz-asncomp diff --git a/src/mk_version.tcl b/src/mk_version.tcl new file mode 100644 index 0000000..160a918 --- /dev/null +++ b/src/mk_version.tcl @@ -0,0 +1,76 @@ +#!/usr/bin/tclsh + +proc usage {} { + puts {mk_version.tcl [-v] configure.ac infile ..} + exit 1 +} + +set verbose 0 +set l [llength $argv] +set i 0 +while {$i < $l} { + set arg [lindex $argv $i] + switch -glob -- $arg { + -v { + incr verbose + } + default { + if {![info exists conffile]} { + set conffile $arg + } else { + lappend infiles $arg + } + } + } + incr i +} +if {![info exists infiles]} { + puts "mk_version.tcl: missing input file(s)" + usage +} + +set f [open $conffile r] +while {1} { + set cnt [gets $f line] + if {$cnt < 0} { + break + } + regexp {AC_INIT\([^,]+,\[([0-9.]+)\]} $line s version +} +close $f + +set maps(VERSION) $version + +set c [split $version .] + +set versionl [expr ([lindex $c 0] * 256 + [lindex $c 1]) * 256 + [lindex $c 2]] +set maps(YAZ_VERSION_HEX) [format %x $versionl] + +if {[llength $c] == 3} { + lappend c 1 +} +set maps(WIN_FILEVERSION) [join $c ,] + +set maps(VERSION_SHA1) {} + +foreach x [array names maps] { + puts "$x=$maps($x)" +} + +foreach ifile $infiles { + set if [open "${ifile}.in" r] + set of [open "${ifile}" w] + + while {1} { + set cnt [gets $if line] + if {$cnt < 0} { + break + } + foreach x [array names maps] { + regsub -all "@$x@" $line $maps($x) line + } + puts $of $line + } + close $if + close $of +}