xref: /aosp_15_r20/external/libva/build/gen_version.sh (revision 54e60f844a168e9a219354de272cd517ee8cd4b7)
1*54e60f84SAndroid Build Coastguard Worker# Copyright (c) 2007 Intel Corporation. All Rights Reserved.
2*54e60f84SAndroid Build Coastguard Worker#
3*54e60f84SAndroid Build Coastguard Worker# Permission is hereby granted, free of charge, to any person obtaining a
4*54e60f84SAndroid Build Coastguard Worker# copy of this software and associated documentation files (the
5*54e60f84SAndroid Build Coastguard Worker# "Software"), to deal in the Software without restriction, including
6*54e60f84SAndroid Build Coastguard Worker# without limitation the rights to use, copy, modify, merge, publish,
7*54e60f84SAndroid Build Coastguard Worker# distribute, sub license, and/or sell copies of the Software, and to
8*54e60f84SAndroid Build Coastguard Worker# permit persons to whom the Software is furnished to do so, subject to
9*54e60f84SAndroid Build Coastguard Worker# the following conditions:
10*54e60f84SAndroid Build Coastguard Worker#
11*54e60f84SAndroid Build Coastguard Worker# The above copyright notice and this permission notice (including the
12*54e60f84SAndroid Build Coastguard Worker# next paragraph) shall be included in all copies or substantial portions
13*54e60f84SAndroid Build Coastguard Worker# of the Software.
14*54e60f84SAndroid Build Coastguard Worker#
15*54e60f84SAndroid Build Coastguard Worker# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16*54e60f84SAndroid Build Coastguard Worker# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17*54e60f84SAndroid Build Coastguard Worker# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
18*54e60f84SAndroid Build Coastguard Worker# IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
19*54e60f84SAndroid Build Coastguard Worker# ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
20*54e60f84SAndroid Build Coastguard Worker# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21*54e60f84SAndroid Build Coastguard Worker# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22*54e60f84SAndroid Build Coastguard Worker
23*54e60f84SAndroid Build Coastguard Worker#!/bin/sh
24*54e60f84SAndroid Build Coastguard Worker
25*54e60f84SAndroid Build Coastguard Workerlibva_topdir="$1"
26*54e60f84SAndroid Build Coastguard Workerversion_h_in="$2"
27*54e60f84SAndroid Build Coastguard Worker
28*54e60f84SAndroid Build Coastguard Workerparse_configure_ac() {
29*54e60f84SAndroid Build Coastguard Worker    sed -n "/^m4_define.*${1}.*\[\([0-9]*\)\].*/s//\1/p" ${libva_topdir}/configure.ac
30*54e60f84SAndroid Build Coastguard Worker}
31*54e60f84SAndroid Build Coastguard Worker
32*54e60f84SAndroid Build Coastguard Workerparse_configure() {
33*54e60f84SAndroid Build Coastguard Worker    sed -n "/^${1}=\([0-9]*\)/s//\1/p" ${libva_topdir}/configure
34*54e60f84SAndroid Build Coastguard Worker}
35*54e60f84SAndroid Build Coastguard Worker
36*54e60f84SAndroid Build Coastguard Workerif test -f "${libva_topdir}/configure.ac"; then
37*54e60f84SAndroid Build Coastguard Worker    va_api_major_version=`parse_configure_ac va_api_major_version`
38*54e60f84SAndroid Build Coastguard Worker    va_api_minor_version=`parse_configure_ac va_api_minor_version`
39*54e60f84SAndroid Build Coastguard Worker    va_api_micro_version=`parse_configure_ac va_api_micro_version`
40*54e60f84SAndroid Build Coastguard Workerelif test -f "${libva_topdir}/configure"; then
41*54e60f84SAndroid Build Coastguard Worker    va_api_major_version=`parse_configure VA_API_MAJOR_VERSION`
42*54e60f84SAndroid Build Coastguard Worker    va_api_minor_version=`parse_configure VA_API_MINOR_VERSION`
43*54e60f84SAndroid Build Coastguard Worker    va_api_micro_version=`parse_configure VA_API_MICRO_VERSION`
44*54e60f84SAndroid Build Coastguard Workerelse
45*54e60f84SAndroid Build Coastguard Worker    echo "ERROR: configure or configure.ac file not found in $libva_topdir/"
46*54e60f84SAndroid Build Coastguard Worker    exit 1
47*54e60f84SAndroid Build Coastguard Workerfi
48*54e60f84SAndroid Build Coastguard Workerva_api_version="$va_api_major_version.$va_api_minor_version.$va_api_micro_version"
49*54e60f84SAndroid Build Coastguard Worker
50*54e60f84SAndroid Build Coastguard Workersed -e "s/@VA_API_MAJOR_VERSION@/${va_api_major_version}/" \
51*54e60f84SAndroid Build Coastguard Worker    -e "s/@VA_API_MINOR_VERSION@/${va_api_minor_version}/" \
52*54e60f84SAndroid Build Coastguard Worker    -e "s/@VA_API_MICRO_VERSION@/${va_api_micro_version}/" \
53*54e60f84SAndroid Build Coastguard Worker    -e "s/@VA_API_VERSION@/${va_api_version}/" \
54*54e60f84SAndroid Build Coastguard Worker    $version_h_in
55