Files
mongoose/extra/cmsis-pack/gen_pack.sh
T
Sergio R. Caprile 2dffbc32ba Squashed commit of the following:
update for tag movement
    updated to new release
    update pack in examples
    new release number
    rename to extra
    Cleanup
    Added ready-made examples to ST pack
    Add Keil examples
    Fix CRLF, start adding examples descriptions
    Remove examples
    STM32Cube Expansion Pack with no examples
    Add STM32Cube Expansion Pack skeleton
    Added examples for discussion
    Add support for Cube
    Working on examples
    pack skeleton ready
2026-04-08 11:41:26 -03:00

104 lines
2.5 KiB
Bash
Executable File

#!/bin/bash
# Version: 2.4
# Date: 2022-11-21
# This bash script generates a CMSIS Software Pack:
# but only if you can guess what it does... so do yourself a favor
# and read this: https://github.com/Open-CMSIS-Pack/gen-pack/
set -o pipefail
# Set version of gen pack library
REQUIRED_GEN_PACK_LIB="0.6.0"
# Set default command line arguments
DEFAULT_ARGS=()
# Pack warehouse directory - destination
PACK_OUTPUT=./output
# Temporary pack build directory
PACK_BUILD=./build
# Specify directory names to be added to pack base directory
PACK_DIRS="
Mongoose
Boards
"
# Specify file names to be added to pack base directory
PACK_BASE_FILES="
License.txt
README.md
"
# Specify file names to be deleted from pack build directory
PACK_DELETE_FILES=""
# Specify patches to be applied
PACK_PATCH_FILES=""
# Specify addition argument to packchk
PACKCHK_ARGS=()
# Specify additional dependencies for packchk
PACKCHK_DEPS=""
# Optional: restrict fallback modes for changelog generation
# Default: full
# Values:
# - full Tag annotations, release descriptions, or commit messages (in order)
# - release Tag annotations, or release descriptions (in order)
# - tag Tag annotations only
PACK_CHANGELOG_MODE="release"
# custom pre-processing steps
function preprocess() {
# add custom steps here to be executed
# before populating the pack build folder
return 0
}
# custom post-processing steps
function postprocess() {
# add custom steps here to be executed
# after populating the pack build folder
# but before archiving the pack into output folder
return 0
}
############ DO NOT EDIT BELOW ###########
function install_lib() {
local URL="https://github.com/Open-CMSIS-Pack/gen-pack/archive/refs/tags/v$1.tar.gz"
echo "Downloading gen-pack lib to '$2'"
mkdir -p "$2"
curl -L "${URL}" -s | tar -xzf - --strip-components 1 -C "$2" || exit 1
}
function load_lib() {
if [[ -d ${GEN_PACK_LIB} ]]; then
. "${GEN_PACK_LIB}/gen-pack"
return 0
fi
local GLOBAL_LIB="/usr/local/share/gen-pack/${REQUIRED_GEN_PACK_LIB}"
local USER_LIB="${HOME}/.local/share/gen-pack/${REQUIRED_GEN_PACK_LIB}"
if [[ ! -d "${GLOBAL_LIB}" && ! -d "${USER_LIB}" ]]; then
echo "Required gen_pack lib not found!" >&2
install_lib "${REQUIRED_GEN_PACK_LIB}" "${USER_LIB}"
fi
if [[ -d "${GLOBAL_LIB}" ]]; then
. "${GLOBAL_LIB}/gen-pack"
elif [[ -d "${USER_LIB}" ]]; then
. "${USER_LIB}/gen-pack"
else
echo "Required gen-pack lib is not installed!" >&2
exit 1
fi
}
load_lib
gen_pack "${DEFAULT_ARGS[@]}" "$@"
exit 0