From 68c5f603d868707488184146801b0d87782f0161 Mon Sep 17 00:00:00 2001 From: Gwenole Beauchesne Date: Fri, 29 Oct 2010 11:35:50 +0200 Subject: [PATCH] Android: try to auto generate --- build/gen_version.sh | 32 ++++++++++++++++++++++++++++++++ va/Android.mk | 11 ++++++++++- 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 build/gen_version.sh diff --git a/build/gen_version.sh b/build/gen_version.sh new file mode 100644 index 0000000..dd01d95 --- /dev/null +++ b/build/gen_version.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +libva_topdir="$1" +version_h_in="$2" + +parse_configure_ac() { + sed -n "/^m4_define.*${1}.*\[\([0-9]*\)\].*/s//\1/p" ${libva_topdir}/configure.ac +} + +parse_configure() { + sed -n "/^${1}=\([0-9]*\)/s//\1/p" ${libva_topdir}/configure +} + +if test -f "${libva_topdir}/configure.ac"; then + libva_major_version=`parse_configure_ac libva_major_version` + libva_minor_version=`parse_configure_ac libva_minor_version` + libva_micro_version=`parse_configure_ac libva_micro_version` +elif test -f "${libva_topdir}/configure"; then + libva_major_version=`parse_configure LIBVA_MAJOR_VERSION` + libva_minor_version=`parse_configure LIBVA_MINOR_VERSION` + libva_micro_version=`parse_configure LIBVA_MICRO_VERSION` +else + echo "ERROR: configure or configure.ac file not found in $libva_topdir/" + exit 1 +fi +libva_version="$libva_major_version.$libva_minor_version.$libva_micro_version" + +sed -e "s/@LIBVA_MAJOR_VERSION@/${libva_major_version}/" \ + -e "s/@LIBVA_MINOR_VERSION@/${libva_minor_version}/" \ + -e "s/@LIBVA_MICRO_VERSION@/${libva_micro_version}/" \ + -e "s/@LIBVA_VERSION@/${libva_version}/" \ + $version_h_in diff --git a/va/Android.mk b/va/Android.mk index 494f7c7..d795c38 100644 --- a/va/Android.mk +++ b/va/Android.mk @@ -13,7 +13,16 @@ include $(CLEAR_VARS) LOCAL_SRC_FILES := \ va.c \ va_trace.c \ - va_fool.c + va_fool.c + +intermediates := $(local-intermediates-dir) +GEN := $(intermediates)/va_version.h +$(GEN): PRIVATE_GEN_VERSION := $(LOCAL_PATH)/../build/gen_version.sh +$(GEN): PRIVATE_INPUT_FILE := $(LOCAL_PATH)/va_version.h.in +$(GEN): PRIVATE_CUSTOM_TOOL = sh $(PRIVATE_GEN_VERSION) $(LOCAL_PATH)/.. $(PRIVATE_INPUT_FILE) > $@ +$(GEN): $(LOCAL_PATH)/va_version.h $(PRIVATE_GEN_VERSION) + $(transform-generated-source) +LOCAL_GENERATED_SOURCES += $(GEN) LOCAL_CFLAGS += \ -DANDROID \ -- 2.7.4