-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.cmd
139 lines (116 loc) · 6.02 KB
/
setup.cmd
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION
:PROCESS_CMD
SET "utility_folder=%~dp0"
SET "utility_software_folder=%utility_folder%software"
SET "utility_sfx=%utility_folder%software.exe"
REM Load dependent tools...
CALL "%utility_folder%..\win-utils\setup.cmd" cecho 7zip
SET help_arg=false
SET pack_arg=false
SET unpack_arg=false
SET first_arg=%1
IF [%first_arg%] EQU [-h] SET help_arg=true
IF [%first_arg%] EQU [--help] SET help_arg=true
IF [%first_arg%] EQU [--pack] SET pack_arg=true
IF [%first_arg%] EQU [--unpack] SET unpack_arg=true
IF [%help_arg%] EQU [true] (
CALL :SHOW_HELP
) ELSE (
IF [%pack_arg%] EQU [true] (
CALL :PACK
) ELSE (
IF [%unpack_arg%] EQU [true] (
CALL :UNPACK
) ELSE (
CALL :MAIN %*
IF !ERRORLEVEL! NEQ 0 (
EXIT /B !ERRORLEVEL!
)
)
)
)
REM All changes to variables within this script, will have local scope. Only
REM variables specified in the following block can propagates to the outside
REM world (For example, a calling script of this script).
ENDLOCAL & (
SET "TOOLSET_CLANG_TOOLS_PATH=%utility_software_folder%"
SET "PATH=%PATH%"
)
EXIT /B 0
:MAIN
CALL :UNPACK
REM Check if the 'utility_software_folder' is not already in system path. If
REM not, insert it.
IF "!PATH:%utility_software_folder%=!" EQU "%PATH%" (
SET "PATH=%utility_software_folder%;%PATH%"
CALL :SHOW_INFO "Utility added to system path."
)
EXIT /B 0
:PACK
IF EXIST "!utility_software_folder!" (
CALL :SHOW_INFO "Packing utility files."
7z u -uq0 -mx9 -sfx "!utility_sfx!" "!utility_software_folder!"
)
EXIT /B 0
:UNPACK
IF NOT EXIST "!utility_software_folder!" (
CALL :SHOW_INFO "Unpacking utility files."
CALL "!utility_sfx!" -y -o"!utility_folder!"
)
EXIT /B 0
:SHOW_INFO
cecho {olive}[TOOLSET - CLANG TOOLS]{default} INFO: %~1{\n}
EXIT /B 0
:SHOW_ERROR
cecho {olive}[TOOLSET - CLANG TOOLS]{red} ERROR: %~1 {default} {\n}
EXIT /B 0
:SHOW_HELP
SET "script_name=%~n0%~x0"
ECHO #######################################################################
ECHO # #
ECHO # T O O L S E T U P #
ECHO # #
ECHO # 'CLANG TOOLS' are standalone command line tools designed for #
ECHO # use by C++ developers. These tools provide developer-oriented #
ECHO # functionality such as fast syntax checking, automatic #
ECHO # formatting, refactoring, etc. #
ECHO # #
ECHO # Website https://clang.llvm.org #
ECHO # #
ECHO # After running the %SCRIPT_NAME%, the tools will be #
ECHO # available in the system path. #
ECHO # #
ECHO # TOOL : CLANG TOOLS #
ECHO # VERSION: LLVM 14.0.0 #
ECHO # ARCH : x64 #
ECHO # #
ECHO # USAGE: #
ECHO # %SCRIPT_NAME% [-h^|--help^|--pack^|--unpack] #
ECHO # #
ECHO # EXAMPLES: #
ECHO # %script_name% #
ECHO # %script_name% -h #
ECHO # %script_name% --pack #
ECHO # #
ECHO # ARGUMENTS: #
ECHO # -h^|--help Print this help and exit. #
ECHO # #
ECHO # --pack Pack the content of the software folder in one #
ECHO # self-extract executable called 'software.exe'. #
ECHO # #
ECHO # --unpack Unpack the self-extract executable 'software.exe' #
ECHO # to the software folder. #
ECHO # #
ECHO # EXPORTED ENVIRONMENT VARIABLES: #
ECHO # TOOLSET_CLANG_TOOLS_PATH Absolute path where this tool is #
ECHO # located. #
ECHO # #
ECHO # PATH This tool will export all local changes that it made to #
ECHO # the path's environment variable. #
ECHO # #
ECHO # The environment variables will be exported only if this tool #
ECHO # executes without any error. #
ECHO # #
ECHO #######################################################################
EXIT /B 0