From fa6ab8cf94a9dc5370c25798897e5e1d1ff63703 Mon Sep 17 00:00:00 2001 From: Space Banana Date: Thu, 14 Mar 2024 09:34:32 +0000 Subject: [PATCH] Add installation guide for FreeBSD (#2793) * Update package.md * Update website/docs/commands/package.md * Added FreeBSD installation information * Improvements and changes to FreeBSD installation doc * Small improvements to FreeBSD install guide * Small fix to FreeBSD guide * Apply suggestions from code review Co-authored-by: Piotr Chabelski * Website compilation error fix * Added FreeBSD installation information Improvements and changes to FreeBSD installation doc Small improvements to FreeBSD install guide Small fix to FreeBSD guide Apply suggestions from code review Co-authored-by: Piotr Chabelski Website compilation error fix --------- Co-authored-by: Piotr Chabelski --- website/docs/_advanced_install.mdx | 50 ++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/website/docs/_advanced_install.mdx b/website/docs/_advanced_install.mdx index 57def4b36e..f39d8437ec 100644 --- a/website/docs/_advanced_install.mdx +++ b/website/docs/_advanced_install.mdx @@ -13,10 +13,12 @@ import {currentOs} from "../src/components/osUtils"; {label: 'Windows', value: 'windows'}, {label: 'MacOs', value: 'mac'}, {label: 'Linux', value: 'linux'}, + {label: 'BSD (experimental)', value: 'bsd'}, ]}> + @@ -31,6 +33,7 @@ values={[ {label: 'Windows', value: 'windows'}, {label: 'MacOs', value: 'mac'}, {label: 'Linux', value: 'linux'}, +{label: 'BSD', value: 'bsd'}, ]} > @@ -251,6 +254,7 @@ winget install virtuslab.scalacli + + + + + + +FreeBSD support (and support for other BSDs) is currently experimental and not stable. Scala CLI is not being distributed for FreeBSD, but you can install it via Coursier's standalone JAR. + +Before running Coursier and installing Scala CLI, make sure you have Java 17 or higher installed and in your $PATH: +```bash +pkg install openjdk17 +``` +Note: Java 17 has to be installed manually on BSD systems at this time. + +Download Coursier via the [Any JAR option](https://get-coursier.io/docs/cli-installation#latest-launchers). + +After downloading Coursier, you can use it to install Scala CLI: +```console +chmod +x coursier +./coursier install scala-cli +``` +Scala CLI is now installed on your system. It is installed as a JAR rather than a native binary, and so the startup time is slightly longer. + +To run scala-cli anywhere on your system, you need to add its binary path to the $PATH variable. For a given **user-directory**: +```bash +export PATH="$PATH:/home/user-directory/.local/share/coursier/bin" +``` +Add this command to your shell's RC file to make the setting permanent. + +Depending on the Java distribution you are using, it has been observed that Bloop (the build server used by Scala CLI) may have trouble starting on FreeBSD. You may try to customise Bloop JVM options with the `BLOOP_JAVA_OPTS` environment variable. Alternatively, you may skip using the build server altogether and use the compiler directly by passing the `--server=false` option. Please note that doing this will noticably extend project build times. + +```bash +scala-cli run -e 'println("Hello FreeBSD")' --server=false +``` + +Any features relying on third-party JVMs (such as ```--jvm``` and ```package --native-image```) may not work on FreeBSD, as those JVMs may not have BSD distributions provided. They may be made to work when a compatible JVM path is provided directly (refer to individual sub-commands' `--help`). + + + + +