update credits
[LibreOffice.git] / solenv / bin / getcompver.awk
blob6744c4dc5c7cee5d518c475ef2c0af485bf7ea64
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 if (match($0, /[0-9]+\.[0-9]+\.[0-9]+/)) {
44 CCversion = substr($0, RSTART, RLENGTH)
45 } else if (match($0, /[0-9]+\.[0-9]+/)) {
46 CCversion = substr($0, RSTART, RLENGTH) "."
47 } else if (match($0, /[0-9]+/)) {
48 CCversion = substr($0, RSTART, RLENGTH) ".."
51 /^[0-9]*[.][0-9]*\r*$/ {
52 if ( compiler_matched == 0 ) {
53 # need to blow to x.xx.xx for comparing
54 CCversion = $0 ".0"
57 /^[0-9]*[.][0-9]*[.][0-9]*\r*$/ {
58 if ( compiler_matched == 0 ) {
59 CCversion = $0
62 /^[0-9]*[.][0-9]*[.][0-9]*-[0-9a-z]*$/ {
63 if ( compiler_matched == 0 ) {
64 CCversion = substr($0, 0, index($0, "-") - 1)
67 # NDK r8b has "4.6.x-google"
68 /^[0-9]*[.][0-9]*[.][a-z]*-[0-9a-z]*$/ {
69 if ( compiler_matched == 0 ) {
70 # Include the second period in the match so that
71 # we will get a micro version of zero
72 x = match( $0, /^[0-9]*[.][0-9]*[.]/ )
73 CCversion = substr($0, RSTART, RLENGTH)
76 END {
77 if ( num == "true" ) {
78 tokencount = split (CCversion,vertoken,".")
79 for ( i = 1 ; i <= tokencount ; i++ ) {
80 printf ("%04d",vertoken[i] )
82 } else
83 print CCversion