Skip to content

Commit

Permalink
pages: updated news entry with build-system and packaging updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard Pospesel committed Mar 27, 2024
1 parent 7199444 commit 88aab88
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions source/pages/content/news.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

---

## 2024-03-27 - Some Cargo Annoyances

So in the previous post I mentioned using patchelf to set the [SONAME](https://en.wikipedia.org/wiki/Soname) attribute on the libcgosling.so shared library to facilitate proper debian packaging. I further mentioned this was due to an upstream cargo issue. Well, it turns out a similar issue exists for macOS binaries. Rather than playing whack-a-mole and manually fixing every single eventual build target, I took a step back and re-thought my approach and what could be done that would be most maintainable long term.

The end-result is [this](https://github.com/blueprint-freespeech/gosling/commit/9ae019efd3c5e5565287b963d09868c4ffaf5891).

To summarise, rather than manually patching and generally futzing with build outputs, I am instead only building cgosling as a static lib, and then building a shared lib using each platforms C tooling. This way, we can lean on CMake to do the heavy lifting when it comes to platform-specific metadata, symbolic-links, naming, etc. Unfortunately there is no standard way using cmake to just build a shared library which exports all of a static libraries public symbols.

As a result, I've had to do some *interesting* engineering in the cgosling crate using proc macros. Without going into too much detail, we are now building two copies of the cgosling static library, one for direct consumption by downstream projects, and another `_impl` suffixed copy whose functions have also been renamed to include an `_impl` suffix. Then, using our existing code-generation pipeline, a cgosling shared library is written which defines public functions with the names found in the generated header, which simply pass-through all arguments to the `_impl` versions. *Hopefully* the compilers will optimise away this little overhead but if not I would be surprised if it is actually a big deal.

This work has allowed me to pretty rapidly and confidently implement both an [Homebrew Formula](https://github.com/blueprint-freespeech/gosling/commit/1435386ba6f826dd73096fa4dbaa4cc8f460af6e) for macOS (and Linux) and a [PKGBUILD](https://github.com/blueprint-freespeech/gosling/commit/b3e59159da503da2d37efd948843681667979ce3) script for msys2 Windows environments.

## 2024-02-28 - Debian Source Packages

This past week I've been diving into the wonderful world of debian packaging. Specifically, constructing a debian source package via CMake which can be used to build the cgosling library from source, and generate both binary and dev packages.
Expand Down

0 comments on commit 88aab88

Please sign in to comment.