anza-xyz / platform-tools

Apache License 2.0
47 stars 32 forks source link

FreeBSD support #69

Closed svenski123 closed 1 year ago

svenski123 commented 1 year ago

This PR adds support for building solana platform tools on FreeBSD. I have also cleaned up portions of the build script.

Note edits were also required to the solana-labs/rust repository - I have incorporated the edits them below in build.sh in as embedded ed scripts applied after the subordinate repository has been git cloned however they should ultimately be put in a PR to the downstream repo (assuming this PR gets merged).

Rather than use amd64 which is FreeBSD's preferred platform code, I have used x86_64 (I see this was already done for Darwin).

I have built this on FreeBSD 13.2-RELEASE-p2 GENERIC amd64; I do not have access to an FreeBSD ARM64 host and have not I tested it there.

The default version of swig on FreeBSD 13.2 is 4.1.2 which failed building lldb with a syntax error so I have used swig 4.0.2 which is available in pkg (and ports) as swig40.

I would welcome comments and suggestions as I hope this might be useful to others.

dmakarov commented 1 year ago

The script in this repo is merely to automate building the Solana toolchains on CI and releasing the precompiled toolchain binaries. We currently don't have self-hosted Actions runners, and I don't think that GitHub provides FreeBSD based runners. I appreciate your efforts, but I think at this point we are not going to support FreeBSD host for Solana toolchains.

svenski123 commented 1 year ago

Thanks for looking at this. My interest is in moving all of our Solana stuff - dev, ops, nodes, etc. - on to FreeBSD, which doesn't look too difficult. I do need platform tools on freebsd though and building it locally with this script seemed the most straightforward way. I did look through the Github CI docs quickly and you're right Github don't support FreeBSD runners - apparently one would need a self-hosted macOS runner and build the *BSD versions within a local container (i.e. docker) which is ... not great.

Certainly with little other demand there's no point in adding FreeBSD to the CI/CD pipeline but it would be nice if the platform tools could be built on *BSD out of the box.

I can reduce the PR to the essentials and leave out the other refactoring (i.e. it would be just case statement at top, realpath, CC_FOR_BUJILD and gmake) if that would help. Or put it in a separate script (build_local.sh or similar) (though seems somewhat redundant).

Or I can simply withdraw the PR if that makes the most sense here and maintain a private fork. (I suppose the real solution would be to contribute blockchain/solana to the FreeBSD Ports Collection...)

dmakarov commented 1 year ago

We can update build.sh in solana-labs/rust repository, to include FreeBSD host, so no need to patch it from this script. I'd rather not to add any targets to the script in this repository that cannot be build on CI.

svenski123 commented 1 year ago

Thanks that would be much appreciated. I'd be happy to submit the two line PR to solana-labs/rust but I don't understand the branches there as master seems to be older than solana-tools-v1.38 and setup.sh there is hardcoded for apple darwin.

dmakarov commented 1 year ago

Thanks that would be much appreciated. I'd be happy to submit the two line PR to solana-labs/rust but I don't understand the branches there as master seems to be older than solana-tools-v1.38 and setup.sh there is hardcoded for apple darwin.

You can submit to the default branch, which is solana-1.68.0 at the moment. Thank you.

svenski123 commented 1 year ago

I have opened this PR against the rust repo [https://github.com/solana-labs/rust/pull/84] and am closing this one.