From 0ee35c56bd0c577433fe582078ea2318a05accc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9-Patrick=20Bubel?= Date: Tue, 21 May 2019 14:16:25 +0200 Subject: [PATCH] prusa-slicer: renamed from slic3r-prusa3d and updated 1.41.3 -> 2.0.0 The slic3r-prusa3d package was renamed by upstream to PrusaSlicer with the 2.0.0 release to reduce confusion with the slic3r package. We compile against wxGTK 3.0, as with 3.1 the application crashes (see --- .../misc/prusa-slicer/default.nix | 89 +++++++++++ pkgs/applications/misc/slic3r/prusa3d.nix | 147 ------------------ pkgs/top-level/aliases.nix | 1 + pkgs/top-level/all-packages.nix | 4 +- 4 files changed, 92 insertions(+), 149 deletions(-) create mode 100644 pkgs/applications/misc/prusa-slicer/default.nix delete mode 100644 pkgs/applications/misc/slic3r/prusa3d.nix diff --git a/pkgs/applications/misc/prusa-slicer/default.nix b/pkgs/applications/misc/prusa-slicer/default.nix new file mode 100644 index 000000000000..cc6f63c0960b --- /dev/null +++ b/pkgs/applications/misc/prusa-slicer/default.nix @@ -0,0 +1,89 @@ +{ stdenv, lib, fetchFromGitHub, makeWrapper, cmake, pkgconfig +, boost, curl, expat, glew, libpng, tbb, wxGTK30 +, gtest, nlopt, xorg, makeDesktopItem +}: +let + nloptVersion = if lib.hasAttr "version" nlopt + then lib.getAttr "version" nlopt + else "2.4"; +in +stdenv.mkDerivation rec { + name = "prusa-slicer-${version}"; + version = "2.0.0"; + + enableParallelBuilding = true; + + nativeBuildInputs = [ + cmake + makeWrapper + pkgconfig + ]; + + # We could add Eigen, but it doesn't currently compile with the version in + # nixpkgs. + buildInputs = [ + boost + curl + expat + glew + libpng + tbb + wxGTK30 + xorg.libX11 + ] ++ checkInputs; + + checkInputs = [ gtest ]; + + # The build system uses custom logic - defined in + # xs/src/libnest2d/cmake_modules/FindNLopt.cmake in the package source - + # for finding the nlopt library, which doesn't pick up the package in the nix store. + # We need to set the path via the NLOPT environment variable instead. + NLOPT = "${nlopt}"; + + prePatch = '' + # In nix ioctls.h isn't available from the standard kernel-headers package + # on other distributions. As the copy in glibc seems to be identical to the + # one in the kernel, we use that one instead. + sed -i 's|"/usr/include/asm-generic/ioctls.h"||g' src/libslic3r/GCodeSender.cpp + '' + lib.optionalString (lib.versionOlder "2.5" nloptVersion) '' + # Since version 2.5.0 of nlopt we need to link to libnlopt, as libnlopt_cxx + # now seems to be integrated into the main lib. + sed -i 's|nlopt_cxx|nlopt|g' src/libnest2d/cmake_modules/FindNLopt.cmake + ''; + + src = fetchFromGitHub { + owner = "prusa3d"; + repo = "PrusaSlicer"; + sha256 = "135wn2sza2f2kvbja1haxil5kx1b74lc1i7dsa35i1y3phabykhz"; + rev = "version_${version}"; + }; + + cmakeFlags = [ + "-DSLIC3R_FHS=1" + "-DSLIC3R_WX_STABLE=1" # necessary when compiling against wxGTK 3.0 + ]; + + postInstall = '' + mkdir -p "$out/share/pixmaps/" + ln -s "$out/share/PrusaSlicer/icons/PrusaSlicer.png" "$out/share/pixmaps/PrusaSlicer.png" + mkdir -p "$out/share/applications" + cp "$desktopItem"/share/applications/* "$out/share/applications/" + ''; + + desktopItem = makeDesktopItem { + name = "PrusaSlicer"; + exec = "prusa-slicer"; + icon = "PrusaSlicer"; + comment = "G-code generator for 3D printers"; + desktopName = "PrusaSlicer"; + genericName = "3D printer tool"; + categories = "Application;Development;"; + }; + + meta = with stdenv.lib; { + description = "G-code generator for 3D printer"; + homepage = https://github.com/prusa3d/PrusaSlicer; + license = licenses.agpl3; + maintainers = with maintainers; [ tweber ]; + }; +} diff --git a/pkgs/applications/misc/slic3r/prusa3d.nix b/pkgs/applications/misc/slic3r/prusa3d.nix deleted file mode 100644 index 1f0a3a71be8b..000000000000 --- a/pkgs/applications/misc/slic3r/prusa3d.nix +++ /dev/null @@ -1,147 +0,0 @@ -{ stdenv, lib, fetchFromGitHub, makeWrapper, which, cmake, perl, perlPackages, - boost, tbb, wxGTK30, pkgconfig, gtk3, fetchurl, gtk2, libGLU, - glew, eigen, curl, gtest, nlopt, pcre, xorg, makeDesktopItem }: -let - AlienWxWidgets = perlPackages.buildPerlPackage rec { - name = "Alien-wxWidgets-0.69"; - src = fetchurl { - url = "mirror://cpan/authors/id/M/MD/MDOOTSON/${name}.tar.gz"; - sha256 = "075m880klf66pbcfk0la2nl60vd37jljizqndrklh5y4zvzdy1nr"; - }; - propagatedBuildInputs = [ - pkgconfig perlPackages.ModulePluggable perlPackages.ModuleBuild - gtk2 gtk3 wxGTK30 - ]; - }; - - Wx = perlPackages.Wx.overrideAttrs (oldAttrs: { - propagatedBuildInputs = [ - perlPackages.ExtUtilsXSpp - AlienWxWidgets - ]; - }); - - WxGLCanvas = perlPackages.buildPerlPackage rec { - name = "Wx-GLCanvas-0.09"; - src = fetchurl { - url = "mirror://cpan/authors/id/M/MB/MBARBON/${name}.tar.gz"; - sha256 = "1q4gvj4gdx4l8k4mkgiix24p9mdfy1miv7abidf0my3gy2gw5lka"; - }; - propagatedBuildInputs = [ Wx perlPackages.OpenGL libGLU ]; - doCheck = false; - }; -in -stdenv.mkDerivation rec { - name = "slic3r-prusa-edition-${version}"; - version = "1.41.3"; - - enableParallelBuilding = true; - - nativeBuildInputs = [ - cmake - makeWrapper - ]; - - buildInputs = [ - curl - eigen - glew - pcre - perl - tbb - which - Wx - WxGLCanvas - xorg.libXdmcp - xorg.libpthreadstubs - ] ++ checkInputs ++ (with perlPackages; [ - boost - ClassXSAccessor - EncodeLocale - ExtUtilsMakeMaker - ExtUtilsTypemapsDefault - ExtUtilsXSpp - GrowlGNTP - ImportInto - IOStringy - locallib - LWP - MathClipper - MathConvexHullMonotoneChain - MathGeometryVoronoi - MathPlanePath - ModuleBuildWithXSpp - Moo - NetDBus - OpenGL - XMLSAX - ]); - - checkInputs = [ gtest ]; - - # The build system uses custom logic - defined in - # xs/src/libnest2d/cmake_modules/FindNLopt.cmake in the package source - - # for finding the nlopt library, which doesn't pick up the package in the nix store. - # We need to set the path via the NLOPT environment variable instead. - NLOPT = "${nlopt}"; - - prePatch = '' - # In nix ioctls.h isn't available from the standard kernel-headers package - # on other distributions. As the copy in glibc seems to be identical to the - # one in the kernel, we use that one instead. - sed -i 's|"/usr/include/asm-generic/ioctls.h"||g' xs/src/libslic3r/GCodeSender.cpp - - # PERL_VENDORARCH and PERL_VENDORLIB aren't set correctly by the build - # system, so we have to override them. Setting them as environment variables - # doesn't work though, so substituting the paths directly in CMakeLists.txt - # seems to be the easiest way. - sed -i "s|\''${PERL_VENDORARCH}|$out/lib/slic3r-prusa3d|g" xs/CMakeLists.txt - sed -i "s|\''${PERL_VENDORLIB}|$out/lib/slic3r-prusa3d|g" xs/CMakeLists.txt - '' + lib.optionalString (lib.versionOlder "2.5" nlopt.version) '' - # Since version 2.5.0 of nlopt we need to link to libnlopt, as libnlopt_cxx - # now seems to be integrated into the main lib. - sed -i 's|nlopt_cxx|nlopt|g' xs/src/libnest2d/cmake_modules/FindNLopt.cmake - ''; - - postInstall = '' - echo 'postInstall' - wrapProgram "$out/bin/slic3r-prusa3d" \ - --prefix PERL5LIB : "$out/lib/slic3r-prusa3d:$PERL5LIB" - - # it seems we need to copy the icons... - mkdir -p $out/bin/var - cp -r ../resources/icons/* $out/bin/var/ - cp -r ../resources $out/bin/ - - - mkdir -p "$out/share/pixmaps/" - ln -s "$out/bin/var/Slic3r.png" "$out/share/pixmaps/slic3r-prusa.png" - mkdir -p "$out/share/applications" - cp "$desktopItem"/share/applications/* "$out/share/applications/" - ''; - - src = fetchFromGitHub { - owner = "prusa3d"; - repo = "Slic3r"; - sha256 = "145dfsv610c5p0sngab9z7lzbk5383pq9l26mrrpf1wxdlxgljpl"; - rev = "version_${version}"; - }; - - desktopItem = makeDesktopItem { - name = "slic3r-Prusa-Edition"; - exec = "slic3r-prusa3d"; - icon = "slic3r-prusa"; - comment = "G-code generator for 3D printers"; - desktopName = "Slic3r Prusa Edition"; - genericName = "3D printer tool"; - categories = "Application;Development;"; - }; - - meta = with stdenv.lib; { - description = "G-code generator for 3D printer"; - homepage = https://github.com/prusa3d/Slic3r; - license = licenses.agpl3; - maintainers = with maintainers; [ tweber ]; - broken = stdenv.hostPlatform.isAarch64; - }; -} diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix index 628e19ce82b5..37ef4c87b489 100644 --- a/pkgs/top-level/aliases.nix +++ b/pkgs/top-level/aliases.nix @@ -292,6 +292,7 @@ mapAliases ({ shared_mime_info = shared-mime-info; # added 2018-02-25 skrooge2 = skrooge; # added 2017-02-18 skype = skypeforlinux; # added 2017-07-27 + slic3r-prusa3d = prusa-slicer; # added 2019-05-21 slurm-llnl = slurm; # renamed July 2017 slurm-llnl-full = slurm-full; # renamed July 2017 slurm-full = slurm; # added 2018-05-1 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index f2d9e4a7ac5a..d5eb2f0b1590 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -20031,8 +20031,6 @@ in slic3r = callPackage ../applications/misc/slic3r { }; - slic3r-prusa3d = callPackage ../applications/misc/slic3r/prusa3d.nix { }; - curaengine_stable = callPackage ../applications/misc/curaengine/stable.nix { }; cura_stable = callPackage ../applications/misc/cura/stable.nix { curaengine = curaengine_stable; @@ -20055,6 +20053,8 @@ in printrun = callPackage ../applications/misc/printrun { }; + prusa-slicer = callPackage ../applications/misc/prusa-slicer { }; + sddm = libsForQt5.callPackage ../applications/display-managers/sddm { }; skrooge = libsForQt5.callPackage ../applications/office/skrooge {};