forked from campg2j003/JAWS-Script-for-Audacity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.cmd
101 lines (97 loc) · 3.52 KB
/
build.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
@echo off
REM if variable JAWSVER is set, it is used as the JAWS version number in paths such as the scripts folder and compiler.
setlocal
set INSTALLSRCDIR=Jaws_script_installer
rem base name of program files, used by t option when compiling.
set PROD=audacity
set BUILDDIR=build\
if "%JAWSVER%" == "" set JAWSVER=18.0
set JAWSDIR=%appdata%\Freedom Scientific\JAWS\%JAWSVER%\settings\enu
set SCOMPILE=%PROGRAMFILES%\freedom scientific\jaws\%JAWSVER%\scompile.exe
rem If it doesn't exist try PROGRAMW6432; this works when I run from emacs.
if not exist "%scompile%" set SCOMPILE=%programw6432%\freedom scientific\jaws\%JAWSVER%\scompile.exe
REM Name of md2html (on execution path or absolute path).
set MD2HTML=md2html
REM %MD2HTML% -V
rem source files
set SCRIPTSRC=audacity.jdf audacity.jkm audacity.jsd audacity.jsm audacity.jss audacity.qs audacity.qsm
set OTHERSRC=readme_vi.md copying.txt "What's new.md"
REM These are basenames of .md files that should be converted to HTML files.
set MARKDOWNSRC=readme readme_vi
set INSTALLSRC=installer.nsi installer_lang_enu.nsh installer_lang_esn.nsh installer_lang_deu.nsh jfw_nsh\JFW.nsh jfw_nsh\JFW_lang_enu.nsh jfw_nsh\JFW_lang_esn.nsh jfw_nsh\JFW_lang_deu.nsh jfw_nsh\JAWSUtil.vbs jfw_nsh\readme.md jfw_nsh\uninstlog\uninstlog.nsh jfw_nsh\uninstlog\uninstlog_enu.nsh jfw_nsh\uninstlog\uninstlog_esn.nsh jfw_nsh\uninstlog\uninstlog_deu.nsh jfw_nsh\uninstlog\logging.nsh
if "%1"=="/?" goto help
if "%1"=="-?" goto help
if "%1"=="-h" goto help
if "%1"=="--help" goto help
if not "%1"=="" goto loop
:help
echo usage: build opt...
echo where opt is:
echo b - remove and make build folder structure
echo c - remove build folder
echo i - make the installer
echo t - copy script files to the JAWS script folder overwriting existing files and compile %PROD%.jss
echo f - copy the script sources from the JAWS script folder to this folder overwriting existing files
goto done
:loop
if "%1"=="" goto done
if "%1"=="b" goto build
if "%1"=="c" goto clean
if "%1"=="i" goto installer
if "%1"=="t" goto tojaws
if "%1"=="f" goto fromjaws
echo invalid option "%1"
goto help
:clean
rd /q /s %BUILDDIR%
goto next
:build
if exist %BUILDDIR% rd /q /s %BUILDDIR%
mkdir %BUILDDIR% %BUILDDIR%\script
for %%i in (%INSTALLSRC%) do copy %INSTALLSRCDIR%\%%i %BUILDDIR%
for %%i in (%SCRIPTSRC% %OTHERSRC%) do copy %%i %BUILDDIR%script
for %%i in (%MARKDOWNSRC%) do %MD2HTML% -c %%i.md %BUILDDIR%script\%%i.html
if errorlevel 1 goto done
md %BUILDDIR%script\lang
REM /d makes the fileset consist only of folders
for /d %%i in (lang\*) do (
REM %%i is something like lang\esn
md %BUILDDIR%script\%%i
for %%j in (%SCRIPTSRC%) do if exist %%i\%%j copy %%i\%%j %BUILDDIR%script\%%i\%%j
for %%j in (%MARKDOWNSRC%) do if exist %%i\%%j.md %MD2HTML% -c %%i\%%j.md %BUILDDIR%script\%%i\%%j.html
if errorlevel 1 goto done
)
goto next
:installer
if not exist "%programfiles(x86)%" goto installer32
"%programfiles(x86)%\nsis\makensis" "%BUILDDIR%\installer.nsi"
goto next
:installer32
"%programfiles%\nsis\makensis" "%BUILDDIR%\installer.nsi"
goto next
:tojaws
for %%i in (%SCRIPTSRC%) do copy /y %%i "%JAWSDIR%"
if exist "%SCOMPILE%" goto scompileexists
echo Could not find script compiler %scompile%
goto next
:scompileexists
pushd "%JAWSDIR%"
"%scompile%" "%PROD%.jss"
if %errorlevel% == 0 (
echo Compile finished successfully
) else (
echo Compile failed with exit code %errorlevel%.
)
popd
goto next
:fromjaws
set curdir=%CD%
pushd "%JAWSDIR%"
rem echo copy script files from %CD% to %CURDIR%
for %%i in (%SCRIPTSRC%) do copy /y %%i %curdir%
popd
goto next
:next
shift
goto loop
:done