Files
rk35xx-android14/frameworks/layoutlib/split_universal_binary.sh
T
hmz007 36ed224bac Rockchip Anroid14_SDK 20240628-rkr5 (2556df1a)
Signed-off-by: hmz007 <hmz007@gmail.com>
Change-Id: Ib87fdbe7a0be7dc961af3500fe9ea4589a127f9f
2024-10-29 18:12:02 +08:00

38 lines
969 B
Bash
Executable File

#!/bin/bash
readonly OUT_DIR="$1"
readonly DIST_DIR="$2"
readonly BUILD_NUMBER="$3"
readonly SCRIPT_DIR="$(dirname "$0")"
readonly ARM=arm64
readonly X86=x86_64
NATIVE_LIBRARIES=${SCRIPT_DIR}"/../../out/host/darwin-x86/lib64"
# Find lipo command used to create and manipulate universal binaries
LIPO=$(/usr/bin/xcrun --find lipo)
mkdir ${OUT_DIR}/${ARM}
mkdir ${OUT_DIR}/${X86}
# Split all universal binaries built for layoutlib into an ARM64 version and a X86_64 version
for f in ${NATIVE_LIBRARIES}/*
do
${LIPO} $f -output ${OUT_DIR}/${ARM}/$(basename $f) -thin ${ARM}
${LIPO} $f -output ${OUT_DIR}/${X86}/$(basename $f) -thin ${X86}
done
# Put the single architecture binaries inside the DIST folder to be accessible on ab/
if [[ -d "${DIST_DIR}" ]]; then
cp -r ${OUT_DIR}/${ARM} ${DIST_DIR}/layoutlib_native/darwin
cp -r ${OUT_DIR}/${X86} ${DIST_DIR}/layoutlib_native/darwin
fi
# Clean
rm -rf ${OUT_DIR}/${ARM}
rm -rf ${OUT_DIR}/${X86}
exit 0