about summary refs log tree commit diff
path: root/pkgs/applications
diff options
context:
space:
mode:
authorCameron Bytheway <bytheway.cameron@gmail.com>2024-06-26 16:49:33 -0600
committerCameron Bytheway <bytheway.cameron@gmail.com>2024-06-26 17:38:36 -0600
commit7677e0f78e196495629e83bb0cd5cc6d4cd585af (patch)
tree048f71c826fdc33e3e170b32ee1cd1b5a4e471a5 /pkgs/applications
parent7b56d9dd0d8a8b6d9086ec044cfe6cf9eb4ba9bf (diff)
openscad: fix lib3mf linking
This change explicitly sets the LIB3MF_INCLUDEPATH and LIB3MF_LIBPATH
environment variables instead of relying on `pkg-config` resolution.
This is due to the following issues with the existing build logic:

* The library name was using `lib3MF` instead of `lib3mf`. `pkg-config`
  is case-sensitive and is unable to find the former.
* The current `lib3mf` nix artifact exports multiple language bindings
  in the `includedir`. Each language needs to refer to the correct path
  inside of it.
Diffstat (limited to 'pkgs/applications')
-rw-r--r--pkgs/applications/graphics/openscad/default.nix18
1 files changed, 17 insertions, 1 deletions
diff --git a/pkgs/applications/graphics/openscad/default.nix b/pkgs/applications/graphics/openscad/default.nix
index d72994e008b0b..9b29f6ddc94d8 100644
--- a/pkgs/applications/graphics/openscad/default.nix
+++ b/pkgs/applications/graphics/openscad/default.nix
@@ -32,6 +32,8 @@
 , wrapGAppsHook3
 , qtwayland
 , cairo
+, openscad
+, runCommand
 }:
 
 mkDerivation rec {
@@ -69,7 +71,11 @@ mkDerivation rec {
     ++ lib.optional spacenavSupport libspnav
   ;
 
-  qmakeFlags = [ "VERSION=${version}" ] ++
+  qmakeFlags = [
+    "VERSION=${version}"
+    "LIB3MF_INCLUDEPATH=${lib3mf.dev}/include/lib3mf/Bindings/Cpp"
+    "LIB3MF_LIBPATH=${lib3mf}/lib"
+  ] ++
     lib.optionals spacenavSupport [
       "ENABLE_SPNAV=1"
       "SPNAV_INCLUDEPATH=${libspnav}/include"
@@ -112,4 +118,14 @@ mkDerivation rec {
     maintainers = with lib.maintainers; [ bjornfor raskin gebner ];
     mainProgram = "openscad";
   };
+
+  passthru.tests = {
+    lib3mf_support = runCommand "${pname}-lib3mf-support-test" {
+      nativeBuildInputs = [ openscad ];
+    } ''
+      echo "cube([1, 1, 1]);" | openscad -o cube.3mf -
+      echo "import(\"cube.3mf\");" | openscad -o cube-import.3mf -
+      mv cube-import.3mf $out
+    '';
+  };
 }