Skip to content

Commit

Permalink
btrfs-progs: allow to build without python bindings
Browse files Browse the repository at this point in the history
Python cross-compilation is quite difficult, and doesn't work in
several situations, such as:

#186525

Let's give people the option of cross-compiling `btrfs-progs` to
hostPlatforms for which we cannot cross-compile python.  Unfortunately
btrfs-progs insists on a special configure flag `--disable-python`;
simply being unable to find python isn't enough.
  • Loading branch information
Adam Joseph committed Sep 1, 2022
1 parent b57e495 commit 28b3398
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions pkgs/tools/filesystems/btrfs-progs/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
, runCommand, btrfs-progs
, gitUpdater
, udevSupport ? true
, enablePython ? true
}:

stdenv.mkDerivation rec {
Expand All @@ -18,7 +19,9 @@ stdenv.mkDerivation rec {

nativeBuildInputs = [
pkg-config
] ++ lib.optionals enablePython [
python3 python3.pkgs.setuptools
] ++ [
sphinx
];

Expand All @@ -32,12 +35,17 @@ stdenv.mkDerivation rec {
install -v -m 444 -D btrfs-completion $out/share/bash-completion/completions/btrfs
'';

configureFlags = lib.optional stdenv.hostPlatform.isMusl "--disable-backtrace"
++ lib.optional (!udevSupport) "--disable-libudev";
configureFlags = lib.optionals stdenv.hostPlatform.isMusl [
"--disable-backtrace"
] ++ lib.optionals (!enablePython) [
"--disable-python"
] ++ lib.optionals (!udevSupport) [
"--disable-libudev"
];

makeFlags = [ "udevruledir=$(out)/lib/udev/rules.d" ];

installFlags = [ "install_python" ];
installFlags = lib.optionals enablePython [ "install_python" ];

enableParallelBuilding = true;

Expand Down

0 comments on commit 28b3398

Please sign in to comment.