Blame build/nw_ver.awk

Packit 90a5c9
# Licensed to the Apache Software Foundation (ASF) under one or more
Packit 90a5c9
# contributor license agreements.  See the NOTICE file distributed with
Packit 90a5c9
# this work for additional information regarding copyright ownership.
Packit 90a5c9
# The ASF licenses this file to You under the Apache License, Version 2.0
Packit 90a5c9
# (the "License"); you may not use this file except in compliance with
Packit 90a5c9
# the License.  You may obtain a copy of the License at
Packit 90a5c9
#
Packit 90a5c9
#     http://www.apache.org/licenses/LICENSE-2.0
Packit 90a5c9
#
Packit 90a5c9
# Unless required by applicable law or agreed to in writing, software
Packit 90a5c9
# distributed under the License is distributed on an "AS IS" BASIS,
Packit 90a5c9
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Packit 90a5c9
# See the License for the specific language governing permissions and
Packit 90a5c9
# limitations under the License.
Packit 90a5c9
Packit 90a5c9
BEGIN {
Packit 90a5c9
  # fetch Apache version numbers from input file and write them to STDOUT
Packit 90a5c9
Packit 90a5c9
  while ((getline < ARGV[1]) > 0) {
Packit 90a5c9
    if (match ($0, /^#define AP_SERVER_COPYRIGHT \\/)) {
Packit 90a5c9
      if (((getline < ARGV[1]) > 0) && (split($0, c, "\"") == 3)) {
Packit 90a5c9
        copyright_str = c[2];
Packit 90a5c9
      }
Packit 90a5c9
    }
Packit 90a5c9
    else if (match ($0, /^#define AP_SERVER_MAJORVERSION_NUMBER /)) {
Packit 90a5c9
      ver_major = $3;
Packit 90a5c9
    }
Packit 90a5c9
    else if (match ($0, /^#define AP_SERVER_MINORVERSION_NUMBER /)) {
Packit 90a5c9
      ver_minor = $3;
Packit 90a5c9
    }
Packit 90a5c9
    else if (match ($0, /^#define AP_SERVER_PATCHLEVEL_NUMBER/)) {
Packit 90a5c9
      ver_patch = $3;
Packit 90a5c9
    }
Packit 90a5c9
    else if (match ($0, /^#define AP_SERVER_DEVBUILD_BOOLEAN/)) {
Packit 90a5c9
      ver_devbuild = $3;
Packit 90a5c9
    }
Packit 90a5c9
  }
Packit 90a5c9
Packit 90a5c9
  if (ver_devbuild) {
Packit 90a5c9
    ver_dev = "-dev"
Packit 90a5c9
    if (ARGV[2]) {
Packit 90a5c9
      while ((getline < ARGV[2]) > 0) {
Packit 90a5c9
        if (match ($0, /^\/repos\/asf\/!svn\/ver\/[0-9]+\/httpd\/httpd\/(trunk|branches\/[0-9]\.[0-9]\.x)$/)) {
Packit 90a5c9
          gsub(/^\/repos\/asf\/!svn\/ver\/|\/httpd\/httpd\/(trunk|branches\/[0-9]\.[0-9]\.x)$/, "", $0)
Packit 90a5c9
          ver_dev = svn_rev = "-r" $0
Packit 90a5c9
        }
Packit 90a5c9
      }
Packit 90a5c9
    }
Packit 90a5c9
  }
Packit 90a5c9
Packit 90a5c9
  ver_nlm = ver_major "," ver_minor "," ver_patch;
Packit 90a5c9
  ver_str = ver_major "." ver_minor "." ver_patch ver_dev;
Packit 90a5c9
Packit 90a5c9
  print "VERSION = " ver_nlm "";
Packit 90a5c9
  print "VERSION_STR = " ver_str "";
Packit 90a5c9
  print "VERSION_MAJMIN = " ver_major ver_minor "";
Packit 90a5c9
  print "COPYRIGHT_STR = " copyright_str "";
Packit 90a5c9
  print "SVN_REVISION = " svn_rev "";
Packit 90a5c9
Packit 90a5c9
}
Packit 90a5c9
Packit 90a5c9