Skip to content

FreeBSD workflow for SourceBuild #5035

@arrowd

Description

@arrowd

As requested by @tmds in dotnet/runtime#114285 (comment) here are how we build dotnet in FreeBSD Ports.

A port in FreeBSD terminology is a build recipe that provides a compiled binary package from a source archive called the "distfile". A port may have multiple distfiles and is subject to following restrictions:

  • All the distfiles should be explicitly enumerated along with their size and checksums
  • No networking is allowed during the build (this is achieved by running the build in a container env with networking shut down)

So, in case of .NET port its distfiles are:

  1. A source archive for a given tag from https://github.com/dotnet/dotnet
  2. release.json from the same repo
  3. Bootstrap distfiles that look like Private.SourceBuilt.Artifacts.9.0.103-servicing.25071.1.freebsd-x64.tar.gz:bootstrap and dotnet-sdk-9.0.103-freebsd-x64.tar.gz.

Bootstrap distfiles are currently obtained from the build of a previous version of the same port and then uploaded to https://github.com/sec/dotnet-core-freebsd-source-build/releases/ (don't mind scripts in that repo, these are old).

The build itself is executed by running build.sh: https://github.com/freebsd/freebsd-ports/blob/5e8551be6b3625e7ae34342268638e9066b48d5b/lang/dotnet/Makefile#L112

Now the important thing is that we want to have a single bootstrap binaries for all supported FreeBSD versions. This is usually achieved by compiling on a oldest FreeBSD release available, but it didn't work for .NET out of the box, because FreeBSD contains OpenSSL in its base and different FreeBSD versions may contain different OpenSSL versions. After some digging I found out that it is possible to pass /p:PortableBuild=true to build.sh, which makes resulting binaries have the simple 'freebsd-x64` RID and dynamically dispatch calls to OpenSSL without depending on a specific library version.

So to sum this up, it'd be great to have an ability to ask the build system to produce a single bootstrap distfile, which can then be fed to the same build system to build a full version of .NET.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions