[windows] about obey.bat

23 views
Skip to first unread message

Qian Yun

unread,
Mar 4, 2021, 5:37:20 AM3/4/21
to fricas...@googlegroups.com
I don't know the history of obey.bat, or if it ever worked.

My current hack is:

#+:win32 (sb-ext::process-exit-code
- (sb-ext::run-program (make-absolute-filename "/lib/obey.bat")
- (list S) :input t :output t :error t))
+ (sb-ext::run-program "C:/msys64/usr/bin/sh.exe"
+ (list "-c" S) :input t :output t :error t))


This works for msys2/mingw64 at least.

Not familiar with SBCL on windows, I wonder if there are better ways
to achieve this. (Because here I hard coded msys2 default path.)

Now, what about cygwin? Shall we try to make it able to compile
trunk version as well? Or are we satisfied with the status quo?

- Qian

Dima Pasechnik

unread,
Mar 4, 2021, 8:47:52 AM3/4/21
to fricas...@googlegroups.com
I am under impression that on Cygwin Sagemath can build FriCAS (using ECL).

>
> - Qian
>
> --
> You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to fricas-devel...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/fricas-devel/2b65c70e-f085-ebc1-f0c2-84d18deb2751%40gmail.com.

Qian Yun

unread,
Mar 4, 2021, 9:20:08 AM3/4/21
to fricas...@googlegroups.com


On 3/4/21 9:47 PM, Dima Pasechnik wrote:
> On Thu, Mar 4, 2021 at 10:37 AM Qian Yun <oldk...@gmail.com> wrote:
>>
>> I don't know the history of obey.bat, or if it ever worked.
>>
>> My current hack is:
>>
>> #+:win32 (sb-ext::process-exit-code
>> - (sb-ext::run-program (make-absolute-filename "/lib/obey.bat")
>> - (list S) :input t :output t :error t))
>> + (sb-ext::run-program "C:/msys64/usr/bin/sh.exe"
>> + (list "-c" S) :input t :output t :error t))
>>
>>
>> This works for msys2/mingw64 at least.
>>
>> Not familiar with SBCL on windows, I wonder if there are better ways
>> to achieve this. (Because here I hard coded msys2 default path.)
>>
>> Now, what about cygwin? Shall we try to make it able to compile
>> trunk version as well? Or are we satisfied with the status quo?
>
> I am under impression that on Cygwin Sagemath can build FriCAS (using ECL).
>

Yes, it can build a released tarball with pre-generated files,
not the git version.

Waldek Hebisch

unread,
Mar 6, 2021, 1:44:38 PM3/6/21
to fricas...@googlegroups.com
On Thu, Mar 04, 2021 at 06:37:06PM +0800, Qian Yun wrote:
> I don't know the history of obey.bat, or if it ever worked.
>
> My current hack is:
>
> #+:win32 (sb-ext::process-exit-code
> - (sb-ext::run-program (make-absolute-filename "/lib/obey.bat")
> - (list S) :input t :output t :error t))
> + (sb-ext::run-program "C:/msys64/usr/bin/sh.exe"
> + (list "-c" S) :input t :output t :error t))
>
>
> This works for msys2/mingw64 at least.
>
> Not familiar with SBCL on windows, I wonder if there are better ways
> to achieve this. (Because here I hard coded msys2 default path.)

Well, in principle path to shell could be configuration parameter
(we could possibly also look at environment variables, but it is
not clear if we want this).

My longer time strategy was to eliminate shell and use 'run-program'
to execute programs that we need. Of course, this means that we
need to know where the programs live. Also, some uses of external
programs were replaced by internal code.

> Now, what about cygwin? Shall we try to make it able to compile
> trunk version as well? Or are we satisfied with the status quo?

It would be better to compile trunk version. One question is
what is missing? Of course, it is for you and other folks
working on cygwin port to decide how much effort you want to
spent...

--
Waldek Hebisch

Qian Yun

unread,
Mar 7, 2021, 10:34:24 AM3/7/21
to fricas...@googlegroups.com
OK, some progress,

First, "OBEY" is only called 3 times during a default build:

sort "temp.text" > "libdb.text"
rm -f glosskey.text
rm -f gloss.ht

Second, the key for SBCL on Windows is ":search t", so I propose
the following patch:

