-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuildstamp
More file actions
executable file
·32 lines (29 loc) · 818 Bytes
/
buildstamp
File metadata and controls
executable file
·32 lines (29 loc) · 818 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/sh
# generate a build stamp\
exec tclsh8.6 "$0" "$@"
# Usage: buildstamp [-c ID | --fbld ID]
# -c ID outputs C code to define a const char* named ID with the contents of
# the build stamp.
# --fbld ID outputs .fbld defining a tag ID with the value of the build
# stamp.
#
# Otherwise it just outputs the build stamp.
# Outputs a C program that defines the given identifer as a const char* with
# the contents of the build stamp.
set entries [list]
lappend entries [exec date -I]
catch { lappend entries "[exec git describe --always --dirty]" }
set stamp [join $entries ","]
switch -exact [lindex $argv 0] {
-c {
set id [lindex $argv 1]
puts "const char* $id = \"$stamp\";"
}
--fbld {
set id [lindex $argv 1]
puts "@let\[$id\]\[$stamp\] @@"
}
default {
puts $stamp
}
}