#!/bin/sh -e
[ -z "$DEBUG" ] || set -x
echo "########## i2c-tools-4.3: staging install ##########"
cd /home/ych/rk3568/buildroot
/usr/bin/make -j21 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" AR="/home/ych/rk3568/buildroot/output/rockchip_rk3568/host/bin/aarch64-buildroot-linux-gnu-ar" AS="/home/ych/rk3568/buildroot/output/rockchip_rk3568/host/bin/aarch64-buildroot-linux-gnu-as" LD="/home/ych/rk3568/buildroot/output/rockchip_rk3568/host/bin/aarch64-buildroot-linux-gnu-ld" NM="/home/ych/rk3568/buildroot/output/rockchip_rk3568/host/bin/aarch64-buildroot-linux-gnu-nm" CC="/home/ych/rk3568/buildroot/output/rockchip_rk3568/host/bin/aarch64-buildroot-linux-gnu-gcc" GCC="/home/ych/rk3568/buildroot/output/rockchip_rk3568/host/bin/aarch64-buildroot-linux-gnu-gcc" CPP="/home/ych/rk3568/buildroot/output/rockchip_rk3568/host/bin/aarch64-buildroot-linux-gnu-cpp" CXX="/home/ych/rk3568/buildroot/output/rockchip_rk3568/host/bin/aarch64-buildroot-linux-gnu-g++" FC="/home/ych/rk3568/buildroot/output/rockchip_rk3568/host/bin/aarch64-buildroot-linux-gnu-gfortran" F77="/home/ych/rk3568/buildroot/output/rockchip_rk3568/host/bin/aarch64-buildroot-linux-gnu-gfortran" RANLIB="/home/ych/rk3568/buildroot/output/rockchip_rk3568/host/bin/aarch64-buildroot-linux-gnu-ranlib" READELF="/home/ych/rk3568/buildroot/output/rockchip_rk3568/host/bin/aarch64-buildroot-linux-gnu-readelf" STRIP="/home/ych/rk3568/buildroot/output/rockchip_rk3568/host/bin/aarch64-buildroot-linux-gnu-strip" OBJCOPY="/home/ych/rk3568/buildroot/output/rockchip_rk3568/host/bin/aarch64-buildroot-linux-gnu-objcopy" OBJDUMP="/home/ych/rk3568/buildroot/output/rockchip_rk3568/host/bin/aarch64-buildroot-linux-gnu-objdump" AR_FOR_BUILD="/usr/bin/ar" AS_FOR_BUILD="/usr/bin/as" CC_FOR_BUILD="/home/ych/rk3568/buildroot/output/rockchip_rk3568/host/bin/ccache /usr/bin/gcc" GCC_FOR_BUILD="/home/ych/rk3568/buildroot/output/rockchip_rk3568/host/bin/ccache /usr/bin/gcc" CXX_FOR_BUILD="/home/ych/rk3568/buildroot/output/rockchip_rk3568/host/bin/ccache /usr/bin/g++" LD_FOR_BUILD="/usr/bin/ld" CPPFLAGS_FOR_BUILD="-I/home/ych/rk3568/buildroot/output/rockchip_rk3568/host/include" CFLAGS_FOR_BUILD="-O2 -I/home/ych/rk3568/buildroot/output/rockchip_rk3568/host/include" CXXFLAGS_FOR_BUILD="-O2 -I/home/ych/rk3568/buildroot/output/rockchip_rk3568/host/include" LDFLAGS_FOR_BUILD="-L/home/ych/rk3568/buildroot/output/rockchip_rk3568/host/lib -Wl,-rpath,/home/ych/rk3568/buildroot/output/rockchip_rk3568/host/lib" FCFLAGS_FOR_BUILD="" DEFAULT_ASSEMBLER="/home/ych/rk3568/buildroot/output/rockchip_rk3568/host/bin/aarch64-buildroot-linux-gnu-as" DEFAULT_LINKER="/home/ych/rk3568/buildroot/output/rockchip_rk3568/host/bin/aarch64-buildroot-linux-gnu-ld" CPPFLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64" CFLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -Os -g0 -D_FORTIFY_SOURCE=1" CXXFLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -Os -g0 -D_FORTIFY_SOURCE=1" LDFLAGS="" FCFLAGS=" -Os -g0" FFLAGS=" -Os -g0" PKG_CONFIG="/home/ych/rk3568/buildroot/output/rockchip_rk3568/host/bin/pkg-config" STAGING_DIR="/home/ych/rk3568/buildroot/output/rockchip_rk3568/host/aarch64-buildroot-linux-gnu/sysroot" INTLTOOL_PERL=/usr/bin/perl EXTRA=eeprog BUILD_STATIC_LIB=0 DESTDIR="/home/ych/rk3568/buildroot/output/rockchip_rk3568/host/aarch64-buildroot-linux-gnu/sysroot" PREFIX=/usr -C /home/ych/rk3568/buildroot/output/rockchip_rk3568/build/i2c-tools-4.3 install
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>>> i2c-tools 4.3 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>>> i2c-tools 4.3 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
