#!/bin/sh -e
[ -z "$DEBUG" ] || set -x
echo "########## rockchip-mpp-develop: staging install ##########"
cd /home/ych/rk3568/buildroot
PATH="/home/ych/rk3568/buildroot/output/rockchip_rk3568/host/bin:/home/ych/rk3568/buildroot/output/rockchip_rk3568/host/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin"  /usr/bin/make -j21  DESTDIR=/home/ych/rk3568/buildroot/output/rockchip_rk3568/host/aarch64-buildroot-linux-gnu/sysroot install/fast -C /home/ych/rk3568/buildroot/output/rockchip_rk3568/build/rockchip-mpp-develop/
cd /home/ych/rk3568/buildroot
rm -f -rf  /home/ych/rk3568/buildroot/output/rockchip_rk3568/host/aarch64-buildroot-linux-gnu/sysroot/share/info/dir
cd /home/ych/rk3568/buildroot
if test -n "" ; then echo "[7m>>> rockchip-mpp develop Fixing package configuration files[27m" ; /bin/sed -i -e  "s,/home/ych/rk3568/buildroot/output/rockchip_rk3568/host,@HOST_DIR@,g" -e "s,/home/ych/rk3568/buildroot/output/rockchip_rk3568,@BASE_DIR@,g" -e "s,^\(exec_\)\?prefix=.*,\1prefix=@STAGING_DIR@/usr,g" -e "s,-I/usr/,-I@STAGING_DIR@/usr/,g" -e "s,-L/usr/,-L@STAGING_DIR@/usr/,g" -e 's,@STAGING_DIR@,$(dirname $(readlink -e $0))/../..,g' -e 's,@HOST_DIR@,$(dirname $(readlink -e $0))/../../../..,g' -e "s,@BASE_DIR@,/home/ych/rk3568/buildroot/output/rockchip_rk3568,g"  ; fi
echo "[7m>>> rockchip-mpp develop Fixing libtool files[27m"
for la in $(find /home/ych/rk3568/buildroot/output/rockchip_rk3568/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib* -name "*.la"); do cp -a "${la}" "${la}.fixed" && /bin/sed -i -e "s:/home/ych/rk3568/buildroot/output/rockchip_rk3568:@BASE_DIR@:g" -e "s:/home/ych/rk3568/buildroot/output/rockchip_rk3568/host/aarch64-buildroot-linux-gnu/sysroot:@STAGING_DIR@:g"  -e "s:\(['= ]\)/usr:\\1@STAGING_DIR@/usr:g" -e "s:\(['= ]\)/lib:\\1@STAGING_DIR@/lib:g"  -e "s:@STAGING_DIR@:/home/ych/rk3568/buildroot/output/rockchip_rk3568/host/aarch64-buildroot-linux-gnu/sysroot:g" -e "s:@BASE_DIR@:/home/ych/rk3568/buildroot/output/rockchip_rk3568:g" "${la}.fixed" && if cmp -s "${la}" "${la}.fixed"; then rm -f "${la}.fixed"; else mv "${la}.fixed" "${la}"; fi || exit 1; done
