Update changelog
[platform/upstream/gettext.git] / windows / windres-options
1 #!/bin/sh
2 # Usage: windres-options [--escape] PACKAGE_VERSION
3 # Outputs a set of command-line options for 'windres', containing definitions
4 # for the preprocessor variables
5 #   PACKAGE_VERSION_STRING
6 #   PACKAGE_VERSION_MAJOR
7 #   PACKAGE_VERSION_MINOR
8 #   PACKAGE_VERSION_SUBMINOR
9
10 escape=
11 if test "$1" = "--escape"; then
12   escape=yes
13   shift
14 fi
15 version="$1" # something like 2.0 or 2.17 or 2.17.3 or 2.17.3-pre3
16
17 sed_extract_major='/^[0-9]/{
18 s/^\([0-9]*\).*/\1/p
19 q
20 }
21 c\
22 0
23 q
24 '
25 sed_extract_minor='/^[0-9][0-9]*[.][0-9]/{
26 s/^[0-9]*[.]\([0-9]*\).*/\1/p
27 q
28 }
29 c\
30 0
31 q
32 '
33 sed_extract_subminor='/^[0-9][0-9]*[.][0-9][0-9]*[.][0-9]/{
34 s/^[0-9]*[.][0-9]*[.]\([0-9]*\).*/\1/p
35 q
36 }
37 c\
38 0
39 q
40 '
41
42 {
43   echo "-DPACKAGE_VERSION_STRING=\"${version}\""
44   echo "-DPACKAGE_VERSION_MAJOR="`echo "${version}" | sed -n -e "$sed_extract_major"`
45   echo "-DPACKAGE_VERSION_MINOR="`echo "${version}" | sed -n -e "$sed_extract_minor"`
46   echo "-DPACKAGE_VERSION_SUBMINOR="`echo "${version}" | sed -n -e "$sed_extract_subminor"`
47 } |
48 {
49   if test -n "$escape"; then
50     sed -e 's,\(["\\]\),\\\1,g'
51   else
52     cat
53   fi
54 }