3 rem begin localisation of Environment Variables
4 setlocal enableextensions
7 rem Uncomment the line below and set required value to MAXIMA_LANG_SUBDIR
8 rem to get localized describe in command line Maxima
9 rem set MAXIMA_LANG_SUBDIR=es
11 rem The variable LANGUAGE is usually not set on Windows, but if Maxima is running in
12 rem Wine/Linux (e.g. for testing purposes) it is inherited from the Linux environment
13 rem and causes troubles (at least with Clisp, maybe other Lisps too),
14 rem so unset this variable.
17 set "lisp=@DEFAULTLISP@"
19 set "version=@VERSION@"
21 title Maxima Open Source Computer Algebra System
%version%
23 rem Where is Maxima installed? Set %prefix% to exactly that directory.
24 rem The path is determined by the path of the executed maxima.bat - using the special variable: %~dp0
25 rem The following command removes the filename and the last path component (bin/maxima.bat),
26 FOR %%A IN
("%~dp0.") DO SET "prefix=%%~dpA"
27 rem remove trailing "\":
28 if "%prefix:~-1%"=="\" set "prefix
=%prefix
:~
0,-1%"
30 rem change "\" to
"/" in that
path. Works too and causes less troubles
(e.g. with xmaxima
).
31 set "prefix=%prefix:\=/%"
32 set "maxima_prefix=%prefix%"
33 set "package=@PACKAGE@"
35 set "path=%maxima_prefix%/gnuplot;%maxima_prefix%/gnuplot/bin;%maxima_prefix%/bin;%maxima_prefix%/vtk;%path%"
37 rem set userdir and tempdir - replace "\" with "/"
38 if not defined MAXIMA_USERDIR
set "MAXIMA_USERDIR=%USERPROFILE:\=/%/maxima"
39 if not defined MAXIMA_TEMPDIR
set "MAXIMA_TEMPDIR=%TEMP:\=/%"
40 rem there were reports, that the tempdir could not be found (maybe because of special characters, ut8-chars, ...)
41 rem so set a fallback (as it was before)
42 if not exist "%MAXIMA_TEMPDIR%"/ set "MAXIMA_TEMPDIR=%USERPROFILE:\=/%"
44 rem change 'short names' (e.g. "C:/Users/TESTTE~1/AppData/Local/Temp" to
45 rem long names (e.g. "C:/Users/test test/AppData/Local/Temp" -
46 rem CLISP has a problem with these short names.
47 rem Do this only if maxima_longnames.exe exists in the Maxima binary dir.
48 rem (it is not compiled and installed for example when a Lisp-only build is done).
49 if exist "%maxima_prefix%/bin/maxima_longnames.exe" for /F
"tokens=* USEBACKQ" %%F in
(`maxima_longnames.exe
"%MAXIMA_TEMPDIR%"`
) do set "MAXIMA_TEMPDIR=%%F"
52 rem read maximarc and set the Lisp type, if the user did specify MAXIMA_LISP
53 rem currently no comments or other (Unix shell) commands are understood, only (e.g):
55 if EXIST "%MAXIMA_USERDIR%/maximarc" (
56 setlocal enabledelayedexpansion
57 for /F usebackq
%%L in
("%MAXIMA_USERDIR%/maximarc") do (
59 set lisp
=!MAXIMA_LISP
!
63 rem In order to allow maxima to find out where its files are on MS Windows maxima needs
64 rem to be started in the directory it can be found in. Which in the case of
65 rem maxima-portable might be a different folder every time.
66 rem The user, though, might want it to start in the folder the worksheet lies in, as
67 rem read_matrix, write_data etc. should be relative to that folder.
68 rem common lisp doesn't provide such a function and clisp has problems with shortnames
69 rem while sbcl has problems with non-ascii-non-unicode folder names.
70 rem The variable MAXIMA_INITIAL_FOLDER tells which folder to start maxima in
71 rem after searching for the files it is composed of.
72 if defined MAXIMA_INITIAL_FOLDER
cd "%MAXIMA_INITIAL_FOLDER%"
75 if x
%1 == x
-l
goto foundlisp
76 if x
%1 == x
--lisp
goto foundlisp
77 if x
%1 == x
-u
goto foundversion
78 if x
%1 == x
--use-version
goto foundversion
79 if x
%1 == x
-v
goto foundverbose
80 if x
%1 == x
--verbose
goto foundverbose
81 if x
%1 == x
--lisp
-options
goto foundlispoptions
82 if x
%1 == x
--userdir
goto founduserdir
83 if x
%1 == x
-X
goto foundlispoptions
87 if not x
%1 == x
goto startparseargs
94 goto continueparseargs
97 set "MAXIMA_USERDIR=%~2"
99 goto continueparseargs
104 goto continueparseargs
109 goto continueparseargs
113 goto continueparseargs
117 if "%MAXIMA_LAYOUT_AUTOTOOLS%" == "" goto defaultlayout
118 set layout_autotools
=true
122 set layout_autotools
=@default_layout_autotools@
126 if "%MAXIMA_PREFIX%" == "" goto defaultvars
127 if "%layout_autotools%" == "true" goto maxim_autotools
128 set "maxima_imagesdir=%MAXIMA_PREFIX%/src"
132 set "maxima_imagesdir=%MAXIMA_PREFIX%/lib/%package%/%version%"
136 if "%layout_autotools%" == "true" goto defmaxim_autotools
137 set "maxima_imagesdir=%prefix%/src"
141 set "maxima_imagesdir=%prefix%/lib/%package%/%version%"
146 set "maxima_image_base=%maxima_imagesdir%/binary-%lisp%/maxima"
148 if "%verbose%" == "true" @
echo on
149 if "%lisp%" == "gcl" goto dogcl
150 if "%lisp%" == "clisp" goto doclisp
151 if "%lisp%" == "ecl" goto doecl
152 rem Allow ccl as an alias of openmcl
153 if "%lisp%" == "ccl" set lisp
=openmcl
154 if "%lisp%" == "openmcl" goto doopenmcl
155 if "%lisp%" == "ccl64" goto doccl64
156 if "%lisp%" == "sbcl" goto dosbcl
157 if "%lisp%" == "abcl" goto doabcl
159 @
echo Maxima error
: Lisp
%lisp% not known.
163 set "path=%maxima_prefix%/lib/gcc-lib/mingw32/@GCCVER@;%path"
164 "%maxima_image_base%.exe" -eval
"(cl-user::run)" %lisp_options% -f
-- %*
168 if exist "%maxima_image_base%.exe" goto doclisp_exec
170 if "%layout_autotools%" == "true" goto clisp_autotools
171 @CLISP_NAME@
%lisp_options% -q
-M
"%maxima_image_base%.mem" "" -- %*
175 rem ./configure sets a variable @CLISP_NAME@ which might be used instead of lisp.exe,
176 rem but when Maxima is crosscompiled on Linux, a shell script is used as 'crosscompiler',
177 rem which would be inserted here ==> do not use the variable @CLISP_NAME@ but just lisp.exe.
178 set "path=%maxima_imagesdir%/binary-%lisp%;%maxima_prefix%/clisp-2.49/base;%path%"
179 lisp.exe
%lisp_options% -q
-M
"%maxima_image_base%.mem" "" -- %*
183 "%maxima_image_base%.exe" %lisp_options% -q
"" -- %*
187 @ECL_NAME@
-load
%maxima_image_base%.fas
%lisp_options% -eval
"(user::run)" -- %*
190 rem SBCL Steel Bank Common Lisp
192 rem run executable image if it exists
193 if exist "%maxima_image_base%.exe" goto dosbcl_exec
194 if "%MAXIMA_SIGNALS_THREAD%" == "" (
195 set start_maxima
="(cl-user::run)"
197 set start_maxima
="(progn (load (maxima::$sconcat (namestring (pathname (maxima::maxima-getenv \"MAXIMA_PREFIX\"))) \"/bin/win_signals.lisp\")) (cl-user::run))"
200 rem At least in the crosscompiled installer, SBCL_HOME is not defined - set it here
201 if not defined SBCL_HOME
if exist "%maxima_prefix%/bin/sbcl.exe" set "SBCL_HOME=%~dp0"
203 rem Only on 64bit: if using sbcl (and the user does not specify anything else(!))
204 rem set the dynamic-space-size to 2GB so that load("lapack") will work.
205 rem The check for a 64 bit build is done by checking the name of the Mingw libgcc name
206 rem (which is libgcc_s_seh-1.dll for 64 and libgcc_s_sjlj-1.dll for 32 bit)
207 if exist "%maxima_prefix%/bin/libgcc_s_seh-1.dll" (
208 if "%lisp_options%"=="" set lisp_options
=--dynamic
-space
-size^
2000
210 rem I am a
32 bit build
- the SBCL workaround
for load
(lapack
) will
not work
213 rem ./configure sets a variable @SBCL_NAME@ which might be used instead of sbcl.exe,
214 rem but when Maxima is crosscompiled on Linux, a shell script is used as 'crosscompiler',
215 rem which would be inserted here ==> do not use the variable @SBCL_NAME@ but just sbcl.exe.
216 sbcl.exe
--core
"%maxima_image_base%.core" --noinform
%lisp_options% --end-runtime
-options
--eval
%start_maxima% --end-toplevel
-options
%*
220 "%maxima_image_base%.exe" %lisp_options% --noinform
--end-runtime
-options
--eval
"(cl-user::run)" --end-toplevel
-options
%*
224 if "%MAXIMA_SIGNALS_THREAD%" == "" (
225 set start_maxima
="(cl-user::run)"
227 set start_maxima
="(progn (load (maxima::$sconcat (namestring (pathname (maxima::maxima-getenv \"MAXIMA_PREFIX\"))) \"/bin/win_signals.lisp\")) (cl-user::run))"
229 @OPENMCL_NAME@
-I
"%maxima_image_base%" %lisp_options% -e
%start_maxima% -- %*
233 if "%MAXIMA_SIGNALS_THREAD%" == "" (
234 set start_maxima
="(cl-user::run)"
236 set start_maxima
="(progn (load (maxima::$sconcat (namestring (pathname (maxima::maxima-getenv \"MAXIMA_PREFIX\"))) \"/bin/win_signals.lisp\")) (cl-user::run))"
238 @CCL64_NAME@
-I
"%maxima_image_base%" %lisp_options% -e
%start_maxima% -- %*
243 set "MAXIMA_IMAGESDIR_BIN=%maxima_imagesdir%/binary-%lisp%"
245 java
-jar
"%MAXIMA_IMAGESDIR_BIN%/abcl.jar" %lisp_options% --eval
"(load \"%MAXIMA_IMAGESDIR_BIN%/defsystem.lisp\")" --eval
"(mk:add-registry-location \"%MAXIMA_IMAGESDIR_BIN%\")" --eval
"(funcall (intern (symbol-name :operate-on-system) :mk) \"maxima\" :load :verbose nil)" --eval
"(cl-user::run)" -- %*