-
Notifications
You must be signed in to change notification settings - Fork 18k
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
Nix build system for ardupilot #24178
base: master
Are you sure you want to change the base?
Changes from 3 commits
a3badf8
29c58f9
764216b
917c694
e48ac1c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
inputs = { | ||
nixpkgs.url = "nixpkgs/nixos-unstable"; | ||
flake-utils.url = "github:numtide/flake-utils"; | ||
}; | ||
outputs = inputs@{ flake-utils, ... }: | ||
flake-utils.lib.meld inputs [ | ||
./nix | ||
]; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
{ self, flake-utils, nixpkgs, ... }: | ||
let supported-systems = with flake-utils.lib.system; [ x86_64-linux ]; | ||
in flake-utils.lib.eachSystem supported-systems (system: | ||
let | ||
pkgs = import nixpkgs { inherit system; }; | ||
python = (pkgs.python39.withPackages | ||
(ps: with ps; [ setuptools future pexpect empy ])); | ||
in { | ||
packages.ardupilot = pkgs.pkgsCross.arm-embedded.stdenv.mkDerivation { | ||
name = "ardupilot"; | ||
src = builtins.fetchGit { | ||
url = "https://github.com/ArduPilot/ardupilot.git"; | ||
rev = "df2be63e21217b626be53c7c9e98f37410b12126"; | ||
ref = "Rover-4.4"; | ||
submodules = true; | ||
}; | ||
hardeningDisable = [ "all" ]; | ||
buildInputs = [ python pkgs.git pkgs.rsync pkgs.gcc ]; | ||
nativeBuildInputs = [ | ||
python | ||
pkgs.git | ||
pkgs.rsync | ||
pkgs.gcc-arm-embedded | ||
pkgs.gcc_multi | ||
pkgs.wafHook | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ? Not need |
||
]; | ||
patches = [ | ||
./patches/ardusim_patches/runnable_status.patch | ||
./patches/ardusim_patches/remove_gcc_Werror.patch | ||
./patches/ardusim_patches/fake_git_rev.patch | ||
]; | ||
wafPath = "modules/waf/waf-light"; | ||
wafConfigureFlags = [ "--board CubeOrangePlus" ]; | ||
wafFlags = [ "rover" ]; | ||
postInstall = '' | ||
cp -r build/CubeOrangePlus/bin/* $out/bin/. | ||
''; | ||
system = builtins.currentSystem; | ||
}; | ||
packages.ardupilot-fw-flasher = pkgs.stdenv.mkDerivation { | ||
name = "ardupilot-fw-flasher"; | ||
src = builtins.fetchGit { | ||
url = "https://github.com/ArduPilot/ardupilot.git"; | ||
rev = "df2be63e21217b626be53c7c9e98f37410b12126"; | ||
ref = "Rover-4.4"; | ||
submodules = true; | ||
}; | ||
dontBuild = true; | ||
|
||
buildInputs = [ python ]; | ||
|
||
installPhase = '' | ||
mkdir -p $out/bin | ||
cp Tools/scripts/uploader.py $out/bin/ardupilot-fw-flasher | ||
''; | ||
}; | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ self, flake-utils, nixpkgs, ... }: | ||
let supported-systems = with flake-utils.lib.system; [ | ||
x86_64-linux | ||
aarch64-linux | ||
aarch64-darwin | ||
]; | ||
in flake-utils.lib.eachSystem supported-systems (system: | ||
let | ||
pkgs = import nixpkgs { inherit system; }; | ||
inherit (pkgs) lib; | ||
python = (pkgs.python39.withPackages | ||
(ps: with ps; [ setuptools future pexpect empy ])); | ||
in { | ||
packages = flake-utils.lib.flattenTree { | ||
ardusim = pkgs.stdenv.mkDerivation { | ||
name = "ardusim"; | ||
src = builtins.fetchGit { | ||
url = "https://github.com/ArduPilot/ardupilot.git"; | ||
rev = "df2be63e21217b626be53c7c9e98f37410b12126"; | ||
ref = "Rover-4.4"; | ||
submodules = true; | ||
}; | ||
buildInputs = [ python pkgs.git pkgs.rsync pkgs.gcc ]; | ||
|
||
nativeBuildInputs = [ pkgs.wafHook ]; | ||
patches = [ | ||
./patches/runnable_status.patch | ||
./patches/remove_gcc_Werror.patch | ||
./patches/fake_git_rev.patch | ||
]; | ||
wafPath = "modules/waf/waf-light"; | ||
wafConfigureFlags = [ "--board sitl" ]; | ||
wafFlags = [ "rover" ]; | ||
postInstall = | ||
" mv Tools/autotest/default_params/rover.parm $out/.;\n mv Tools/mavproxy_modules/ $out/.;\n"; | ||
system = builtins.currentSystem; | ||
}; | ||
}; | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
inputs@{ flake-utils, ... }: | ||
flake-utils.lib.meld inputs [ ./ardupilot-firmware.nix ./ardupilot-sim.nix] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
diff --git a/Tools/ardupilotwaf/git_submodule.py b/Tools/ardupilotwaf/git_submodule.py | ||
index be28216e9c..71ab1f9c33 100644 | ||
--- a/Tools/ardupilotwaf/git_submodule.py | ||
+++ b/Tools/ardupilotwaf/git_submodule.py | ||
@@ -157,6 +157,7 @@ def git_submodule_post_fun(bld): | ||
bld.add_post_fun(_post_fun) | ||
|
||
def _git_head_hash(ctx, path, short=False): | ||
+ return "2388afcd" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That is wrong, fix the build environment to build correctly... |
||
cmd = [ctx.env.get_flat('GIT'), 'rev-parse'] | ||
if short: | ||
cmd.append('--short=8') |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
diff --git a/libraries/AP_Scripting/wscript b/libraries/AP_Scripting/wscript | ||
index 479fcfe387..f3eb39dcbd 100644 | ||
--- a/libraries/AP_Scripting/wscript | ||
+++ b/libraries/AP_Scripting/wscript | ||
@@ -8,7 +8,7 @@ from waflib.TaskGen import after_method, before_method, feature | ||
import os | ||
|
||
# these are only used for binding generation, not compilation of the library | ||
-BINDING_CFLAGS="-std=c99 -Wno-error=missing-field-initializers -Wall -Werror -Wextra" | ||
+BINDING_CFLAGS="-std=c99 -Wno-error=missing-field-initializers -Wall -Wextra" | ||
BINDING_CC="gcc" | ||
|
||
def configure(cfg): |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
diff --git a/Tools/ardupilotwaf/git_submodule.py b/Tools/ardupilotwaf/git_submodule.py | ||
index be28216e9c..ee46c11185 100644 | ||
--- a/Tools/ardupilotwaf/git_submodule.py | ||
+++ b/Tools/ardupilotwaf/git_submodule.py | ||
@@ -69,11 +69,12 @@ class update_submodule(Task.Task): | ||
return out.strip() == head | ||
|
||
def runnable_status(self): | ||
+ self.non_fast_forward = [] | ||
+ return Task.SKIP_ME | ||
e = self.env.get_flat | ||
cmd = e('GIT'), 'submodule', 'status', '--recursive', '--', e('SUBMODULE_PATH') | ||
out = self.generator.bld.cmd_and_log(cmd, quiet=Context.BOTH, cwd=self.cwd) | ||
|
||
- self.non_fast_forward = [] | ||
|
||
# git submodule status uses a blank prefix for submodules that are up | ||
# to date |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/nix/store/qciia3l1kmjq5y8mdnsxqypxgqcgk9zs-ardusim | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems files to add to gitignore |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/nix/store/48h7ymfg49vg29f1viamb17hkxqcg28s-ardusim |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That isn't our toolchain