From 62c36376c4987aa47fa93f3076c1819aeccd2464 Mon Sep 17 00:00:00 2001 From: Petr Hodina Date: Thu, 11 Aug 2022 10:45:21 +0200 Subject: [PATCH] nongnu: Add uvtools. * gnu/packages/cad.scm (uvtools): New variable. --- nongnu/packages/cad.scm | 133 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 132 insertions(+), 1 deletion(-) diff --git a/nongnu/packages/cad.scm b/nongnu/packages/cad.scm index c896a5f9..ac3f3221 100644 --- a/nongnu/packages/cad.scm +++ b/nongnu/packages/cad.scm @@ -23,18 +23,25 @@ #:use-module (gnu packages fontutils) #:use-module (gnu packages gcc) #:use-module (gnu packages gl) + #:use-module (gnu packages geo) #:use-module (gnu packages glib) #:use-module (gnu packages gstreamer) + #:use-module (gnu packages icu4c) + #:use-module (gnu packages instrumentation) #:use-module (gnu packages libusb) #:use-module (gnu packages linux) #:use-module (gnu packages nss) #:use-module (gnu packages maths) + #:use-module (gnu packages mono) #:use-module (gnu packages pulseaudio) + #:use-module (gnu packages tls) #:use-module (gnu packages qt) #:use-module (gnu packages xorg) #:use-module (guix download) + #:use-module (guix gexp) #:use-module (nonguix build-system binary) - #:use-module ((nonguix licenses) #:prefix license:)) + #:use-module ((nonguix licenses) #:prefix license:) + #:use-module ((guix licenses) #:prefix license-gnu:)) (define-public lightburn (package @@ -175,3 +182,127 @@ cut order, etc. @end enumerate") (home-page "https://lightburnsoftware.com/") (license (license:nonfree "https://lightburnsoftware.com/pages/how-the-lightburn-license-works")))) + +(define-public uvtools + (package + (name "uvtools") + (version "3.6.2") + (home-page "https://github.com/sn4k3/UVtools") + (source (origin + (method url-fetch) + (uri (string-append home-page + "/releases/download/v" + version + "/UVtools_linux-x64_v" + version + ".AppImage")) + (sha256 + (base32 + "0785h96xlbk1mhi0n0ap4ihzjg0cgans8lrlcpr035v48ln4xv69")))) + (build-system binary-build-system) + (arguments + (list #:install-plan #~`(("squashfs-root/usr/bin/UVtools" "bin/") + ("squashfs-root/usr/bin" "bin/" + #:include-regexp (".*.dll")) + ("squashfs-root/usr/bin" "bin/" + #:include-regexp (".*.so"))) + #:phases #~(modify-phases %standard-phases + (replace 'unpack + (lambda* (#:key inputs #:allow-other-keys) + (let* ((uvtools (string-append + "/UVtools_linux-x64_v-" + #$(package-version uvtools) + ".AppImage")) + (tmp (string-append (getenv "TMPDIR") + "/tmp")) + (appimage (string-append tmp "/" uvtools)) + (rpath (string-join (list "$ORIGIN" + (string-append #$glibc + "/lib") + (string-append #$zlib + "/lib")) ":")) + (ld-so (string-append #$glibc + #$(glibc-dynamic-linker)))) + (mkdir-p tmp) + (copy-file #$source + (string-append tmp "/" uvtools)) + (chmod appimage 493) + (invoke "patchelf" "--set-rpath" rpath appimage) + (invoke "patchelf" "--set-interpreter" ld-so + appimage) + (invoke appimage "--appimage-extract")))) + (add-after 'install 'wrap-logic-and-shared-objects + (lambda* (#:key inputs outpus #:allow-other-keys) + (use-modules (ice-9 ftw) + (ice-9 regex) + (ice-9 textual-ports)) + (let* ((uvtools (string-append #$output + "/bin/UVtools")) + (rpath (string-append (apply string-append + (map (lambda (pkg) + (string-append + (assoc-ref + inputs + pkg) + "/lib:")) + '("fontconfig-minimal" + "gcc" + "glib" + "glibc" + "icu4c" + "libglvnd" + "libgeotiff" + "libusb" + "libice" + "libxt" + "lttng-ust" + "libsm" + "libx11" + "mesa" + "openssl" + "zlib"))) + #$nss "/lib/nss:" + #$output "/bin")) + (ld-so (string-append #$glibc + #$(glibc-dynamic-linker)))) + (invoke "patchelf" "--replace-needed" + "liblttng-ust.so.0" "liblttng-ust.so" + (string-append #$output + "/bin/libcoreclrtraceptprovider.so")) + (for-each (lambda (file) + (invoke "patchelf" "--set-rpath" + rpath + (string-append #$output + "/bin/" file))) + (scandir (string-append #$output + "/bin") + (lambda (name) + (string-contains name ".so")))) + (invoke "patchelf" "--set-rpath" rpath uvtools) + (invoke "patchelf" "--set-interpreter" ld-so + uvtools))))))) + (supported-systems '("x86_64-linux")) + (inputs (list fontconfig + `(,gcc "lib") + glib + glibc + libice + libusb + libsm + libgeotiff + libglvnd + lttng-ust + libxt + libx11 + mesa + openssl + zlib)) + (propagated-inputs (list icu4c)) + (synopsis "Convert and manipulate MSLA/DLP files") + (description "This simple tool can give you insight into the 3D printed +resion files. It allows to display supports and to ease with detection of +failures.") + ;; Note: Building this package from source requires MS build tools (xbuild + ;; from mono does not work). Therefore the publish Appimage is used, + ;; extracted and patched + (license license-gnu:agpl3)))