Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Nix for building #21

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Use Nix for building #21

wants to merge 3 commits into from

Conversation

xeniagda
Copy link

@xeniagda xeniagda commented Feb 4, 2024

The current build process for building the fox32 suite of software (fox32asm, fox32rom, tools (gfx2inc), fox32os and the fox32 emulator) is a bit messy. The dependencies between projects are not documented too well and compatible versions between the tools (mostly fox32os, fox32rom and fox32asm) aren't very clear. The easiest way to figure out how to build all the software (IMO) is looking at the GitHub workflows.

I have added Nix Flakes to these tools, specifying dependencies to libraries and between themselves. I host the repositories at my own Gitea instance (githug.xyz) but they are mirrored at GitHub:

Most of these have an unmodified or lightly modified Makefile, and can be built without Nix just like before. All of them build, you can run nix run github:xenia/fox32-mirror (with needing to even clone the repo) or nix run github:xenia/fox32-mirror#fox32-with-os to launch it with Fox32OS loaded (disk stored in /tmp/fox32os.img).

Things that need to be implemented/resolved before merge / other noteworthy stuff:

Notes about specific projects:

  • fox32asm and tools/gfx2inc: removed the vergen dependency for the Rust projects (fox32asm and gfx2inc), instead setting the env variables with Nix. If built without nix, the version will default to (dev)
  • fox32asm: very messy commit history, needs to be cleaned up
  • fox32rom: has two outputs, one for the built binary rom and one which only includes the .def file
  • fox32os: We move the fox32asm and fox32rom dependency from outside the repo to inside it. That is, one needs to put them in ./fox32asm/ and ./fox32rom/ instead of ../fox32asm and ../fox32rom.
  • fox32 (emulator): no cputest run in workflow (this should be added as a check in the Nix Flake)
  • fox32 (emulator): Only build for linux (and Mac), no Windows or Wasm support and the Makefile has been slightly mangled. Should fix at least the wasm/emcc compile before merge.

@xeniagda
Copy link
Author

xeniagda commented Feb 4, 2024

Leaving this comment as a TODO-list before everything can be merged:

Hard things

  • Windows support (fox32, fox32asm, gfx2inc)

Easy/medium things:

  • emcc support for fox32
  • cputest for fox32
  • Update documentation (mostly for building)
    • fox32asm and gfx2inc can still be built with cargo
    • fox32rom can still be built with fox32asm
    • fox32os needs fox32asm and fox32rom in new locations
  • rebase commit history in fox32asm
  • Investigate further into binary patching: at the moment, the binaries compiled with nix have nix-specific paths in some dependencies. Currently it's only the C and Rust projects that are affected, and they only have their interpreter (linker) set to nix-specific locations. We use the nix tool patchelf in a build step in the GitHub workflow to ensure they're set to the more conventional location, and everything seems to run on a mainstream Linux distro, but ideally we should look into something more robust.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant