From 7677e0f78e196495629e83bb0cd5cc6d4cd585af Mon Sep 17 00:00:00 2001 From: Cameron Bytheway Date: Wed, 26 Jun 2024 16:49:33 -0600 Subject: [PATCH] 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. --- .../applications/graphics/openscad/default.nix | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/pkgs/applications/graphics/openscad/default.nix b/pkgs/applications/graphics/openscad/default.nix index d72994e008b0..9b29f6ddc94d 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 + ''; + }; }