Skip to content

Commit

Permalink
freebsd: Add support for aarch64
Browse files Browse the repository at this point in the history
Add a new `aarch64-freebsd` double and example system,
then fix include and libc to work.
This is enough to build packages like `hello`,
either static or dynamic.

This is useful for testing nix FreeBSD on a Raspberry Pi.
  • Loading branch information
artemist committed Nov 22, 2024
1 parent 8d5c3ef commit 151028f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/systems/doubles.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ let
"x86_64-darwin" "i686-darwin" "aarch64-darwin" "armv7a-darwin"

# FreeBSD
"i686-freebsd" "x86_64-freebsd"
"i686-freebsd" "x86_64-freebsd" "aarch64-freebsd"

# Genode
"aarch64-genode" "i686-genode" "x86_64-genode"
Expand Down
5 changes: 5 additions & 0 deletions lib/systems/examples.nix
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,11 @@ rec {

# BSDs

aarch64-freebsd = {
config = "aarch64-unknown-freebsd";
useLLVM = true;
};

x86_64-freebsd = {
config = "x86_64-unknown-freebsd";
useLLVM = true;
Expand Down
3 changes: 3 additions & 0 deletions pkgs/os-specific/bsd/freebsd/pkgs/include/package.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
stdenv,
lib,
mkDerivation,
buildPackages,
Expand All @@ -14,6 +15,8 @@ mkDerivation {
"contrib/libc-vis"
"etc/mtree/BSD.include.dist"
"sys"
] ++ lib.optionals stdenv.isAarch64 [
"lib/msun/arm"
];

extraNativeBuildInputs = [
Expand Down
2 changes: 2 additions & 0 deletions pkgs/os-specific/bsd/freebsd/pkgs/libc/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ mkDerivation {
"include/paths.h"

"lib/libdl"
] ++ lib.optionals stdenv.hostPlatform.isAarch64 [
"contrib/arm-optimized-routines"
];

postPatch = ''
Expand Down

0 comments on commit 151028f

Please sign in to comment.