diff --git a/extract-files.sh b/extract-files.sh index c7dc1c3..2ef200b 100755 --- a/extract-files.sh +++ b/extract-files.sh @@ -1,8 +1,7 @@ #!/bin/bash # -# Copyright (C) 2016 The CyanogenMod Project -# Copyright (C) 2017-2020 The LineageOS Project -# +# SPDX-FileCopyrightText: 2016 The CyanogenMod Project +# SPDX-FileCopyrightText: 2017-2024 The LineageOS Project # SPDX-License-Identifier: Apache-2.0 # @@ -17,6 +16,10 @@ if [[ ! -d "${MY_DIR}" ]]; then MY_DIR="${PWD}"; fi ANDROID_ROOT="${MY_DIR}/../../.." +# If XML files don't have comments before the XML header, use this flag +# Can still be used with broken XML files by using blob_fixup +export TARGET_DISABLE_XML_FIXING=true + HELPER="${ANDROID_ROOT}/tools/extract-utils/extract_utils.sh" if [ ! -f "${HELPER}" ]; then echo "Unable to find helper script at ${HELPER}" @@ -32,19 +35,20 @@ SECTION= while [ "${#}" -gt 0 ]; do case "${1}" in - -n | --no-cleanup ) - CLEAN_VENDOR=false - ;; - -k | --kang ) - KANG="--kang" - ;; - -s | --section ) - SECTION="${2}"; shift - CLEAN_VENDOR=false - ;; - * ) - SRC="${1}" - ;; + -n | --no-cleanup) + CLEAN_VENDOR=false + ;; + -k | --kang) + KANG="--kang" + ;; + -s | --section) + SECTION="${2}" + shift + CLEAN_VENDOR=false + ;; + *) + SRC="${1}" + ;; esac shift done @@ -56,12 +60,23 @@ fi function blob_fixup() { case "${1}" in system/lib64/libcamera_algoup_jni.xiaomi.so|system/lib64/libcamera_mianode_jni.xiaomi.so) + [ "$2" = "" ] && return 0 grep -q "libgui_shim_miuicamera.so" "${2}" || "${PATCHELF}" --add-needed "libgui_shim_miuicamera.so" "${2}" ;; system/lib64/libmicampostproc_client.so) + [ "$2" = "" ] && return 0 "${PATCHELF}" --remove-needed "libhidltransport.so" "${2}" ;; + *) + return 1 + ;; esac + + return 0 +} + +function blob_fixup_dry() { + blob_fixup "$1" "" } # Initialize the helper diff --git a/setup-makefiles.sh b/setup-makefiles.sh index a8ea680..22de2ab 100755 --- a/setup-makefiles.sh +++ b/setup-makefiles.sh @@ -1,8 +1,7 @@ #!/bin/bash # -# Copyright (C) 2016 The CyanogenMod Project -# Copyright (C) 2017-2020 The LineageOS Project -# +# SPDX-FileCopyrightText: 2016 The CyanogenMod Project +# SPDX-FileCopyrightText: 2017-2024 The LineageOS Project # SPDX-License-Identifier: Apache-2.0 #