opengapps/aosp_build

Could not solve api level

Closed this issue · 15 comments

tuccy commented

Hi all im triying build them into custom device, my surprise are that libraries are all into subdir and these could not be solved by api lvl when lauch build sistem try to copy libs from sources/arm/lib/(lib_name) but rigth path is under sources/arm/lib/(api level)/(libname), can some one check these issue thanks, regards.

tuccy commented

for more info these is produced in the build id LMY48W for android 5.1 i think that api lvl 22

tuccy commented

these can be solved inside vendor/google/build/modules/androidproducts.mk

I have changed the location of the libs in the sources directory some time ago.
I think @Blystad should take a look at the new lib and app finding code at:
https://github.com/opengapps/opengapps/blob/master/scripts/inc.buildhelper.sh#L205
https://github.com/opengapps/opengapps/blob/master/scripts/inc.buildhelper.sh#L159

tuccy commented

oh thanks but in any case opengapps/aosp_build need to be adapted for these directory changes, at last i try to do it using my own makefile with androidTV barnch thanks you so much

acr92 commented

I'm more than open for pull requests fixing the issue. Otherwise I might
get some time during the weekend to look into this.

Thanks for reporting.

On Wed, 6 Jan 2016, 22:39 Emilio notifications@github.com wrote:

oh thanks but in any case opengapps/aosp_build need to be adapted for
these directory changes, at last i try to do it using my own makefile with
androidTV barnch thanks you so much


Reply to this email directly or view it on GitHub
#9 (comment).

tuccy commented

you can try something like these sugested solution
NEW device variable
GAPPS_MAX_API_LEVEL := 22

google/build/core/definitions.mk
ADD
define get-max-api-level
$(strip
$(if $(filter $(1),19),19)
$(if $(filter $(1),20),19 20)
$(if $(filter $(1),21),19 20 21)
$(if $(filter $(1),22),19 20 21 22)
$(if $(filter $(1),23),19 20 21 22 23)
)
endef

google/build/config.mk
ADD
ifeq ($(GAPPS_MAX_API_LEVEL),)
$(error GAPPS_MAX_API_LEVEL must be configured)
endif
GAPPS_MAX_API_LEVEL_EVAL := $(call get-max-api-level,$(GAPPS_MAX_API_LEVEL))
ifeq ($(GAPPS_MAX_API_LEVEL_EVAL),)
$(error GAPPS_MAX_API_LEVEL_EVAL $(GAPPS_MAX_API_LEVEL) was not found. Use of one of 19,20,21,22,23)
endif
TARGET_GAPPS_MAX_API_LEVEL := $(GAPPS_MAX_API_LEVEL)

google/build/modules/AndroidProducts.mk
DELETE OLD LIB REFERENCES
ADD
ifneq ($(filter $(TARGET_GAPPS_MAX_API_LEVEL),19),)
ifneq ($(filter $(TARGET_GAPPS_MAX_API_LEVEL),20),)
ifneq ($(filter $(TARGET_GAPPS_MAX_API_LEVEL),21),)
ifneq ($(filter $(TARGET_GAPPS_MAX_API_LEVEL),22),)
#api level at least 23
PRODUCT_COPY_FILES += vendor/opengapps/sources/arm/lib/23/libfacelock_jni.so:system/lib/libfacelock_jni.so
PRODUCT_COPY_FILES += vendor/opengapps/sources/arm/lib/23/libfilterpack_facedetect.so:system/lib/libfilterpack_facedetect.so
PRODUCT_COPY_FILES += vendor/opengapps/sources/arm/lib/23/libjni_keyboarddecoder.so:system/lib/libjni_keyboarddecoder.so
PRODUCT_COPY_FILES += vendor/opengapps/sources/arm/lib/23/libjni_latinimegoogle.so:system/lib/libjni_latinimegoogle.so
PRODUCT_COPY_FILES += vendor/opengapps/sources/arm/vendor/lib/23/libfrsdk.so:system/vendor/lib/libfrsdk.so
else #api level at least 22
PRODUCT_COPY_FILES += vendor/opengapps/sources/arm/lib/22/libfacelock_jni.so:system/lib/libfacelock_jni.so
PRODUCT_COPY_FILES += vendor/opengapps/sources/arm/lib/21/libfilterpack_facedetect.so:system/lib/libfilterpack_facedetect.so
PRODUCT_COPY_FILES += vendor/opengapps/sources/arm/lib/22/libjni_latinimegoogle.so:system/lib/libjni_latinimegoogle.so
PRODUCT_COPY_FILES += vendor/opengapps/sources/arm/vendor/lib/21/libfrsdk.so:system/vendor/lib/libfrsdk.so
endif
else #api level at least 21
PRODUCT_COPY_FILES += vendor/opengapps/sources/arm/lib/21/libfacelock_jni.so:system/lib/libfacelock_jni.so
PRODUCT_COPY_FILES += vendor/opengapps/sources/arm/lib/21/libfilterpack_facedetect.so:system/lib/libfilterpack_facedetect.so
PRODUCT_COPY_FILES += vendor/opengapps/sources/arm/lib/21/libjni_latinimegoogle.so:system/lib/libjni_latinimegoogle.so
PRODUCT_COPY_FILES += vendor/opengapps/sources/arm/vendor/lib/21/libfrsdk.so:system/vendor/lib/libfrsdk.so
endif
else #api level at least 20
PRODUCT_COPY_FILES += vendor/opengapps/sources/arm/lib/19/libfacelock_jni.so:system/lib/libfacelock_jni.so
PRODUCT_COPY_FILES += vendor/opengapps/sources/arm/lib/19/libfilterpack_facedetect.so:system/lib/libfilterpack_facedetect.so
PRODUCT_COPY_FILES += vendor/opengapps/sources/arm/lib/19/libjni_latinimegoogle.so:system/lib/libjni_latinimegoogle.so
PRODUCT_COPY_FILES += vendor/opengapps/sources/arm/vendor/lib/19/libfrsdk.so:system/vendor/lib/libfrsdk.so
endif
else #api level at least 19
PRODUCT_COPY_FILES += vendor/opengapps/sources/arm/lib/19/libfacelock_jni.so:system/lib/libfacelock_jni.so
PRODUCT_COPY_FILES += vendor/opengapps/sources/arm/lib/19/libfilterpack_facedetect.so:system/lib/libfilterpack_facedetect.so
PRODUCT_COPY_FILES += vendor/opengapps/sources/arm/lib/19/libjni_latinimegoogle.so:system/lib/libjni_latinimegoogle.so
PRODUCT_COPY_FILES += vendor/opengapps/sources/arm/vendor/lib/19/libfrsdk.so:system/vendor/lib/libfrsdk.so
endif

