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

libiio: disable Python for static builds #248412

Merged
1 commit merged into from
Aug 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions pkgs/development/libraries/libiio/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
, flex
, bison
, libxml2
, python
, pythonSupport ? stdenv.hostPlatform.hasSharedLibraries, python
, libusb1
, avahiSupport ? true, avahi
, libaio
Expand All @@ -19,7 +19,8 @@ stdenv.mkDerivation rec {
pname = "libiio";
version = "0.24";

outputs = [ "out" "lib" "dev" "python" ];
outputs = [ "out" "lib" "dev" ]
++ lib.optional pythonSupport "python";

src = fetchFromGitHub {
owner = "analogdevicesinc";
Expand All @@ -37,8 +38,9 @@ stdenv.mkDerivation rec {
flex
bison
pkg-config
] ++ lib.optionals pythonSupport ([
python
] ++ lib.optional python.isPy3k python.pkgs.setuptools;
] ++ lib.optional python.isPy3k python.pkgs.setuptools);

buildInputs = [
libxml2
Expand All @@ -49,25 +51,26 @@ stdenv.mkDerivation rec {

cmakeFlags = [
"-DUDEV_RULES_INSTALL_DIR=${placeholder "out"}/lib/udev/rules.d"
"-DPython_EXECUTABLE=${python.pythonForBuild.interpreter}"
"-DPYTHON_BINDINGS=on"
# osx framework is disabled,
# the linux-like directory structure is used for proper output splitting
"-DOSX_PACKAGE=off"
"-DOSX_FRAMEWORK=off"
] ++ lib.optionals pythonSupport [
"-DPython_EXECUTABLE=${python.pythonForBuild.interpreter}"
"-DPYTHON_BINDINGS=on"
] ++ lib.optionals (!avahiSupport) [
"-DHAVE_DNS_SD=OFF"
];

postPatch = ''
# Hardcode path to the shared library into the bindings.
sed "s#@libiio@#$lib/lib/libiio${stdenv.hostPlatform.extensions.sharedLibrary}#g" ${./hardcode-library-path.patch} | patch -p1

substituteInPlace libiio.rules.cmakein \
--replace /bin/sh ${runtimeShell}
'' + lib.optionalString pythonSupport ''
# Hardcode path to the shared library into the bindings.
sed "s#@libiio@#$lib/lib/libiio${stdenv.hostPlatform.extensions.sharedLibrary}#g" ${./hardcode-library-path.patch} | patch -p1
'';

postInstall = ''
postInstall = lib.optionalString pythonSupport ''
# Move Python bindings into a separate output.
moveToOutput ${python.sitePackages} "$python"
'';
Expand Down
5 changes: 4 additions & 1 deletion pkgs/top-level/python-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5882,7 +5882,10 @@ self: super: with self; {
inherit (pkgs.config) cudaSupport;
};

libiio = (toPythonModule (pkgs.libiio.override { inherit python; })).python;
libiio = (toPythonModule (pkgs.libiio.override {
pythonSupport = true;
inherit python;
})).python;

libkeepass = callPackage ../development/python-modules/libkeepass { };

Expand Down