At Wed, 26 May 2021 14:09:57 +0200, "Jesse Alama" wrote:
> On Sun, May 23, 2021, at 7:05 PM, Matthew Flatt wrote:
>
> > At Sat, 22 May 2021 08:09:53 -0700 (PDT), "
je...@lisp.sh" wrote:
> > > Is there any interest in having a FreeBSD installation alongside the
> > > macOS, Windows, and Linux?
> >
> > I'm not sure how ready the John (the release manager) will be to add a
> > new platform, but I'm willing to give it a try at the Utah snapshot.
> > The main obstacle is maintaining a FreeBSD build environment. Maybe a
> > good possibility is to have a Docker image for Linux that is set up for
> > cross compilation to FreeBSD. Then, given the right `configure` flags
> > to make the cross build work, it should be relatively easy to add it to
> > the Utah build. If you think that's promising and can work out the
> > Docker image and `configurge` arguments, I can drop it in.
>
> OK, I'll take a look at that. Can you point me to the existing setup,
> with its ./configure script and Docker image for the existing setup?
>
> Alternatively, one thing I'm happy to do would be to make a shell
> script that fires up a vanilla FreeBSD machine, downloads the source
> for 8.1, builds it and installs it into a fresh directory. The
> infrastructure wouldn't need to be online all the time; you'd use the
> script I have in mind only once per release (possibly multiple times,
> in case the build fails or some tests break).
Builds are driven using the `distro-build` package:
https://docs.racket-lang.org/distro-build/index.html
You don't really need to look at that except as much as it's helpful to
provide context. It means that these parts are taken care of:
* spinning up a Docker container
* downloading a Git checkout to container
* driving the Racket makefiles in cross-compilation mode
The part we need is an image where `git` and cross-compile tools work,
plus the arguments to pass to `configure`. (The image doesn't need to
have the Racket sources or repo checked out.) So, it's mostly a matter
of figuring out the things to include in an image and figuring out what
`configure` command works to cross compile.
See the "Cross-compiling" section of "racket/src/README.txt" for more
about cross compilation. A set of `configure` arguments that includes
`--enable-racket=auto` will let us plug into the `distro-build`
configuration easily.
As an example, the 32-bit ARMv6 Linux builds at the Utah snapshot
needed two pieces:
* Raspberry Pi tools installed in "/home/racket/pi-tools" and `PATH`
set to include
/home/racket/pi-tools/arm-bcm2708/\
gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/
* The `configure` argument `--host=arm-linux-gnueabihf`, which causes
the build to use `arm-linux-gnueabihf-gcc`, etc.
I think a FreeBSD cross compile might involve specifying `CFLAGS=...`
and `LDFLAGS=...` in addition to `--host=` and/or `--enable-target=`.
The `distro-build` scripts can also drive a VirtualBox instance instead
of a Docker container. That's how some snapshots are currently built.
Docker containers are much easier to drop into place, though, which is
why I suggest that route if possible.
Matthew