IM NOT SURE IF HAVE MORE LIBS REFERENCES I WILL TRY TO CHECK TOO AT WEEKEND

thanks so much,
best regards, and a happy new year.

tuccy commented

another missing reference
modules/FaceLock/Android.mk

LOCAL_PATH := .
include $(CLEAR_VARS)
LOCAL_MODULE := FaceLock
LOCAL_PACKAGE_NAME := com.android.facelock
LOCAL_MODULE_PATH := $(PRODUCT_OUT)/system/app
LOCAL_SHARED_LIBRARIES := libfilterpack_facedetect libfacelock_jni libfrsdk

include $(BUILD_GAPPS_PREBUILT_APK)
include $(CLEAR_VARS)
LOCAL_MODULE := libfilterpack_facedetect
ifneq ($(filter $(TARGET_GAPPS_MAX_API_LEVEL),19),)
ifneq ($(filter $(TARGET_GAPPS_MAX_API_LEVEL),20),)
ifneq ($(filter $(TARGET_GAPPS_MAX_API_LEVEL),21),)
ifneq ($(filter $(TARGET_GAPPS_MAX_API_LEVEL),22),)
#api level at least 23
LOCAL_SRC_FILES := $(GAPPS_SOURCES_PATH)/arm/lib/23/libfilterpack_facedetect.so
else #api level at least 22
LOCAL_SRC_FILES := $(GAPPS_SOURCES_PATH)/arm/lib/21/libfilterpack_facedetect.so
endif
else #api level at least 21
LOCAL_SRC_FILES := $(GAPPS_SOURCES_PATH)/arm/lib/21/libfilterpack_facedetect.so
endif
else #api level at least 20
LOCAL_SRC_FILES := $(GAPPS_SOURCES_PATH)/arm/lib/19/libfilterpack_facedetect.so
endif
else #api level at least 19
LOCAL_SRC_FILES := $(GAPPS_SOURCES_PATH)/arm/lib/19/libfilterpack_facedetect.so
endif

