4 # This bash script generates a CMSIS Software Pack:
9 # Set version of gen pack library
10 REQUIRED_GEN_PACK_LIB="0.8.2"
12 # Set default command line arguments
15 # Pack warehouse directory - destination
18 # Temporary pack build directory
21 # Specify directory names to be added to pack base directory
30 # Specify file names to be added to pack base directory
35 # Specify file names to be deleted from pack build directory
38 # Specify patches to be applied
41 # Specify addition argument to packchk
42 PACKCHK_ARGS=(-x M353 -x M379 -x M336)
44 # Specify additional dependencies for packchk
47 # Optional: restrict fallback modes for changelog generation
50 # - full Tag annotations, release descriptions, or commit messages (in order)
51 # - release Tag annotations, or release descriptions (in order)
52 # - tag Tag annotations only
53 PACK_CHANGELOG_MODE="tag"
56 # custom pre-processing steps
58 # usage: preprocess <build>
59 # <build> The build folder
61 function preprocess() {
62 # add custom steps here to be executed
63 # before populating the pack build folder
64 ./CMSIS/DoxyGen/gen_doc.sh
69 # custom post-processing steps
71 # usage: postprocess <build>
72 # <build> The build folder
74 function postprocess() {
75 # add custom steps here to be executed
76 # after populating the pack build folder
77 # but before archiving the pack into output folder
81 ############ DO NOT EDIT BELOW ###########
83 function install_lib() {
84 local URL="https://github.com/Open-CMSIS-Pack/gen-pack/archive/refs/tags/v$1.tar.gz"
85 echo "Downloading gen-pack lib to '$2'"
87 curl -L "${URL}" -s | tar -xzf - --strip-components 1 -C "$2" || exit 1
91 if [[ -d ${GEN_PACK_LIB} ]]; then
92 . "${GEN_PACK_LIB}/gen-pack"
95 local GLOBAL_LIB="/usr/local/share/gen-pack/${REQUIRED_GEN_PACK_LIB}"
96 local USER_LIB="${HOME}/.local/share/gen-pack/${REQUIRED_GEN_PACK_LIB}"
97 if [[ ! -d "${GLOBAL_LIB}" && ! -d "${USER_LIB}" ]]; then
98 echo "Required gen_pack lib not found!" >&2
99 install_lib "${REQUIRED_GEN_PACK_LIB}" "${USER_LIB}"
102 if [[ -d "${GLOBAL_LIB}" ]]; then
103 . "${GLOBAL_LIB}/gen-pack"
104 elif [[ -d "${USER_LIB}" ]]; then
105 . "${USER_LIB}/gen-pack"
107 echo "Required gen-pack lib is not installed!" >&2
113 gen_pack "${DEFAULT_ARGS[@]}" "$@"