guowenxue
2024-09-27 b64b1d3468ec020b1a0ec31dd93490196cedaf1d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/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