extract_files: Support system/ prefixes
With support for 4 independent partitions now, we seriously
need to start putting /system blobs in their own directory.
Add support for file lists with system/ prefixes while
maintaining support for old file lists without it.
Also, TARGET_COPY_OUT_SYSTEM is a thing now, and all devices,
regardless of treble or not, set TARGET_COPY_OUT_$partition
so let's get rid of the treble compat option and default it
to true.
Change-Id: I5b798d293768d7c1e16db3ba01e2de3e083088d7
diff --git a/build/tools/extract_utils.sh b/build/tools/extract_utils.sh
index a780a66..c9550ac 100644
--- a/build/tools/extract_utils.sh
+++ b/build/tools/extract_utils.sh
@@ -250,7 +250,7 @@
#
# write_product_copy_files:
#
-# $1: make treble compatible makefile - optional, default to false
+# $1: make treble compatible makefile - optional and deprecated, default to true
#
# Creates the PRODUCT_COPY_FILES section in the product makefile for all
# items in the list which do not start with a dash (-).
@@ -275,25 +275,24 @@
fi
TARGET=$(target_file "$FILE")
- if [ "$TREBLE_COMPAT" == "true" ] || [ "$TREBLE_COMPAT" == "1" ]; then
- if prefix_match_file "vendor/" $TARGET ; then
- local OUTTARGET=$(truncate_file $TARGET)
- printf ' %s/proprietary/%s:$(TARGET_COPY_OUT_VENDOR)/%s%s\n' \
- "$OUTDIR" "$TARGET" "$OUTTARGET" "$LINEEND" >> "$PRODUCTMK"
- elif prefix_match_file "product/" $TARGET ; then
- local OUTTARGET=$(truncate_file $TARGET)
- printf ' %s/proprietary/%s:$(TARGET_COPY_OUT_PRODUCT)/%s%s\n' \
- "$OUTDIR" "$TARGET" "$OUTTARGET" "$LINEEND" >> "$PRODUCTMK"
- elif prefix_match_file "odm/" $TARGET ; then
- local OUTTARGET=$(truncate_file $TARGET)
- printf ' %s/proprietary/%s:$(TARGET_COPY_OUT_ODM)/%s%s\n' \
- "$OUTDIR" "$TARGET" "$OUTTARGET" "$LINEEND" >> "$PRODUCTMK"
- else
- printf ' %s/proprietary/%s:system/%s%s\n' \
- "$OUTDIR" "$TARGET" "$TARGET" "$LINEEND" >> "$PRODUCTMK"
- fi
+ if prefix_match_file "vendor/" $TARGET ; then
+ local OUTTARGET=$(truncate_file $TARGET)
+ printf ' %s/proprietary/%s:$(TARGET_COPY_OUT_VENDOR)/%s%s\n' \
+ "$OUTDIR" "$TARGET" "$OUTTARGET" "$LINEEND" >> "$PRODUCTMK"
+ elif prefix_match_file "product/" $TARGET ; then
+ local OUTTARGET=$(truncate_file $TARGET)
+ printf ' %s/proprietary/%s:$(TARGET_COPY_OUT_PRODUCT)/%s%s\n' \
+ "$OUTDIR" "$TARGET" "$OUTTARGET" "$LINEEND" >> "$PRODUCTMK"
+ elif prefix_match_file "odm/" $TARGET ; then
+ local OUTTARGET=$(truncate_file $TARGET)
+ printf ' %s/proprietary/%s:$(TARGET_COPY_OUT_ODM)/%s%s\n' \
+ "$OUTDIR" "$TARGET" "$OUTTARGET" "$LINEEND" >> "$PRODUCTMK"
+ elif prefix_match_file "system/" $TARGET ; then
+ local OUTTARGET=$(truncate_file $TARGET)
+ printf ' %s/proprietary/%s:$(TARGET_COPY_OUT_SYSTEM)/%s%s\n' \
+ "$OUTDIR" "$TARGET" "$OUTTARGET" "$LINEEND" >> "$PRODUCTMK"
else
- printf ' %s/proprietary/%s:system/%s%s\n' \
+ printf ' %s/proprietary/%s:$(TARGET_COPY_OUT_SYSTEM)/%s%s\n' \
"$OUTDIR" "$TARGET" "$TARGET" "$LINEEND" >> "$PRODUCTMK"
fi
done
@@ -304,7 +303,7 @@
# write_packages:
#
# $1: The LOCAL_MODULE_CLASS for the given module list
-# $2: /odm, /product, or /vendor partition
+# $2: /system, /odm, /product, or /vendor partition
# $3: type-specific extra flags
# $4: Name of the array holding the target list
#
@@ -342,7 +341,9 @@
PACKAGE_LIST+=("$PKGNAME")
SRC="proprietary"
- if [ "$PARTITION" = "vendor" ]; then
+ if [ "$PARTITION" = "system" ]; then
+ SRC+="/system"
+ elif [ "$PARTITION" = "vendor" ]; then
SRC+="/vendor"
elif [ "$PARTITION" = "product" ]; then
SRC+="/product"
@@ -471,6 +472,22 @@
write_packages "SHARED_LIBRARIES" "" "64" "LIB64" >> "$ANDROIDMK"
fi
+ local T_S_LIB32=( $(prefix_match "system/lib/") )
+ local T_S_LIB64=( $(prefix_match "system/lib64/") )
+ local S_MULTILIBS=( $(comm -12 <(printf '%s\n' "${T_S_LIB32[@]}") <(printf '%s\n' "${T_S_LIB64[@]}")) )
+ local S_LIB32=( $(comm -23 <(printf '%s\n' "${T_S_LIB32[@]}") <(printf '%s\n' "${S_MULTILIBS[@]}")) )
+ local S_LIB64=( $(comm -23 <(printf '%s\n' "${T_S_LIB64[@]}") <(printf '%s\n' "${S_MULTILIBS[@]}")) )
+
+ if [ "${#S_MULTILIBS[@]}" -gt "0" ]; then
+ write_packages "SHARED_LIBRARIES" "system" "both" "S_MULTILIBS" >> "$ANDROIDMK"
+ fi
+ if [ "${#S_LIB32[@]}" -gt "0" ]; then
+ write_packages "SHARED_LIBRARIES" "system" "32" "S_LIB32" >> "$ANDROIDMK"
+ fi
+ if [ "${#S_LIB64[@]}" -gt "0" ]; then
+ write_packages "SHARED_LIBRARIES" "system" "64" "S_LIB64" >> "$ANDROIDMK"
+ fi
+
local T_V_LIB32=( $(prefix_match "vendor/lib/") )
local T_V_LIB64=( $(prefix_match "vendor/lib64/") )
local V_MULTILIBS=( $(comm -12 <(printf '%s\n' "${T_V_LIB32[@]}") <(printf '%s\n' "${T_V_LIB64[@]}")) )
@@ -528,6 +545,14 @@
if [ "${#PRIV_APPS[@]}" -gt "0" ]; then
write_packages "APPS" "" "priv-app" "PRIV_APPS" >> "$ANDROIDMK"
fi
+ local S_APPS=( $(prefix_match "system/app/") )
+ if [ "${#S_APPS[@]}" -gt "0" ]; then
+ write_packages "APPS" "system" "" "S_APPS" >> "$ANDROIDMK"
+ fi
+ local S_PRIV_APPS=( $(prefix_match "system/priv-app/") )
+ if [ "${#S_PRIV_APPS[@]}" -gt "0" ]; then
+ write_packages "APPS" "system" "priv-app" "S_PRIV_APPS" >> "$ANDROIDMK"
+ fi
local V_APPS=( $(prefix_match "vendor/app/") )
if [ "${#V_APPS[@]}" -gt "0" ]; then
write_packages "APPS" "vendor" "" "V_APPS" >> "$ANDROIDMK"
@@ -558,6 +583,10 @@
if [ "${#FRAMEWORK[@]}" -gt "0" ]; then
write_packages "JAVA_LIBRARIES" "" "" "FRAMEWORK" >> "$ANDROIDMK"
fi
+ local S_FRAMEWORK=( $(prefix_match "system/framework/") )
+ if [ "${#S_FRAMEWORK[@]}" -gt "0" ]; then
+ write_packages "JAVA_LIBRARIES" "system" "" "S_FRAMEWORK" >> "$ANDROIDMK"
+ fi
local V_FRAMEWORK=( $(prefix_match "vendor/framework/") )
if [ "${#V_FRAMEWORK[@]}" -gt "0" ]; then
write_packages "JAVA_LIBRARIES" "vendor" "" "V_FRAMEWORK" >> "$ANDROIDMK"
@@ -576,6 +605,10 @@
if [ "${#ETC[@]}" -gt "0" ]; then
write_packages "ETC" "" "" "ETC" >> "$ANDROIDMK"
fi
+ local S_ETC=( $(prefix_match "system/etc/") )
+ if [ "${#ETC[@]}" -gt "0" ]; then
+ write_packages "ETC" "system" "" "S_ETC" >> "$ANDROIDMK"
+ fi
local V_ETC=( $(prefix_match "vendor/etc/") )
if [ "${#V_ETC[@]}" -gt "0" ]; then
write_packages "ETC" "vendor" "" "V_ETC" >> "$ANDROIDMK"
@@ -594,6 +627,10 @@
if [ "${#BIN[@]}" -gt "0" ]; then
write_packages "EXECUTABLES" "" "" "BIN" >> "$ANDROIDMK"
fi
+ local S_BIN=( $(prefix_match "system/bin/") )
+ if [ "${#BIN[@]}" -gt "0" ]; then
+ write_packages "EXECUTABLES" "system" "" "S_BIN" >> "$ANDROIDMK"
+ fi
local V_BIN=( $(prefix_match "vendor/bin/") )
if [ "${#V_BIN[@]}" -gt "0" ]; then
write_packages "EXECUTABLES" "vendor" "" "V_BIN" >> "$ANDROIDMK"