From fa7907d256b6896ec2cb96303340653af9732f8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=2E=20Andrei=20M=C4=83ce=C8=99?= Date: Sun, 25 Dec 2016 17:12:04 -0500 Subject: SGX-BIN: build: android: Add fallback PLATFORM_VERSION mechanism When build.prop doesn't exist (pretty much the case always), have a fallback by extracting the needed platform variable from build/core/ version_defaults.mk. This is necessary since this build information doesn't permeate here, and we would like to avoid re-including the whole core makefile. Change-Id: Ia98e0a4e6b060ad8ace8b947e6c93741a875c05d --- .../linux2/common/android/platform_version.mk | 26 ++++++++++++++++------ 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/pvr-source/eurasiacon/build/linux2/common/android/platform_version.mk b/pvr-source/eurasiacon/build/linux2/common/android/platform_version.mk index 698efa3..28f1a80 100644 --- a/pvr-source/eurasiacon/build/linux2/common/android/platform_version.mk +++ b/pvr-source/eurasiacon/build/linux2/common/android/platform_version.mk @@ -40,13 +40,25 @@ # Figure out the version of Android we're building against. # -PLATFORM_VERSION := $(shell \ - if [ -f $(TARGET_ROOT)/product/$(TARGET_PRODUCT)/system/build.prop ]; then \ - cat $(TARGET_ROOT)/product/$(TARGET_PRODUCT)/system/build.prop | \ - grep ^ro.build.version.release | cut -f2 -d'=' | cut -f1 -d'-'; \ - else \ - echo 4.0.3; \ - fi) +BUILD_PROP := $(ANDROID_PRODUCT_OUT)/system/build.prop +ifeq ($(wildcard $(BUILD_PROP)),) +$(warning *** No device prop file ($(BUILD_PROP)). Extracting from \ + build/core/version_defaults.mk) +# Android version information doesn't permeate here. Set it up manually, +# but avoid including the whole of core/version_defaults.mk +$(eval $(shell cat $(ANDROID_BUILD_TOP)/build/core/version_defaults.mk |\ + grep 'PLATFORM_VERSION\s.*=')) +else +# Extract version.release from the build.prop file. If it's not in the build.prop, +# the Make variables won't be defined, and fallback handling will take place. +# +# $(eval $(shell cat $(BUILD_PROP) | grep '^ro.build.version.release=' | \ +# sed -e 's,ro.build.version.release,PLATFORM_VERSION,')) +PLATFORM_VERSION := $(shell grep '^ro.build.version.release=' \ + $(BUILD_PROP) | cut -f2 -d'=' | cut -f1 -d'-') +endif + +$(info PLATFORM_VERSION=$(PLATFORM_VERSION)) define version-starts-with $(shell echo $(PLATFORM_VERSION) | grep -q ^$(1); \ -- cgit v1.1