#!/bin/bash
|
|
PRJ_PATH=`pwd`
|
BOARD=imx6ull
|
|
LYFTP_SRC=http://master.weike-iot.com:2211/src/
|
|
LIB_LVGL=lvgl-8.0.2
|
LIB_LVGL_DRV=lv_drivers-8.0.1
|
LIB_LVGL_DEMO=lv_demos-8.0.1
|
|
LIBS_DIR="lvgl lv_drivers lv_demos"
|
|
CROSS_COMPILE=/opt/gcc-aarch32-10.3-2021.07/bin/arm-none-linux-gnueabihf-
|
if [ $# == 1 ] ; then
|
CROSS_COMPILE=$1
|
fi
|
|
set -e
|
|
function prepare_lib()
|
{
|
PACK_SUFIX=tar.gz
|
PACK_NAME=$1
|
DIR_NAME=$2
|
|
if [ ! -d ${DIR_NAME} ] ; then
|
if [ ! -s ${PACK_NAME}.${PACK_SUFIX} ] ; then
|
wget ${LYFTP_SRC}/${PACK_NAME}.${PACK_SUFIX}
|
fi
|
|
tar -xzf ${PACK_NAME}.${PACK_SUFIX}
|
patch -p0 < patches/${PACK_NAME}-${BOARD}.patch
|
mv ${PACK_NAME} ${DIR_NAME}
|
|
cd ${DIR_NAME}
|
sed -i -e "s|.*CMAKE_C_COMPILER.*|set(CMAKE_C_COMPILER \"${CROSS_COMPILE}gcc\")|g" CMakeLists.txt
|
temp_file=`ls *_template.h`
|
conf_file=`echo ${temp_file/_template/}`
|
cp ${temp_file} ../${conf_file}
|
cd ${PRJ_PATH}
|
fi
|
}
|
|
if [[ $# == 1 && $1 == clean ]] ; then
|
rm -rf lv*
|
rm -rf libs
|
exit;
|
fi
|
|
prepare_lib ${LIB_LVGL} lvgl
|
prepare_lib ${LIB_LVGL_DRV} lv_drivers
|
prepare_lib ${LIB_LVGL_DEMO} lv_demos
|
|
|
mkdir -p ${PRJ_PATH}/libs
|
|
for lib in ${LIBS_DIR}
|
do
|
if [ -f ${PRJ_PATH}/libs/lib${lib}.a ] ; then
|
continue;
|
fi
|
|
mkdir -p ${lib}/build
|
cd ${lib}/build/
|
rm -rf * && cmake .. && make
|
|
cp lib*.a ${PRJ_PATH}/libs/lib${lib}.a
|
cd ${PRJ_PATH}
|
done
|
|