diff --git a/src/interp/vmlisp.lisp b/src/interp/vmlisp.lisp
index c72b9781..8bcab2dd 100644
--- a/src/interp/vmlisp.lisp
+++ b/src/interp/vmlisp.lisp
@@ -757,8 +757,8 @@
(sb-ext::run-program "/bin/sh"
(list "-c" S) :input t :output t :error t))
#+:win32 (sb-ext::process-exit-code
- (sb-ext::run-program (make-absolute-filename "/lib/obey.bat")
- (list S) :input t :output t :error t))
+ (sb-ext::run-program "sh" :search t
+ (list "-c" S) :input t :output t :error t))
)

#+:openmcl

Waldek Hebisch

unread,
Mar 7, 2021, 11:23:15 AM3/7/21
to fricas...@googlegroups.com
On Sun, Mar 07, 2021 at 11:34:15PM +0800, Qian Yun wrote:
> OK, some progress,
>
> First, "OBEY" is only called 3 times during a default build:
>
> sort "temp.text" > "libdb.text"
> rm -f glosskey.text
> rm -f gloss.ht

The last two are easy to eliminate, I will do this.

> Second, the key for SBCL on Windows is ":search t", so I propose
> the following patch:
>
> diff --git a/src/interp/vmlisp.lisp b/src/interp/vmlisp.lisp
> index c72b9781..8bcab2dd 100644
> --- a/src/interp/vmlisp.lisp
> +++ b/src/interp/vmlisp.lisp
> @@ -757,8 +757,8 @@
> (sb-ext::run-program "/bin/sh"
> (list "-c" S) :input t :output t :error t))
> #+:win32 (sb-ext::process-exit-code
> - (sb-ext::run-program (make-absolute-filename "/lib/obey.bat")
> - (list S) :input t :output t :error t))
> + (sb-ext::run-program "sh" :search t
> + (list "-c" S) :input t :output t :error t))
> )
>
> #+:openmcl

It would be good if somebody using Windows comments. For me this
is OK, just people making installers need to remember to bundle
sh.

--
Waldek Hebisch

Qian Yun

unread,
Mar 7, 2021, 12:12:15 PM3/7/21
to fricas...@googlegroups.com
Small correction: put ':search t' behind '(list "-c" S)'.

Just tested, it builds fine, I'd like someone else to test this as well.

I'm not clear about "bundle sh". During building, of course we are in
a (msys2 mingw64) shell that has "sh.exe". Do you mean at run time?
We can use "OBEY" when launching FriCASsys.exe from msys2 shell.
When we click it in file browser, we can't use it because PATH not set.
Same thing should happen when we give the binary to another user.
But we shouldn't bundle "sh.exe" for that?!

Better solution of course would be to do as much as possible in SPAD
or Lisp, rather than call external process.

Waldek Hebisch

unread,
Mar 7, 2021, 5:37:36 PM3/7/21
to fricas...@googlegroups.com
On Mon, Mar 08, 2021 at 01:12:04AM +0800, Qian Yun wrote:
>
>
> On 3/8/21 12:23 AM, Waldek Hebisch wrote:
> > On Sun, Mar 07, 2021 at 11:34:15PM +0800, Qian Yun wrote:
<snip>
> > It would be good if somebody using Windows comments. For me this
> > is OK, just people making installers need to remember to bundle
> > sh.
> >
>
> Small correction: put ':search t' behind '(list "-c" S)'.
>
> Just tested, it builds fine, I'd like someone else to test this as well.
>
> I'm not clear about "bundle sh". During building, of course we are in
> a (msys2 mingw64) shell that has "sh.exe". Do you mean at run time?

Yes, in binary intallation.

> We can use "OBEY" when launching FriCASsys.exe from msys2 shell.
> When we click it in file browser, we can't use it because PATH not set.
> Same thing should happen when we give the binary to another user.
> But we shouldn't bundle "sh.exe" for that?!

Why not? Some widely used packages bundle quite a lot. Utilities
that we need (beside 'sh' we need I think 'rm', 'cp', 'grep',
'sort' and maybe few others) are tiny compared to FriCAS, so
really would not add too much bloat. Alternative strategy my
be to require 'msys' to be installed first and hardcode path
to 'msys' utilites into say 'fricas' script, so that when
FriCAS is run in whatever way it will find needed utilities
in the path. Windows users seem to expect packages that
bundle everything, so bundling may be better. Anyway,
final choice if for people making installers. We just need
to make sure that need for utilities is understood.

--
Waldek Hebisch
Reply all
Reply to author
Forward
0 new messages