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 For what directory was Maxima configured? Set %prefix% to exactly that directory, if
24 rem Maxima was installed in the default path (= %configureprefix%/bin/maxima.bat exists).
25 rem %~dp0/.. should be the same, but is something like the 8.3 short path - and that
26 rem causes problems with Xmaxima and Clisp.
27 rem (the combination will not work if Maxima is installed somewhere else, but that is not recommended)
29 set "configureprefix=@prefix@"
30 if exist "%configureprefix%/bin/maxima.bat" set "prefix=%configureprefix%"
32 rem change "\" to "/" in that path. Works too and causes less troubles (e.g. with xmaxima).
33 set "prefix=%prefix:\=/%"
34 set "maxima_prefix=%prefix%"
35 set "package=@PACKAGE@"
37 set "path=%maxima_prefix%/gnuplot;%maxima_prefix%/gnuplot/bin;%maxima_prefix%/bin;%maxima_prefix%/vtk;%path%"
39 rem set userdir and tempdir - replace "\" with "/"
40 if not defined MAXIMA_USERDIR
set "MAXIMA_USERDIR=%USERPROFILE:\=/%/maxima"
41 if not defined MAXIMA_TEMPDIR
set "MAXIMA_TEMPDIR=%TEMP:\=/%"
42 rem there were reports, that the tempdir could not be found (maybe because of special characters, ut8-chars, ...)
43 rem so set a fallback (as it was before)
44 if not exist "%MAXIMA_TEMPDIR%"/ set "MAXIMA_TEMPDIR=%USERPROFILE:\=/%"
46 rem change 'short names' (e.g. "C:/Users/TESTTE~1/AppData/Local/Temp" to
47 rem long names (e.g. "C:/Users/test test/AppData/Local/Temp" -
48 rem CLISP has a problem with these short names.
49 rem Do this only if maxima_longnames.exe exists in the Maxima binary dir.
50 rem (it is not compiled and installed for example when a Lisp-only build is done).
51 if exist "%maxima_prefix%/bin/maxima_longnames.exe" for /F
"tokens=* USEBACKQ" %%F in
(`maxima_longnames.exe
"%MAXIMA_TEMPDIR%"`
) do set "MAXIMA_TEMPDIR=%%F"
54 rem read maximarc and set the Lisp type, if the user did specify MAXIMA_LISP
55 rem currently no comments or other (Unix shell) commands are understood, only (e.g):
57 if EXIST "%MAXIMA_USERDIR%/maximarc" (
58 setlocal enabledelayedexpansion
59 for /F usebackq
%%L in
("%MAXIMA_USERDIR%/maximarc") do (
61 set lisp
=!MAXIMA_LISP
!
65 rem In order to allow maxima to find out where its files are on MS Windows maxima needs
66 rem to be started in the directory it can be found in. Which in the case of
67 rem maxima-portable might be a different folder every time.
68 rem The user, though, might want it to start in the folder the worksheet lies in, as
69 rem read_matrix, write_data etc. should be relative to that folder.
70 rem common lisp doesn't provide such a function and clisp has problems with shortnames
71 rem while sbcl has problems with non-ascii-non-unicode folder names.
72 rem The variable MAXIMA_INITIAL_FOLDER tells which folder to start maxima in
73 rem after searching for the files it is composed of.
74 if defined MAXIMA_INITIAL_FOLDER
cd "%MAXIMA_INITIAL_FOLDER%"
77 if x
%1 == x
-l
goto foundlisp
78 if x
%1 == x
--lisp
goto foundlisp
79 if x
%1 == x
-u
goto foundversion
80 if x
%1 == x
--use-version
goto foundversion
81 if x
%1 == x
-v
goto foundverbose
82 if x
%1 == x
--verbose
goto foundverbose
83 if x
%1 == x
--lisp
-options
goto foundlispoptions
84 if x
%1 == x
--userdir
goto founduserdir
85 if x
%1 == x
-X
goto foundlispoptions
89 if not x
%1 == x
goto startparseargs
96 goto continueparseargs
99 set "MAXIMA_USERDIR=%~2"
101 goto continueparseargs
106 goto continueparseargs
111 goto continueparseargs
115 goto continueparseargs
119 if "%MAXIMA_LAYOUT_AUTOTOOLS%" == "" goto defaultlayout
120 set layout_autotools
=true
124 set layout_autotools
=@default_layout_autotools@
128 if "%MAXIMA_PREFIX%" == "" goto defaultvars
129 if "%layout_autotools%" == "true" goto maxim_autotools
130 set "maxima_imagesdir=%MAXIMA_PREFIX%/src"
134 set "maxima_imagesdir=%MAXIMA_PREFIX%/lib/%package%/%version%"
138 if "%layout_autotools%" == "true" goto defmaxim_autotools
139 set "maxima_imagesdir=%prefix%/src"
143 set "maxima_imagesdir=%prefix%/lib/%package%/%version%"
148 set "maxima_image_base=%maxima_imagesdir%/binary-%lisp%/maxima"
150 if "%verbose%" == "true" @
echo on
151 if "%lisp%" == "gcl" goto dogcl
152 if "%lisp%" == "clisp" goto doclisp
153 if "%lisp%" == "ecl" goto doecl
154 rem Allow ccl as an alias of openmcl
155 if "%lisp%" == "ccl" set lisp
=openmcl
156 if "%lisp%" == "openmcl" goto doopenmcl
157 if "%lisp%" == "ccl64" goto doccl64
158 if "%lisp%" == "sbcl" goto dosbcl
159 if "%lisp%" == "abcl" goto doabcl
161 @
echo Maxima error
: Lisp
%lisp% not known.
165 set "path=%maxima_prefix%/lib/gcc-lib/mingw32/@GCCVER@;%path"
166 "%maxima_image_base%.exe" -eval
"(cl-user::run)" %lisp_options% -f
-- %*
170 if exist "%maxima_image_base%.exe" goto doclisp_exec
172 if "%layout_autotools%" == "true" goto clisp_autotools
173 @CLISP_NAME@
%lisp_options% -q
-M
"%maxima_image_base%.mem" "" -- %*
177 rem ./configure sets a variable @CLISP_NAME@ which might be used instead of lisp.exe,
178 rem but when Maxima is crosscompiled on Linux, a shell script is used as 'crosscompiler',
179 rem which would be inserted here ==> do not use the variable @CLISP_NAME@ but just lisp.exe.
180 set "path=%maxima_imagesdir%/binary-%lisp%;%maxima_prefix%/clisp-2.49/base;%path%"
181 lisp.exe
%lisp_options% -q
-M
"%maxima_image_base%.mem" "" -- %*
185 "%maxima_image_base%.exe" %lisp_options% -q
"" -- %*
189 @ECL_NAME@
-load
%maxima_image_base%.fas
%lisp_options% -eval
"(user::run)" -- %*
192 rem SBCL Steel Bank Common Lisp
194 rem run executable image if it exists
195 if exist "%maxima_image_base%.exe" goto dosbcl_exec
196 if "%MAXIMA_SIGNALS_THREAD%" == "" (
197 set start_maxima
="(cl-user::run)"
199 set start_maxima
="(progn (load (maxima::$sconcat (namestring (pathname (maxima::maxima-getenv \"MAXIMA_PREFIX\"))) \"/bin/win_signals.lisp\")) (cl-user::run))"
202 rem At least in the crosscompiled installer, SBCL_HOME is not defined - set it here
203 if not defined SBCL_HOME
if exist "%maxima_prefix%/bin/sbcl.exe" set "SBCL_HOME=%~dp0"
205 rem Only on 64bit: if using sbcl (and the user does not specify anything else(!))
206 rem set the dynamic-space-size to 2GB so that load("lapack") will work.
207 rem The check for a 64 bit build is done by checking the name of the Mingw libgcc name
208 rem (which is libgcc_s_seh-1.dll for 64 and libgcc_s_sjlj-1.dll for 32 bit)
209 if exist "%maxima_prefix%/bin/libgcc_s_seh-1.dll" (
210 if "%lisp_options%"=="" set lisp_options
=--dynamic
-space
-size^
2000
212 rem I am a
32 bit build
- the SBCL workaround
for load
(lapack
) will
not work
215 rem ./configure sets a variable @SBCL_NAME@ which might be used instead of sbcl.exe,
216 rem but when Maxima is crosscompiled on Linux, a shell script is used as 'crosscompiler',
217 rem which would be inserted here ==> do not use the variable @SBCL_NAME@ but just sbcl.exe.
218 sbcl.exe
--core
"%maxima_image_base%.core" --noinform
%lisp_options% --end-runtime
-options
--eval
%start_maxima% --end-toplevel
-options
%*
221 "%maxima_image_base%.exe" %lisp_options% --noinform
--end-runtime
-options
--eval
"(cl-user::run)" --end-toplevel
-options
%*
225 if "%MAXIMA_SIGNALS_THREAD%" == "" (
226 set start_maxima
="(cl-user::run)"
228 set start_maxima
="(progn (load (maxima::$sconcat (namestring (pathname (maxima::maxima-getenv \"MAXIMA_PREFIX\"))) \"/bin/win_signals.lisp\")) (cl-user::run))"
230 @OPENMCL_NAME@
-I
"%maxima_image_base%" %lisp_options% -e
%start_maxima% -- %*
234 if "%MAXIMA_SIGNALS_THREAD%" == "" (
235 set start_maxima
="(cl-user::run)"
237 set start_maxima
="(progn (load (maxima::$sconcat (namestring (pathname (maxima::maxima-getenv \"MAXIMA_PREFIX\"))) \"/bin/win_signals.lisp\")) (cl-user::run))"
239 @CCL64_NAME@
-I
"%maxima_image_base%" %lisp_options% -e
%start_maxima% -- %*
244 set "MAXIMA_IMAGESDIR_BIN=%maxima_imagesdir%/binary-%lisp%"
246 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)" -- %*
251 rem Restore environment variables