From patchwork Fri Aug 13 22:58:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Trujillo Viedma X-Patchwork-Id: 32117 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id A416D27BC78; Sat, 14 Aug 2021 13:53:06 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2, SPF_HELO_PASS,T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 0FF4627BC6B for ; Sat, 14 Aug 2021 13:53:06 +0100 (BST) Received: from localhost ([::1]:33938 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mEt9t-0003QM-3N for patchwork@mira.cbaines.net; Sat, 14 Aug 2021 08:53:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36342) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mEiII-0005sR-Fm for guix-patches@gnu.org; Fri, 13 Aug 2021 21:17:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:59982) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mEiII-000070-9l for guix-patches@gnu.org; Fri, 13 Aug 2021 21:17:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mEiIH-0003DD-T0 for guix-patches@gnu.org; Fri, 13 Aug 2021 21:17:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#50052] [PATCH] Add prusa-slicer Resent-From: Daniel Trujillo Viedma Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 14 Aug 2021 01:17:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 50052 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 50052@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.162890376212269 (code B ref -1); Sat, 14 Aug 2021 01:17:01 +0000 Received: (at submit) by debbugs.gnu.org; 14 Aug 2021 01:16:02 +0000 Received: from localhost ([127.0.0.1]:43295 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mEiHG-0003BQ-7C for submit@debbugs.gnu.org; Fri, 13 Aug 2021 21:16:02 -0400 Received: from lists.gnu.org ([209.51.188.17]:48476) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mEg8h-0008Mo-9n for submit@debbugs.gnu.org; Fri, 13 Aug 2021 18:59:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50590) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mEg8g-0008Gv-VP for guix-patches@gnu.org; Fri, 13 Aug 2021 18:58:58 -0400 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]:43696) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mEg8e-0007Pb-LH for guix-patches@gnu.org; Fri, 13 Aug 2021 18:58:58 -0400 Received: by mail-wr1-x42f.google.com with SMTP id z9so15168063wrh.10 for ; Fri, 13 Aug 2021 15:58:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:references:to:from:message-id:date:user-agent:mime-version :in-reply-to:content-language; bh=jCFNWYwVRM+Ro+IXVOT9flAmqogWOiwSsT04YzScvEY=; b=N6dtU3K6hEoZ497Wx5lQmcSrNUTdABPcWcp2EaBnXJ/ECFvgNho2yIeJwSHuiJmr0L 7DsB7hyI89FX4mm8wwvieVYXhbVyyK2piGZNV6GKXP+I31RhduDvFb4tdzWcUTg9H01V K7NqaaN5zRxHBet/nt1rAIC+Hx6zgdczZvbfICeYDuJmvBwH119SMRtAyIl8zxrat8iW oHJCZuTZd2MxLvsMnfJs4CWUkqnFv5/iUoLxZloh69k2NGhj+w9ct9yfQ8fLPDAD5k2X SR2e9WoFebVon+knnJA/VlXA73wGHXhnTEE6QdCOqquQMFy6ot189W3XklHDot5texdj h5nA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:references:to:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=jCFNWYwVRM+Ro+IXVOT9flAmqogWOiwSsT04YzScvEY=; b=nLuow85IGPApkrzorivnt1Kgm5HaDfwN23tEgV71OXyBEGhr0jUrF5i3iHJKR/ue5t ildOYc2RCH8utSBZpgFGqRV0sxiGaJTNexZjOejSobMMS9MjkTfwV/xiB4tzHQiKy5Xx smPDniJ6DHWsp/mQB85lh2oKQ5WCI0V5dIrTGB8E6tksYdL0oi2CD5NTWGJa9Nkc3ZHk zc4DAVGMVQe8fTGOcr/MJws4qe57l8fYt/+BMyJkKfXSJIyAsAQ79gHlFsJyATkDek4q XMoAVpO9kARXSB+GTcE6NCKY3ITt4wPc5oNrOSNaijsirhXgjaJnsqD3tRJF+YUQB0Hy jN0w== X-Gm-Message-State: AOAM531kQbz7d8oGk6ySzOeZ0uu+CVbhIvuaTbQtpHNro3LgoCtxgOY1 Rh7espbnarqVRomMtYub3BCrPQKyUZMEZw== X-Google-Smtp-Source: ABdhPJxdtZesm4S6qDBfh+FmM4HFDFpfbgNIrmyfDxgLaj7Zu8Tcd8mu5uMn6yAUVRDWOHtPdWSPXw== X-Received: by 2002:a05:6000:128e:: with SMTP id f14mr5473328wrx.167.1628895533652; Fri, 13 Aug 2021 15:58:53 -0700 (PDT) Received: from [192.168.0.13] ([37.223.119.203]) by smtp.gmail.com with ESMTPSA id h8sm2608659wmb.35.2021.08.13.15.58.53 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 13 Aug 2021 15:58:53 -0700 (PDT) References: <0654f9e7-8c1d-aa4c-3240-54faf3defb2f@gmail.com> From: Daniel Trujillo Viedma X-Forwarded-Message-Id: <0654f9e7-8c1d-aa4c-3240-54faf3defb2f@gmail.com> Message-ID: Date: Sat, 14 Aug 2021 00:58:52 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <0654f9e7-8c1d-aa4c-3240-54faf3defb2f@gmail.com> Content-Language: en-US Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=dtviedma@gmail.com; helo=mail-wr1-x42f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Fri, 13 Aug 2021 21:15:56 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Mailman-Approved-At: Sat, 14 Aug 2021 08:52:58 -0400 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches Hi! I'm Daniel Trujillo, This is my first-time-ever contribution to GNU Guix, so please, don't hold any nitpick to yourself!! :) I don't know if these kind of packages are of interest, but this is PrusaSlicer [0], a software to prepare 3D printings (hence I put it in engineering.scm). The packaged version, 2.3.3 is the latest stable available at this moment. But this version has as important problem [1]: It cannot be invoked just naming the executable (through $PATH), because then, it can't locate the resources directory. I learned **the hard way** that the fix was applied *after* the release of the 2.3.3 version, so I decided to backport the fix adding a patch because it's a show-stopper to have to type the path to the executable in /gnu/store/... That's the reason why the patch attached to this email contains, not only the additions to engineering.scm, but also a patch that implements the solution in the version 2.3.3 codebase (It's quite simple, it uses a boost function to determine the path to the executable rather than relying on argv[0]). Known improvable things: * It's configured to use GTK3. After many attempts to compile it under GTK2 in a guix environment, sometimes it detected GTK right away, and some ether times I had to add more includes. It wasn't quite reliable and, according to the convention followed in gtk+ packages, probably it would be better that prusa-slicer uses GTK3, and a hypothetical future GTK2 version would be called prusa-slicer-gtk2. * In order for the above $PATH issue fix to work, it's crucial that the cmake variable SLIC3R_FHS is set to off. This is the default value according to the CMakeLists.txt, but because it's so important, probably it should have been included in the configure-flags argument? Just for clarity. * Currently, the version displayed in the title bar is "....2.3.3+UNKNOWN". This is because of another cmake option not set. It doesn't have any influence in the software, as far as I know, but it's arguably ugly. The version I currently use, doesn't display that in the title bar, but it does in the "About" window, and it says ".....2.3.3+linux-64". Maybe something like "GNU Guix" would be prettier. But if I have to include the arch, I would have to dig deeper into package definitions ^_^''' I hope everything is in order, I'm looking forward to see your comments, and hope I can start contributing more packages to Guix!! Cheers, Dani. [0] https://www.prusa3d.es/prusaslicer/ [1] https://github.com/prusa3d/PrusaSlicer/issues/5542 From 522c1904cf62afac25a9d974091211adac760c25 Mon Sep 17 00:00:00 2001 From: Daniel Trujillo Viedma Date: Sat, 14 Aug 2021 00:00:55 +0200 Subject: [PATCH] Add prusa-slicer --- gnu/packages/engineering.scm | 58 ++++++++++++++++++++++ .../patches/prusa-slicer-backport-fix-5542.patch | 31 ++++++++++++ 2 files changed, 89 insertions(+) create mode 100644 gnu/packages/patches/prusa-slicer-backport-fix-5542.patch diff --git a/gnu/packages/engineering.scm b/gnu/packages/engineering.scm index 33c124a2ea..047d99c0af 100644 --- a/gnu/packages/engineering.scm +++ b/gnu/packages/engineering.scm @@ -2863,3 +2863,61 @@ for hooking Linux system calls in user space. This is achieved by hot-patching the machine code of the standard C library in the memory of a process.") (license license:bsd-2)))) + +(define-public prusa-slicer + (package + (name "prusa-slicer") + (version "2.3.3") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/prusa3d/PrusaSlicer") + (commit (string-append "version_" version)))) + (sha256 + (base32 "0w0synqi3iz9aigsgv6x1c6sg123fasbx19h4w3ic1l48r8qmpwm")) + (patches (search-patches "prusa-slicer-backport-fix-5542.patch")))) + (build-system cmake-build-system) + (arguments + `(#:configure-flags `("-DSLIC3R_GTK=3"))) + (native-inputs + `(("pkg-config" ,pkg-config))) + (inputs + `(("perl" ,perl) + ("glibc-locales" ,glibc-locales) + ("adwaita-icon-theme" ,adwaita-icon-theme) + ("boost" ,boost) + ("tbb" ,tbb) + ("curl" ,curl) + ("zlib" ,zlib) + ("eigen" ,eigen) + ("expat" ,expat) + ("libpng" ,libpng) + ("mesa" ,mesa) + ("glew" ,glew) + ("cereal" ,cereal) + ("nlopt" ,nlopt) + ("openvdb" ,openvdb) + ("cgal" ,cgal) + ("gmp" ,gmp) + ("mpfr" ,mpfr) + ("qhull" ,qhull) + ("wxwidgets" ,wxwidgets-3.1) + ("coreutils" ,coreutils) + ("grep" ,grep) + ("sed" ,sed) + ("openexr" ,openexr) + ("glib" ,glib) + ("glibc" ,glibc) + ("gtk+" ,gtk+) + ("pango" ,pango) + ("dbus" ,dbus))) + (home-page "https://www.prusa3d.com/prusaslicer/") + (synopsis "G-code generator for 3D printers (RepRap, Makerbot, Ultimaker etc.)") + (description + "PrusaSlicer (formerly known as Slic3r Prusa Edition or Slic3r PE) is +our own in-house developed slicer software based on the open-source project +Slic3r. PrusaSlicer is an open-source, feature-rich, frequently updated +tool that contains everything you need to export the perfect print files +for your Original Prusa 3D printer.") + (license license:agpl3))) diff --git a/gnu/packages/patches/prusa-slicer-backport-fix-5542.patch b/gnu/packages/patches/prusa-slicer-backport-fix-5542.patch new file mode 100644 index 0000000000..63d2a45be1 --- /dev/null +++ b/gnu/packages/patches/prusa-slicer-backport-fix-5542.patch @@ -0,0 +1,31 @@ +This patch backports a solution for the issue: +https://github.com/prusa3d/PrusaSlicer/issues/5542 +that causes PrusaSlicer to crash when invoked +from the command line by means of the $PATH variable. +This fix is applied in: +https://github.com/prusa3d/PrusaSlicer/commit/293f85b6cf9b805af93b9f79f5ff878b6d673969 +quite after the release of 2.3.3, so this backport is needed. + +diff --git a/src/PrusaSlicer.cpp b/src/PrusaSlicer.cpp +index b0df2c99a..31e30af81 100644 +--- a/src/PrusaSlicer.cpp ++++ b/src/PrusaSlicer.cpp +@@ -28,6 +28,7 @@ + #include + #include + #include ++#include + + #include "unix/fhs.hpp" // Generated by CMake from ../platform/unix/fhs.hpp.in + +@@ -612,7 +613,9 @@ bool CLI::setup(int argc, char **argv) + // Detect the operating system flavor after SLIC3R_LOGLEVEL is set. + detect_platform(); + +- boost::filesystem::path path_to_binary = boost::filesystem::system_complete(argv[0]); ++ // See Invoking prusa-slicer from $PATH environment variable crashes #5542 ++ // boost::filesystem::path path_to_binary = boost::filesystem::system_complete(argv[0]); ++ boost::filesystem::path path_to_binary = boost::dll::program_location(); + + // Path from the Slic3r binary to its resources. + #ifdef __APPLE__ -- 2.11.0