summaryrefslogtreecommitdiff
path: root/source/gen_rc.sh
blob: 61400ab64f039952d167009c2b8b78c2b03808c2 (plain)
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
#!/usr/bin/env bash
# ------------------------------------------------------------------------------
# Copyright (C) ST-Ericsson SA 2012
# License terms: 3-clause BSD license
# ------------------------------------------------------------------------------

#-------- Global vars init values -----------

#script version
SCRIPT_VERSION="v1.0"

#printout stream channels
error_channel=/dev/stderr
normal_channel=/dev/stdout
stream_channel=$normal_channel

#current date
DATE=""

#git revision info
VERSION=""

LCD_RC_PATH=out/autogen/outLCDriver.rc
LCM_RC_PATH=out/autogen/outLCM.rc

# ------------------------------INTERNAL FUNCTIONS ----------------------------

function show_err()
{
  cat >> $stream_channel << INLINE_DOC

Syntax ERROR!
Try reading the script help info
$0 --help

INLINE_DOC
}

function get_help()
{
  cat >> $stream_channel << INLINE_DOC
================================ HELP ================================
The purpose of this script is generating resource .rc files
that will be used by the resource compiler in order to
produce compiled resource files .res
This res files will be used by the linker when it will try to embedd
the version info into the executables.

INLINE_DOC
}

function get_init_data()
{
   DATE=`date`
   VERSION=`git describe --tags --always --long`
}

#
#  Loader Communication module
#
function process_lcm()
{
   cat > $LCM_RC_PATH << INLINE_DOC
1 VERSIONINFO
 FILEVERSION 1,0,0,1
 PRODUCTVERSION 1,0,0,1
 FILEFLAGSMASK 0x1fL
#ifdef _DEBUG
 FILEFLAGS 0x9L
#else
 FILEFLAGS 0x8L
#endif
 FILEOS 0x4L
 FILETYPE 0x2L
 FILESUBTYPE 0x0L
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "040904b0"
        BEGIN
INLINE_DOC
echo "            VALUE \"Comments\", \"Build date: $DATE\"" >> $LCM_RC_PATH
cat >> $LCM_RC_PATH << INLINE_DOC
            VALUE "CompanyName", "STEricsson AB"
            VALUE "FileDescription", "LCM Dynamic Link Library"
            VALUE "FileVersion", "1, 0, 0, 1"
            VALUE "InternalName", "Loader Communication Module"
            VALUE "LegalCopyright", "Copyright (C) STEricsson AB 2012"
            VALUE "ProductName", "CXA1104507 Loader Communication Module"
INLINE_DOC
echo "            VALUE \"ProductVersion\", \"$VERSION\"" >> $LCM_RC_PATH
cat >> $LCM_RC_PATH << INLINE_DOC
        END
    END
    BLOCK "VarFileInfo"
    BEGIN
        VALUE "Translation", 0x9, 1200
    END
END

INLINE_DOC

}

#
#  Loader Communication Driver
#
function process_lcd()
{
   cat > $LCD_RC_PATH << INLINE_DOC
1 VERSIONINFO
 FILEVERSION 1,0,0,1
 PRODUCTVERSION 1,0,0,1
 FILEFLAGSMASK 0x1fL
#ifdef _DEBUG
 FILEFLAGS 0x9L
#else
 FILEFLAGS 0x8L
#endif
 FILEOS 0x4L
 FILETYPE 0x2L
 FILESUBTYPE 0x0L
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "000904b0"
        BEGIN
INLINE_DOC
echo "            VALUE \"Comments\", \"Build date: $DATE\"" >> $LCD_RC_PATH
cat >> $LCD_RC_PATH << INLINE_DOC
            VALUE "CompanyName", "STEricsson AB"
            VALUE "FileDescription", "LCDriver Dynamic Link Library"
            VALUE "FileVersion", "1, 0, 0, 1"
            VALUE "InternalName", "Loader Communication Driver"
            VALUE "LegalCopyright", "Copyright (C) STEricsson AB 2012"
            VALUE "ProductName", "CXC 173 0865,  LCDriver DLL"
INLINE_DOC
echo "            VALUE \"ProductVersion\", \"$VERSION\"" >> $LCD_RC_PATH
cat >> $LCD_RC_PATH << INLINE_DOC
        END
    END
    BLOCK "VarFileInfo"
    BEGIN
        VALUE "Translation", 0x9, 1200
    END
END

INLINE_DOC
}

# ------------------------------- main script routine -------------------------
get_init_data
case $1 in

		--lcm)
			echo "Generating LCM.rc file .."
			process_lcm;;
		--lcd)
			echo "Generating LCDriver.rc file."
			process_lcd;;

		-h|?|--help)
			get_help;;
		*)
			stream_channel=$error_channel
			show_err;;
esac