include $(BUILD_GAPPS_PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libfacelock_jni
ifneq ($(filter $(TARGET_GAPPS_MAX_API_LEVEL),19),)
ifneq ($(filter $(TARGET_GAPPS_MAX_API_LEVEL),20),)
ifneq ($(filter $(TARGET_GAPPS_MAX_API_LEVEL),21),)
ifneq ($(filter $(TARGET_GAPPS_MAX_API_LEVEL),22),)
#api level at least 23
LOCAL_SRC_FILES := $(GAPPS_SOURCES_PATH)/arm/lib/23/libfacelock_jni.so
else #api level at least 22
LOCAL_SRC_FILES := $(GAPPS_SOURCES_PATH)/arm/lib/22/libfacelock_jni.so
endif
else #api level at least 21
LOCAL_SRC_FILES := $(GAPPS_SOURCES_PATH)/arm/lib/21/libfacelock_jni.so
endif
else #api level at least 20
LOCAL_SRC_FILES := $(GAPPS_SOURCES_PATH)/arm/lib/19/libfacelock_jni.so
endif
else #api level at least 19
LOCAL_SRC_FILES := $(GAPPS_SOURCES_PATH)/arm/lib/19/libfacelock_jni.so
endif

include $(BUILD_GAPPS_PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libfrsdk
ifneq ($(filter $(TARGET_GAPPS_MAX_API_LEVEL),19),)
ifneq ($(filter $(TARGET_GAPPS_MAX_API_LEVEL),20),)
ifneq ($(filter $(TARGET_GAPPS_MAX_API_LEVEL),21),)
ifneq ($(filter $(TARGET_GAPPS_MAX_API_LEVEL),22),)
#api level at least 23
LOCAL_SRC_FILES := $(GAPPS_SOURCES_PATH)/arm/vendor/lib/23/libfrsdk.so
else #api level at least 22
LOCAL_SRC_FILES := $(GAPPS_SOURCES_PATH)/arm/vendor/lib/21/libfrsdk.so
endif
else #api level at least 21
LOCAL_SRC_FILES := $(GAPPS_SOURCES_PATH)/arm/vendor/lib/21/libfrsdk.so
endif
else #api level at least 20
LOCAL_SRC_FILES := $(GAPPS_SOURCES_PATH)/arm/vendor/lib/19/libfrsdk.so
endif
else #api level at least 19
LOCAL_SRC_FILES := $(GAPPS_SOURCES_PATH)/arm/vendor/lib/19/libfrsdk.so
endif
GAPPS_MODULE_PATH := TARGET_OUT_VENDOR_SHARED_LIBRARIES

include $(BUILD_GAPPS_PREBUILT_SHARED_LIBRARY)

In addition these can be done creating file maping for lib/api version to create dinamic var target to clean the code

I think it might be a good idea to e.g. initialize the main opengapps repo as submodule (or any other way to include the remote inc.buildhelper.sh) and turn find_apk.sh into a wrapper.

acr92 commented

I don't think submodules work with the repo tool automatically. Submodules
is kinda an alternative to repo (but not as good).

We could require adding the standard opengapps git repo to the manifest.xml
but I would prefer avoiding that for just resolving one function.

On Fri, 8 Jan 2016, 19:55 mfonville notifications@github.com wrote:

I think it might be a good idea to e.g. initialize the main opengapps repo
as submodule (or any other way to include the remote inc.buildhelper.sh)
and turn find_apk.sh into a wrapper.


Reply to this email directly or view it on GitHub
#9 (comment).

I know it is a bit "overdone" for the simple function to add it to the manifest, but you do get "free" tracking of any improvements or changes to the helper functions.

I am in general also figuring out how whether to re-organize and seperate some of the opengapps files even more to provide a more sane build environment for future derivatives like the MicroG variant.

acr92 commented

I didn't get time to look at this during the weekend (my computer was locked up with running Android CTS and kernel tests).

I think I would've preferred there to always be a version available for every API level (by symlink for instance), even if the release is shared between two API levels (e.g. stuff running on both 5.0 and 5.1). Then we could get rid of the API lookup code and just use, for example:

$(GAPPS_SOURCES_PATH)/arm/lib/$(PLATFORM_SDK_VERSION)/libfacelock_jni.so

I think we could do this just for Lollipop (or Kitkat) and above.

Then, for the aosp_build project I would like to add a function for recursively lookup files for PRODUCT_COPY_FILES ( https://github.com/opengapps/aosp_build/blob/master/opengapps-files.mk ).

(NEED MORE TEST)
I add this into modules/AndroidProducts.mk, it will:

  1. check file existence from lib/19/[target.so] to lib/$(PLATFORM_SDK_VERSION)/[target.so]
  2. If [target.so] exist, force link it to lib/[target.so], so if [target.so] has a different version in higher API level, it will be override.
vendor/opengapps/sources/arm/lib/%.so: FORCE
        @for i in `seq 19 $(PLATFORM_SDK_VERSION)`; do \
            [ -e vendor/opengapps/sources/arm/lib/$$i/$(@F) ] && \
                ln -f -s $$i/$(@F) $@;      \
        done
vendor/opengapps/sources/arm/vendor/lib/%.so: FORCE
        @for i in `seq 19 $(PLATFORM_SDK_VERSION)`; do \
            [ -e vendor/opengapps/sources/arm/vendor/lib/$$i/$(@F) ] && \
                ln -f -s $$i/$(@F) $@;      \
        done
.PHONY: FORCE
acr92 commented

@mfonville Just so I'm sure I follow the library situation 100%...

https://github.com/opengapps/arm/tree/master/lib

For API level 22, we only need libfacelock_jni.so and libjni_latinimegoogle.so from arm/lib/22 (nothing copied from earlier API levels), right?

Since arm/vendor/lib is empty for 22...one would assume that API level 22 doesn't need vendor libs (libfrsdk.so is in 21). Right?

Or is libfrsdk actually needed on 22 as well?

Libfrsdk is also needed for 22, but since 22 is equal to the one of 21 it falls back to the 'lower version' in the 21 folder

acr92 commented

This should now be working with #15 merged in.