#!/bin/sh -e
[ -z "$DEBUG" ] || set -x
echo "########## host-environment-setup: host install ##########"
cd /home/ych/rk3568/buildroot
cp package/environment-setup/environment-setup /home/ych/rk3568/buildroot/output/rockchip_rk3568/host/environment-setup
for var in 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; do printf "export \"$var\"\n" >> /home/ych/rk3568/buildroot/output/rockchip_rk3568/host/environment-setup; done
printf "export \"ARCH=arm64\"\n" >> /home/ych/rk3568/buildroot/output/rockchip_rk3568/host/environment-setup
printf "export \"CROSS_COMPILE=/home/ych/rk3568/buildroot/output/rockchip_rk3568/host/bin/aarch64-buildroot-linux-gnu-\"\n" >> /home/ych/rk3568/buildroot/output/rockchip_rk3568/host/environment-setup
printf "export \"CONFIGURE_FLAGS=--target=aarch64-buildroot-linux-gnu --host=aarch64-buildroot-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --localstatedir=/var --program-prefix=\"\n" >> /home/ych/rk3568/buildroot/output/rockchip_rk3568/host/environment-setup
printf "alias configure=\"./configure \${CONFIGURE_FLAGS}\"\n" >> /home/ych/rk3568/buildroot/output/rockchip_rk3568/host/environment-setup
printf "alias cmake=\"cmake -DCMAKE_TOOLCHAIN_FILE=/home/ych/rk3568/buildroot/output/rockchip_rk3568/host/share/buildroot/toolchainfile.cmake -DCMAKE_INSTALL_PREFIX=/usr\"\n" >> /home/ych/rk3568/buildroot/output/rockchip_rk3568/host/environment-setup
/bin/sed -i -e 's%/home/ych/rk3568/buildroot/output/rockchip_rk3568/host/bin/%%g' -e 's%/home/ych/rk3568/buildroot/output/rockchip_rk3568/host%\$SDK_PATH%g' -e '/^export "PATH=/c\' /home/ych/rk3568/buildroot/output/rockchip_rk3568/host/environment-setup
printf "export \"PATH=\$SDK_PATH/bin:\$SDK_PATH/sbin:\$PATH\"\n" >> /home/ych/rk3568/buildroot/output/rockchip_rk3568/host/environment-setup
cd /home/ych/rk3568/buildroot
rm -f -rf  /home/ych/rk3568/buildroot/output/rockchip_rk3568/host/share/info/dir
