;;; SPDX-License-Identifier: GPL-3.0-or-later ;;; Copyright © 2021-2022 Petr Hodina (define-module (nongnu packages cad) #:use-module (guix packages) #:use-module (gnu packages base) #:use-module (gnu packages bootstrap) #:use-module (gnu packages compression) #:use-module (gnu packages cups) #:use-module (gnu packages elf) #: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 ((guix licenses) #:prefix license-gnu:)) (define-public lightburn (package (name "lightburn") (version "1.2.01") (source (origin (method url-fetch) (uri (string-append "https://github.com/LightBurnSoftware/deployment/" "releases/download/" version "/LightBurn-Linux64-v" version ".7z")) (sha256 (base32 "1yqxkf0izcfz05wrxh9xpmm7qi5wd5f1w9d2kni2wbzs531nr22p")))) (build-system binary-build-system) (arguments `(#:strip-binaries? #f ;TODO: For some reason it fails validate-runpath ;; phase if enbaled #:install-plan `(("LightBurn" "bin/LightBurn") ("LightBurn.png" "Lightburn.png") ("qt.conf" "qt.conf") ("languages" "languages") ("plugins" "plugins") ("translations" "translations")) #:phases (modify-phases %standard-phases (replace 'unpack (lambda* (#:key inputs #:allow-other-keys) (let ((source (assoc-ref inputs "source"))) (invoke "7z" "x" source) (chdir "LightBurn") (delete-file-recursively "lib")))) (replace 'patchelf (lambda* (#:key inputs outputs patchelf-plan #:allow-other-keys) (let* ((lightburn "LightBurn") (plugins (list "audio/libqtaudio_alsa.so" "audio/libqtmedia_pulse.so" "bearer/libqconnmanbearer.so" "bearer/libqgenericbearer.so" "bearer/libqnmbearer.so" "imageformats/libqgif.so" "imageformats/libqicns.so" "imageformats/libqico.so" "imageformats/libqjpeg.so" "imageformats/libqtga.so" "imageformats/libqtiff.so" "imageformats/libqwbmp.so" "imageformats/libqwebp.so" "mediaservice/libgstaudiodecoder.so" "mediaservice/libgstcamerabin.so" "mediaservice/libgstmediacapture.so" "mediaservice/libgstmediaplayer.so" (string-append "platforminputcontexts" "/libcomposeplatforminputcontextplugin.so") (string-append "platforminputcontexts" "/libibusplatforminputcontextplugin.so") "platforms/libqxcb.so" "printsupport/libcupsprintersupport.so" "xcbglintegrations/libqxcb-egl-integration.so" "xcbglintegrations/libqxcb-glx-integration.so")) (libc (assoc-ref inputs "libc")) (nss (assoc-ref inputs "nss")) (rpath (string-append (apply string-append (map (lambda (pkg) (string-append (assoc-ref inputs pkg) "/lib:")) '("alsa-lib" "cups-minimal" "fontconfig-minimal" "freetype" "gcc" "glib" "gst-plugins-base" "gstreamer" "libusb" "libx11" "libxcb" "libxext" "libxi" "libxrender" "mesa" "nspr" "openlibm" "pulseaudio" "qtbase" "qtserialport" "qtmultimedia" "zlib"))) nss "/lib/nss:")) (ld-so (string-append libc ,(glibc-dynamic-linker)))) (invoke "patchelf" "--set-rpath" rpath lightburn) (invoke "patchelf" "--set-interpreter" ld-so lightburn) (map (lambda (x) (invoke "patchelf" "--set-rpath" rpath (string-append "plugins/" x))) plugins))))))) (supported-systems '("x86_64-linux")) (native-inputs (list p7zip patchelf)) (inputs (list alsa-lib cups-minimal fontconfig `(,gcc "lib") glib gst-plugins-base gstreamer libusb libx11 libxcb libxext libxi libxrender nspr nss mesa openlibm pulseaudio qtbase-5 qtserialport-5 qtmultimedia-5 zlib)) (synopsis "Layout, editing, and control software for your laser cutter") (description "This package provides layout, editing, and control software for your laser cutter. Following features are supported: @enumerate @item Import artwork from formats such as AI, PDF, SVG, DXF, PLT, PNG, JPG, GIF , BMP @item arrange, edit, and even create new vector shapes within the editor @item apply production settings such as like power, speed, number of passes, cut order, etc. @item send the result directly to your laser cutter @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)))