1#!/usr/bin/env bash
2# Version: 3.0
3# Date: 2023-11-06
4# This bash script generates a CMSIS Software Pack:
5#
6
7set -o pipefail
8
9# Set version of gen pack library
10# For available versions see https://github.com/Open-CMSIS-Pack/gen-pack/tags.
11# Use the tag name without the prefix "v", e.g., 0.7.0
12REQUIRED_GEN_PACK_LIB="0.9.1"
13
14# Set default command line arguments
15DEFAULT_ARGS=(-c "v")
16
17# Pack warehouse directory - destination
18# Default: ./output
19#
20# PACK_OUTPUT=./output
21
22# Temporary pack build directory,
23# Default: ./build
24#
25# PACK_BUILD=./build
26
27# Specify directory names to be added to pack base directory
28# An empty list defaults to all folders next to this script.
29# Default: empty (all folders)
30#
31PACK_DIRS="
32  CMSIS/Core
33  CMSIS/Documentation
34  CMSIS/Driver
35  CMSIS/RTOS2
36"
37
38# Specify file names to be added to pack base directory
39# Default: empty
40#
41PACK_BASE_FILES="
42  LICENSE
43"
44
45# Specify file names to be deleted from pack build directory
46# Default: empty
47#
48PACK_DELETE_FILES="
49  CMSIS/Documentation/Doxygen
50  CMSIS/Documentation/README.md
51"
52
53# Specify patches to be applied
54# Default: empty
55#
56# PACK_PATCH_FILES=""
57
58# Specify addition argument to packchk
59# Default: empty
60#
61PACKCHK_ARGS=(-x M336)
62
63# Specify additional dependencies for packchk
64# Default: empty
65#
66PACKCHK_DEPS=" "
67
68# Optional: restrict fallback modes for changelog generation
69# Default: full
70# Values:
71# - full      Tag annotations, release descriptions, or commit messages (in order)
72# - release   Tag annotations, or release descriptions (in order)
73# - tag       Tag annotations only
74#
75PACK_CHANGELOG_MODE="tag"
76
77#
78# custom pre-processing steps
79#
80# usage: preprocess <build>
81#   <build>  The build folder
82#
83function preprocess() {
84  # add custom steps here to be executed
85  # before populating the pack build folder
86  ./CMSIS/Documentation/Doxygen/gen_doc.sh
87  return 0
88}
89
90#
91# custom post-processing steps
92#
93# usage: postprocess <build>
94#   <build>  The build folder
95#
96function postprocess() {
97  # add custom steps here to be executed
98  # after populating the pack build folder
99  # but before archiving the pack into output folder
100  return 0
101}
102
103############ DO NOT EDIT BELOW ###########
104
105# Set GEN_PACK_LIB_PATH to use a specific gen-pack library root
106# ... instead of bootstrap based on REQUIRED_GEN_PACK_LIB
107if [[ -f "${GEN_PACK_LIB_PATH}/gen-pack" ]]; then
108  . "${GEN_PACK_LIB}/gen-pack"
109else
110  . <(curl -sL "https://raw.githubusercontent.com/Open-CMSIS-Pack/gen-pack/main/bootstrap")
111fi
112
113gen_pack "${DEFAULT_ARGS[@]}" "$@"
114
115exit 0
116