-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathgenerate4.sh
More file actions
executable file
·117 lines (97 loc) · 2.37 KB
/
Copy pathgenerate4.sh
File metadata and controls
executable file
·117 lines (97 loc) · 2.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#!/bin/bash
###############################################################################
# Copyright (c) 2014-2026 libbitcoin developers (see COPYING).
#
# Generate libbitcoin build artifacts from XML + GSL.
#
# This executes the iMatix GSL code generator.
# See https://github.com/imatix/gsl for details.
###############################################################################
OPTS_ENABLE="set -eo pipefail"
OPTS_DISABLE="set +e"
eval "${OPTS_ENABLE}"
trap 'msg_error "FATAL ERROR: Command failed at line ${LINENO}: ${BASH_COMMAND}" >&2' ERR
GSL="gsl -q"
COLOR_CYAN='\e[0;96m'
COLOR_GREEN='\e[0;92m'
COLOR_RED='\e[0;91m'
COLOR_YELLOW='\e[0;93m'
COLOR_RESET='\e[0m'
main()
{
# Do everything relative to this file location.
push_directory `dirname "$0"`
# Clean directories for generated build artifacts.
remove_directory_force "output"
# Execute property copiers and artifact generators.
msg "Execute generate.sh..."
eval ./generate.sh version4.xml
pop_directory
msg_success "Script execution completed successfully."
}
create_directory()
{
local DIRECTORY="$1"
local MODE="$2"
if [[ -d "${DIRECTORY}" ]]; then
if [[ ${MODE} == "-f" ]]; then
msg_warn "Reinitializing '${DIRECTORY}'..."
rm -rf "${DIRECTORY}"
mkdir -p "${DIRECTORY}"
else
msg_warn "Reusing existing '${DIRECTORY}'..."
fi
else
msg "Initializing '${DIRECTORY}'..."
mkdir -p "${DIRECTORY}"
fi
}
create_directory_force()
{
create_directory "$@" -f
}
pop_directory()
{
msg_verbose "*** move pre: '$(pwd)'"
popd >/dev/null
msg_verbose "*** move post: '$(pwd)'"
}
push_directory()
{
msg_verbose "*** move pre: '$(pwd)'"
local DIRECTORY="$1"
pushd "${DIRECTORY}" >/dev/null
msg_verbose "*** move post: '$(pwd)'"
}
remove_directory_force()
{
msg_verbose "*** removing: '$@'"
rm -rf "$@"
}
msg_heading()
{
printf "\n********************** %b **********************\n" "$@"
}
msg_verbose()
{
if [[ "${DISPLAY_VERBOSE}" == "yes" ]]; then
printf "${COLOR_CYAN}%b${COLOR_RESET}\n" "$@"
fi
}
msg()
{
printf "%b\n" "$@"
}
msg_success()
{
printf "${COLOR_GREEN}%b${COLOR_RESET}\n" "$@"
}
msg_warn()
{
printf "${COLOR_YELLOW}%b${COLOR_RESET}\n" "$@"
}
msg_error()
{
>&2 printf "${COLOR_RED}%b${COLOR_RESET}\n" "$@"
}
main "$@"