bump product version to 5.0.4.1
[LibreOffice.git] / solenv / bin / getcompver.awk
blobae08f4e21790f4e3838c5e6c5f44445d2ea2924f
2 # This file is part of the LibreOffice project.
4 # This Source Code Form is subject to the terms of the Mozilla Public
5 # License, v. 2.0. If a copy of the MPL was not distributed with this
6 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 # This file incorporates work covered by the following license notice:
10 # Licensed to the Apache Software Foundation (ASF) under one or more
11 # contributor license agreements. See the NOTICE file distributed
12 # with this work for additional information regarding copyright
13 # ownership. The ASF licenses this file to you under the Apache
14 # License, Version 2.0 (the "License"); you may not use this file
15 # except in compliance with the License. You may obtain a copy of
16 # the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 BEGIN {
19 CCversion = 0
20 compiler_matched = 0
22 # Sun c++ compiler
23 /Sun WorkShop/ || /Forte Developer/ || /Sun/{
24 compiler_matched = 1
25 # version number right after "C++"
26 x = match( $0, /C\+\+ .*/ )
27 btwn = substr( $0, RSTART, RLENGTH)
28 # extract version, whitespaces get striped later
29 x = match( btwn, / .*\..*[ $\t]/)
30 CCversion = substr( btwn, RSTART, RLENGTH)
32 # Microsoft c++ compiler
33 /Microsoft/ && /..\...\...../ {
34 compiler_matched = 1
35 # match on the format of the ms versions ( dd.dd.dddd )
36 x = match( $0, /..\...\...../ )
37 CCversion = substr( $0, RSTART, RLENGTH)
39 # Java
40 /java version/ || /openjdk version/ {
41 compiler_matched = 1
42 # match on the format of the java versions ( d[d].d[d].d[d] )
43 x = match( $0, /[0-9]*\.[0-9]*\.[0-9]*/ )
44 CCversion = substr( $0, RSTART, RLENGTH)
46 /^[0-9]*[.][0-9]*\r*$/ {
47 if ( compiler_matched == 0 ) {
48 # need to blow to x.xx.xx for comparing
49 CCversion = $0 ".0"
52 /^[0-9]*[.][0-9]*[.][0-9]*\r*$/ {
53 if ( compiler_matched == 0 ) {
54 CCversion = $0
57 /^[0-9]*[.][0-9]*[.][0-9]*-[0-9a-z]*$/ {
58 if ( compiler_matched == 0 ) {
59 CCversion = substr($0, 0, index($0, "-") - 1)
62 # NDK r8b has "4.6.x-google"
63 /^[0-9]*[.][0-9]*[.][a-z]*-[0-9a-z]*$/ {
64 if ( compiler_matched == 0 ) {
65 # Include the second period in the match so that
66 # we will get a micro version of zero
67 x = match( $0, /^[0-9]*[.][0-9]*[.]/ )
68 CCversion = substr($0, RSTART, RLENGTH)
71 END {
72 if ( num == "true" ) {
73 tokencount = split (CCversion,vertoken,".")
74 for ( i = 1 ; i <= tokencount ; i++ ) {
75 printf ("%04d",vertoken[i] )
77 } else
78 print CCversion