Skip to content

Improve Kawa library path finding#1079

Open
Retropikzel wants to merge 4 commits intoashinn:masterfrom
Retropikzel:kawa-path-fixes
Open

Improve Kawa library path finding#1079
Retropikzel wants to merge 4 commits intoashinn:masterfrom
Retropikzel:kawa-path-fixes

Conversation

@Retropikzel
Copy link
Contributor

Kawa binary sets first item of CLASSPATH to be, on default install, /usr/local/share/lib/kawa/kawa.jar. So the library install path can be taken from there. It now works even when Kawa is not installed with default configuration.

Additionally --install-prefix option is also added before the install path.

(display "(import (scheme base) (scheme write) (scheme process-context))")
(newline)
(display "(display (get-environment-variable \"CLASSPATH\"))")))
(process->string `(kawa ,tmp-path))))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just

(process->string `(kawa -e "(display (get-environment-variable \"CLASSPATH\"))"))

should work. Also try to fall back to something reasonable if this command fails.

Copy link
Contributor Author

@Retropikzel Retropikzel Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kawa (the binary startup script) sets first item of CLASSPATH to be /usr/local/share/kawa/lib/kawa.jar. And adds any additional classpaths after that. So by default the value is /usr/local/share/kawa/lib/kawa.jar:. With CLASSPATH=/userclasspath kawa it is then /usr/local/share/kawa/lib/kawa.jar:/userclasspath.

I think splitting the CLASSPATH by .. Then checking that first item ends with kawa. If not return default, if it does remove kawa from end and return that. Should work. On windows the separator is ;, so this gets around that too.

(string-split
(process->string
`(kawa -e "(display (get-environment-variable \"CLASSPATH\"))"))
#\.)))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Splitting on dot won't work, e.g. I have /kawa-3.1.1/ in my path. How about splitting on : and dropping the kawa.jar?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thank you! I'll make it split on : and drop kawa.jar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants