about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/libfive
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2023-11-16 12:53:32 +0100
committerAlyssa Ross <hi@alyssa.is>2023-11-16 12:53:32 +0100
commit67419f0e56f99b0ebbe14574d3492110ac84c8d6 (patch)
tree3abc8e1606a2c80b6f5d14fef175e50800202163 /nixpkgs/pkgs/development/libraries/libfive
parenta2c1eff83c3118a9aee8076c7f84f58137416b6e (diff)
parent9008bc4eb62c878d0812105ea1b34255d651df88 (diff)
downloadnixlib-67419f0e56f99b0ebbe14574d3492110ac84c8d6.tar
nixlib-67419f0e56f99b0ebbe14574d3492110ac84c8d6.tar.gz
nixlib-67419f0e56f99b0ebbe14574d3492110ac84c8d6.tar.bz2
nixlib-67419f0e56f99b0ebbe14574d3492110ac84c8d6.tar.lz
nixlib-67419f0e56f99b0ebbe14574d3492110ac84c8d6.tar.xz
nixlib-67419f0e56f99b0ebbe14574d3492110ac84c8d6.tar.zst
nixlib-67419f0e56f99b0ebbe14574d3492110ac84c8d6.zip
Merge branch 'nixos-unstable-small' of https://github.com/NixOS/nixpkgs into HEAD
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/libfive')
-rw-r--r--nixpkgs/pkgs/development/libraries/libfive/default.nix32
1 files changed, 29 insertions, 3 deletions
diff --git a/nixpkgs/pkgs/development/libraries/libfive/default.nix b/nixpkgs/pkgs/development/libraries/libfive/default.nix
index d789aafbcb4e..f5fbf21f94fd 100644
--- a/nixpkgs/pkgs/development/libraries/libfive/default.nix
+++ b/nixpkgs/pkgs/development/libraries/libfive/default.nix
@@ -10,6 +10,7 @@
 , libpng
 , boost
 , guile
+, python
 , qtbase
 , darwin
 }:
@@ -25,8 +26,8 @@ stdenv.mkDerivation {
     hash = "sha256-OITy3fJx+Z6856V3D/KpSQRJztvOdJdqUv1c65wNgCc=";
   };
 
-  nativeBuildInputs = [ wrapQtAppsHook cmake ninja pkg-config ];
-  buildInputs = [ eigen zlib libpng boost guile qtbase ]
+  nativeBuildInputs = [ wrapQtAppsHook cmake ninja pkg-config python.pkgs.pythonImportsCheckHook ];
+  buildInputs = [ eigen zlib libpng boost guile python qtbase ]
     ++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk_11_0.frameworks.Cocoa ];
 
   preConfigure = ''
@@ -42,6 +43,14 @@ stdenv.mkDerivation {
       --replace "LIBFIVE_STDLIB_DIR=$<TARGET_FILE_DIR:libfive-stdlib>" \
                 "LIBFIVE_STDLIB_DIR=$out/lib"
 
+    substituteInPlace libfive/bind/python/CMakeLists.txt \
+      --replace ' ''${PYTHON_SITE_PACKAGES_DIR}' \
+                " $out/${python.sitePackages}" \
+
+    substituteInPlace libfive/bind/python/libfive/ffi.py \
+      --replace "os.path.join('libfive', folder)" \
+                "os.path.join('$out/${python.sitePackages}/libfive', folder)" \
+
     export XDG_CACHE_HOME=$(mktemp -d)/.cache
   '';
 
@@ -63,12 +72,29 @@ stdenv.mkDerivation {
   '' + ''
     # Link "Studio" binary to "libfive-studio" to be more obvious:
     ln -s "$out/bin/Studio" "$out/bin/libfive-studio"
+
+    # Create links since libfive looks for the library in a specific path.
+    mkdir -p "$out/${python.sitePackages}/libfive/src"
+    ln -s "$out"/lib/libfive.* "$out/${python.sitePackages}/libfive/src/"
+    mkdir -p "$out/${python.sitePackages}/libfive/stdlib"
+    ln -s "$out"/lib/libfive-stdlib.* "$out/${python.sitePackages}/libfive/stdlib/"
+
+    # Create links so Studio can find the bindings.
+    mkdir -p "$out/libfive/bind"
+    ln -s "$out/${python.sitePackages}" "$out/libfive/bind/python"
   '';
 
+  pythonImportsCheck = [
+    "libfive"
+    "libfive.runner"
+    "libfive.shape"
+    "libfive.stdlib"
+  ];
+
   meta = with lib; {
     description = "Infrastructure for solid modeling with F-Reps in C, C++, and Guile";
     homepage = "https://libfive.com/";
-    maintainers = with maintainers; [ hodapp kovirobi ];
+    maintainers = with maintainers; [ hodapp kovirobi wulfsta ];
     license = with licenses; [ mpl20 gpl2Plus ];
     platforms = with platforms; all;
   };