File: getBuildInfo.awk

package info (click to toggle)
oscar 1.5.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 27,500 kB
  • sloc: cpp: 80,911; ansic: 6,910; python: 1,727; sh: 1,044; xml: 150; javascript: 74; makefile: 34; awk: 18
file content (35 lines) | stat: -rw-r--r-- 1,371 bytes parent folder | download | duplicates (3)
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
33
34
35
#
# awk script to extract build identification from build_number.h, git_info.h, and version.h
# for use by Inno Setup in building installation file for OSCAR.  See DEPLOY.BAT for information.
#
# Usage: gawk -f getBuildInfo.awk build_number.h >buildInfo.iss
#        gawk -f getBuildInfo.awk git_info.h >>buildInfo.iss
#        gawk -f getBuildInfo.awk version.h >>buildInfo.iss
#        echo %cd% | gawk -f %sourcedir%getBuildInfo.awk >>buildInfo.iss

/#define GIT_BRANCH / { print "#define MyGitBranch", $3 }
/#define GIT_REVISION / { print "#define MyGitRevision", $3 }
/#define GIT_TAG / { print "#define MyGitTag", $3 }

/#define VERSION / {
    version = $3
    print "#define MyAppVersion", version

    split(version, v, "[.-]")
    status = v[4] ? v[4] : "r"
    print "#define MyReleaseStatus \"" status "\""
    
    split("alpha beta gamma rc r", parts, " ")
    for (i=1; i <= length(parts); i++) dict[parts[i]]=i
    build = dict[status]
    print "#define MyBuildNumber \"" (build * 100) "\""

    # strip any trailing quote (only happens for a release build)
    sub("\"","",v[3])

    # v[1] already includes a leading quote mark
    print "#define MyVersionNumbers " v[1] "." v[2] "." v[3] "." (build * 100) "\""
}

/32.*bit/ { print "#define MyPlatform \"Win32\"" }
/64.*bit/ { print "#define MyPlatform \"Win64\"" }