guowenxue
2024-09-27 b64b1d3468ec020b1a0ec31dd93490196cedaf1d
commit | author | age
b64b1d 1 #!/bin/bash
G 2
3 PRJ_PATH=`pwd`
4 BOARD=imx6ull
5
6 LYFTP_SRC=http://master.weike-iot.com:2211/src/
7
8 LIB_LVGL=lvgl-8.0.2 
9 LIB_LVGL_DRV=lv_drivers-8.0.1
10 LIB_LVGL_DEMO=lv_demos-8.0.1
11
12 LIBS_DIR="lvgl lv_drivers lv_demos"
13
14 CROSS_COMPILE=/opt/gcc-aarch32-10.3-2021.07/bin/arm-none-linux-gnueabihf-
15 if [ $# == 1 ] ; then
16    CROSS_COMPILE=$1
17 fi
18
19 set -e
20
21 function prepare_lib()
22 {
23     PACK_SUFIX=tar.gz
24     PACK_NAME=$1
25     DIR_NAME=$2
26
27     if [ ! -d ${DIR_NAME} ] ; then
28        if [ ! -s ${PACK_NAME}.${PACK_SUFIX} ] ; then
29           wget ${LYFTP_SRC}/${PACK_NAME}.${PACK_SUFIX}
30        fi 
31
32        tar -xzf ${PACK_NAME}.${PACK_SUFIX} 
33        patch -p0 < patches/${PACK_NAME}-${BOARD}.patch
34        mv ${PACK_NAME} ${DIR_NAME} 
35
36        cd ${DIR_NAME}
37        sed -i -e "s|.*CMAKE_C_COMPILER.*|set(CMAKE_C_COMPILER \"${CROSS_COMPILE}gcc\")|g" CMakeLists.txt
38          temp_file=`ls *_template.h`
39          conf_file=`echo ${temp_file/_template/}`
40          cp ${temp_file} ../${conf_file}
41        cd ${PRJ_PATH}
42     fi
43 }
44
45 if [[ $# == 1 && $1 == clean ]] ; then
46     rm -rf lv*
47     rm -rf libs
48     exit;
49 fi
50
51 prepare_lib ${LIB_LVGL} lvgl
52 prepare_lib ${LIB_LVGL_DRV} lv_drivers
53 prepare_lib ${LIB_LVGL_DEMO} lv_demos
54
55
56 mkdir -p ${PRJ_PATH}/libs
57
58 for lib in ${LIBS_DIR}
59 do
60     if [ -f ${PRJ_PATH}/libs/lib${lib}.a ] ; then
61         continue;
62     fi
63
64     mkdir -p ${lib}/build 
65     cd ${lib}/build/
66     rm -rf * && cmake .. && make
67
68     cp lib*.a ${PRJ_PATH}/libs/lib${lib}.a
69     cd ${PRJ_PATH}
70 done
71     
72