• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2# Copyright (C) 2017 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#      http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16if [[ $# -ne 1 ]]; then
17  echo "Usage: gen_wayland_version_header.sh <path_to_configure.ac>\
18    < wayland_version.h.in > wayland_version.h" >&2
19  exit 1
20fi
21
22set -e
23CONFIGURE_AC="$1"
24WAYLAND_VERSION_MAJOR="$(grep -o -E 'define..wayland_major_version.+' ${CONFIGURE_AC} | grep -o -E '[0-9]+')"
25WAYLAND_VERSION_MINOR="$(grep -o -E 'define..wayland_minor_version.+' ${CONFIGURE_AC} | grep -o -E '[0-9]+')"
26WAYLAND_VERSION_MICRO="$(grep -o -E 'define..wayland_micro_version.+' ${CONFIGURE_AC} | grep -o -E '[0-9]+')"
27WAYLAND_VERSION="${WAYLAND_VERSION_MAJOR}.${WAYLAND_VERSION_MINOR}.${WAYLAND_VERSION_MICRO}" ; \
28sed \
29  -e s/@WAYLAND_VERSION_MAJOR@/${WAYLAND_VERSION_MAJOR}/ \
30  -e s/@WAYLAND_VERSION_MINOR@/${WAYLAND_VERSION_MINOR}/ \
31  -e s/@WAYLAND_VERSION_MICRO@/${WAYLAND_VERSION_MICRO}/ \
32  -e s/@WAYLAND_VERSION_MICRO@/${WAYLAND_VERSION_MICRO}/ \
33  -e s/@WAYLAND_VERSION@/${WAYLAND_VERSION}/
34