]> begriffs open source - cmsis-driver-validation/blob - gen_pack.sh
Update ETH driver validation and related examples
[cmsis-driver-validation] / gen_pack.sh
1 #!/bin/bash
2 # Version: 2.3
3 # Date: 2022-09-28
4 # This bash script generates a CMSIS-Driver Software Pack
5 #
6
7 set -o pipefail
8
9 # Set version of gen pack library
10 REQUIRED_GEN_PACK_LIB="0.6.1"
11
12 # Set default command line arguments
13 DEFAULT_ARGS=(-c "")
14
15 # Pack warehouse directory - destination
16 PACK_OUTPUT=./output
17
18 # Temporary pack build directory
19 PACK_BUILD=./build
20
21 # Specify directory names to be added to pack base directory
22 PACK_DIRS="
23   Boards
24   Config
25   Documentation
26   Include
27   Scripts
28   Source
29   Tools
30 "
31
32 # Specify file names to be added to pack base directory
33 PACK_BASE_FILES="
34   LICENSE.txt
35   README.md
36 "
37
38 # Specify file names to be deleted from pack build directory
39 PACK_DELETE_FILES=""
40
41 # Specify patches to be applied
42 PACK_PATCH_FILES=""
43
44 # Specify addition argument to packchk
45 PACKCHK_ARGS=()
46
47 # Specify additional dependencies for packchk
48 PACKCHK_DEPS="
49   Keil.STM32F2xx_DFP.pdsc
50   Keil.STM32F4xx_DFP.pdsc
51   Keil.STM32F7xx_DFP.pdsc
52   Keil.B-L475E-IOT01A_BSP.pdsc
53   Infineon.XMC4000_DFP.pdsc
54   NXP.LPCXpresso55S69_BSP.pdsc
55   NXP.EVK-MIMXRT1064_BSP.pdsc
56 "
57
58 # Optional: restrict fallback modes for changelog generation
59 # Default: full
60 # Values:
61 # - full      Tag annotations, release descriptions, or commit messages (in order)
62 # - release   Tag annotations, or release descriptions (in order)
63 # - tag       Tag annotations only
64 PACK_CHANGELOG_MODE="tag"
65
66 # custom preprocessing steps
67 function preprocess() {
68   ./DoxyGen/gen_doc.sh
69 }
70
71 # custom post-processing steps
72 # function postprocess() {
73 # }
74
75 ############ DO NOT EDIT BELOW ###########
76
77 function install_lib() {
78   local URL="https://github.com/Open-CMSIS-Pack/gen-pack/archive/refs/tags/v$1.tar.gz"
79   echo "Downloading gen-pack lib to '$2'"
80   mkdir -p "$2"
81   curl -L "${URL}" -s | tar -xzf - --strip-components 1 -C "$2" || exit 1
82 }
83
84 function load_lib() {
85   if [[ -d ${GEN_PACK_LIB} ]]; then
86     . "${GEN_PACK_LIB}/gen-pack"
87     return 0
88   fi
89   local GLOBAL_LIB="/usr/local/share/gen-pack/${REQUIRED_GEN_PACK_LIB}"
90   local USER_LIB="${HOME}/.local/share/gen-pack/${REQUIRED_GEN_PACK_LIB}"
91   if [[ ! -d "${GLOBAL_LIB}" && ! -d "${USER_LIB}" ]]; then
92     echo "Required gen_pack lib not found!" >&2
93     install_lib "${REQUIRED_GEN_PACK_LIB}" "${USER_LIB}"
94   fi
95
96   if [[ -d "${GLOBAL_LIB}" ]]; then
97     . "${GLOBAL_LIB}/gen-pack"
98   elif [[ -d "${USER_LIB}" ]]; then
99     . "${USER_LIB}/gen-pack"
100   else
101     echo "Required gen-pack lib is not installed!" >&2
102     exit 1
103   fi
104 }
105
106 load_lib
107 gen_pack "${DEFAULT_ARGS[@]}" "$@"
108
109 exit 0