Package: guix-patches;
Reported by: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Date: Sun, 30 Jan 2022 07:47:02 UTC
Severity: normal
Tags: patch
Done: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 53634 in the body.
You can then email your comments to 53634 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
View this report as an mbox folder, status mbox, maintainer mbox
guix-patches <at> gnu.org
:bug#53634
; Package guix-patches
.
(Sun, 30 Jan 2022 07:47:02 GMT) Full text and rfc822 format available.Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
:guix-patches <at> gnu.org
.
(Sun, 30 Jan 2022 07:47:02 GMT) Full text and rfc822 format available.Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com> To: guix-patches <at> gnu.org Cc: Maxim Cournoyer <maxim.cournoyer <at> gmail.com> Subject: [PATCH 0/4] gnu: Add openboardview. Date: Sun, 30 Jan 2022 02:45:58 -0500
Hello Guix! I've finally got around to getting this to build and run. I got interested in it when wanting to view board files for an X200 (libreboot-related). Enjoy, Maxim Cournoyer (4): gnu: Add imgui. gnu: Add glad. gnu: Add utf8-h. gnu: Add openboardview. gnu/local.mk | 1 + gnu/packages/c.scm | 41 ++++++- gnu/packages/electronics.scm | 113 +++++++++++++++++- gnu/packages/gl.scm | 35 +++++- .../openboardview-use-system-utf8.patch | 48 ++++++++ gnu/packages/toolkits.scm | 104 ++++++++++++++++ 6 files changed, 337 insertions(+), 5 deletions(-) create mode 100644 gnu/packages/patches/openboardview-use-system-utf8.patch create mode 100644 gnu/packages/toolkits.scm -- 2.34.0
guix-patches <at> gnu.org
:bug#53634
; Package guix-patches
.
(Sun, 30 Jan 2022 07:50:02 GMT) Full text and rfc822 format available.Message #8 received at 53634 <at> debbugs.gnu.org (full text, mbox):
From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com> To: 53634 <at> debbugs.gnu.org Cc: Maxim Cournoyer <maxim.cournoyer <at> gmail.com> Subject: [PATCH 1/4] gnu: Add imgui. Date: Sun, 30 Jan 2022 02:48:45 -0500
* gnu/packages/toolkits.scm (imgui): New variable. --- gnu/packages/toolkits.scm | 104 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 gnu/packages/toolkits.scm diff --git a/gnu/packages/toolkits.scm b/gnu/packages/toolkits.scm new file mode 100644 index 0000000000..e980438ca9 --- /dev/null +++ b/gnu/packages/toolkits.scm @@ -0,0 +1,104 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer <at> gmail.com> +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. + +(define-module (gnu packages toolkits) + #:use-module (gnu packages gl) + #:use-module (gnu packages sdl) + #:use-module ((guix licenses) #:prefix license:) + #:use-module (guix packages) + #:use-module (guix utils) + #:use-module (guix build-system gnu) + #:use-module (guix git-download)) + +(define-public imgui + (package + (name "imgui") + (version "1.86") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/ocornut/imgui") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "02a7b05zrka20jhzag2jb4jl624i1m456bsv69jb9zgys2p9dv1n")) + (modules '((guix build utils))) + (snippet + '(begin + ;; Contains fonts and other unneeded files. + (delete-file-recursively "misc"))))) + (outputs '("out" "doc")) + (build-system gnu-build-system) + (arguments + `(#:tests? #f ;no test suite + #:modules ((guix build gnu-build-system) + (guix build utils) + (ice-9 ftw) + (srfi srfi-26)) + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'adjust-includes + (lambda _ + (substitute* (find-files "." "(\\.cpp|\\.mm)$") + (("#include <SDL") + "#include <SDL2/SDL")))) + (delete 'configure) + (replace 'build + (lambda _ + ;; Build main library. + (invoke ,(cc-for-target) "-I" (getcwd) + "-g" "-O2" "-fPIC" "-shared" + "-lGL" "-lSDL2" "-lglfw" + "-o" "libimgui.so" + "imgui.cpp" + "imgui_draw.cpp" + ;; Include the supported backends. + "backends/imgui_impl_glfw.cpp" + "backends/imgui_impl_sdl.cpp" + "backends/imgui_impl_opengl2.cpp" + "backends/imgui_impl_opengl3.cpp"))) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (doc (assoc-ref outputs "doc")) + (header? (cut string-suffix? ".h" <>)) + (imgui-headers (scandir "." header?)) + (backend-headers (find-files + "backends" + "(glfw|opengl|sdl|vulkan).*\\.h$"))) + (install-file "libimgui.so" (string-append out "/lib")) + ;; Install headers. + (for-each (lambda (f) + (install-file f (string-append out "/include/imgui"))) + imgui-headers) + (for-each (lambda (f) + (install-file f (string-append + out "/include/imgui/backends"))) + backend-headers) + ;; Install examples. + (copy-recursively + "examples" (string-append + doc "/share/imgui/examples")))))))) + (inputs (list glfw mesa sdl2)) + (home-page "https://github.com/ocornut/imgui") + (synopsis "Graphical user interface library for C++") + (description "@code{dear imgui} (also know as ImGui) is a graphical user +interface library for C++. It outputs vertex buffers that can be rendered in +a 3D application. It is fast, renderer agnostic and self-contained.") + (license license:expat))) -- 2.34.0
guix-patches <at> gnu.org
:bug#53634
; Package guix-patches
.
(Sun, 30 Jan 2022 07:50:02 GMT) Full text and rfc822 format available.Message #11 received at 53634 <at> debbugs.gnu.org (full text, mbox):
From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com> To: 53634 <at> debbugs.gnu.org Cc: Maxim Cournoyer <maxim.cournoyer <at> gmail.com> Subject: [PATCH 2/4] gnu: Add glad. Date: Sun, 30 Jan 2022 02:48:46 -0500
* gnu/packages/gl.scm (glad): New variable. --- gnu/packages/gl.scm | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/gnu/packages/gl.scm b/gnu/packages/gl.scm index fa49679870..7ca1c510ab 100644 --- a/gnu/packages/gl.scm +++ b/gnu/packages/gl.scm @@ -12,7 +12,7 @@ ;;; Copyright © 2019 Pierre Neidhardt <mail <at> ambrevar.xyz> ;;; Copyright © 2020 Marius Bakke <mbakke <at> fastmail.com> ;;; Copyright © 2020 Giacomo Leidi <goodoldpaul <at> autistici.org> -;;; Copyright © 2020, 2021 Maxim Cournoyer <maxim.cournoyer <at> gmail.com> +;;; Copyright © 2020, 2021, 2022 Maxim Cournoyer <maxim.cournoyer <at> gmail.com> ;;; Copyright © 2020 Kei Kebreau <kkebreau <at> posteo.net> ;;; Copyright © 2021 Ivan Gankevich <i.gankevich <at> spbu.ru> ;;; Copyright © 2021 John Kehayias <john.kehayias <at> protonmail.com> @@ -63,6 +63,7 @@ (define-module (gnu packages gl) #:use-module (guix build-system gnu) #:use-module (guix build-system cmake) #:use-module (guix build-system meson) + #:use-module (guix build-system python) #:use-module (guix build-system waf) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix packages) @@ -181,6 +182,38 @@ (define-public ftgl Polygon meshes, and Extruded polygon meshes.") (license license:x11))) +(define-public glad + (package + (name "glad") + (version "0.1.36") + (source + (origin + ;; We fetch the sources from the repository since the PyPI archive + ;; doesn't contain the CMakeLists.txt file which is useful for + ;; integration with other software, such as the openboardview package. + (method git-fetch) + (uri (git-reference + (url "https://github.com/Dav1dde/glad") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "0m55ya1zrmg6n2cljkajy80ilmi5sblln8742fm0k1sw9k7hzn8n")))) + (build-system python-build-system) + (arguments + `(#:phases + (modify-phases %standard-phases + (add-after 'install 'install-cmakelists.txt + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (share (string-append out "/share/" ,name))) + (install-file "CMakeLists.txt" share))))))) + (home-page "https://github.com/Dav1dde/glad") + (synopsis "Multi-language GL/GLES/EGL/GLX/WGL loader generator") + (description "Glad uses the official Khronos XML specifications to +generate a GL/GLES/EGL/GLX/WGL loader tailored for specific requirements.") + (license license:expat))) + (define-public s2tc (package (name "s2tc") -- 2.34.0
guix-patches <at> gnu.org
:bug#53634
; Package guix-patches
.
(Sun, 30 Jan 2022 07:50:03 GMT) Full text and rfc822 format available.Message #14 received at 53634 <at> debbugs.gnu.org (full text, mbox):
From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com> To: 53634 <at> debbugs.gnu.org Cc: Maxim Cournoyer <maxim.cournoyer <at> gmail.com> Subject: [PATCH 3/4] gnu: Add utf8-h. Date: Sun, 30 Jan 2022 02:48:47 -0500
* gnu/packages/c.scm (utf8-h): New variable. --- gnu/packages/c.scm | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/gnu/packages/c.scm b/gnu/packages/c.scm index 459d996fa2..e53a7c865f 100644 --- a/gnu/packages/c.scm +++ b/gnu/packages/c.scm @@ -9,7 +9,7 @@ ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke <at> gnu.org> ;;; Copyright © 2020, 2021 Marius Bakke <marius <at> gnu.org> ;;; Copyright © 2020 Katherine Cox-Buday <cox.katherine.e <at> gmail.com> -;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer <at> gmail.com> +;;; Copyright © 2020, 2022 Maxim Cournoyer <maxim.cournoyer <at> gmail.com> ;;; Copyright © 2020, 2021 Greg Hogan <code <at> greghogan.com> ;;; Copyright © 2021 David Dashyan <mail <at> davie.li> ;;; @@ -895,3 +895,42 @@ (define-public aws-c-mqtt Telemetry Transport (MQTT) publish-subscribe messaging protocol.") (home-page "https://github.com/awslabs/aws-c-mqtt") (license license:asl2.0))) + +(define-public utf8-h + ;; The latest tag is used as there is no release. + (let ((commit "500d4ea9f4c3449e5243c088d8af8700f7189734") + (revision "0")) + (package + (name "utf8-h") + (version (git-version "0.0.0" revision commit)) + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/sheredom/utf8.h") + (commit commit))) + (file-name (git-file-name "utf8.h" version)) + (sha256 + (base32 + "0x9f7ivww8c7cigf4ck0hfx2bm79qgx6q4ccwzqbzkrmcrl9shfb")))) + (build-system cmake-build-system) + (arguments + `(#:phases + (modify-phases %standard-phases + (delete 'build) + (delete 'configure) + (replace 'check + (lambda* (#:key tests? #:allow-other-keys) + (when tests? + (with-directory-excursion "test" + (invoke "cmake" ".") + (invoke "make"))))) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let ((out (assoc-ref outputs "out"))) + (install-file "utf8.h" (string-append out "/include")))))))) + (home-page "https://github.com/sheredom/utf8.h") + (synopsis "Single header UTF-8 string functions for C and C++") + (description "A simple one header solution to supporting UTF-8 strings in +C and C++. The functions it provides are like those from the C header +string.h, but with a utf8* prefix instead of the str* prefix.") + (license license:unlicense)))) -- 2.34.0
guix-patches <at> gnu.org
:bug#53634
; Package guix-patches
.
(Sun, 30 Jan 2022 07:50:04 GMT) Full text and rfc822 format available.Message #17 received at 53634 <at> debbugs.gnu.org (full text, mbox):
From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com> To: 53634 <at> debbugs.gnu.org Cc: Maxim Cournoyer <maxim.cournoyer <at> gmail.com> Subject: [PATCH 4/4] gnu: Add openboardview. Date: Sun, 30 Jan 2022 02:48:48 -0500
* gnu/packages/electronics.scm (openboardview): New variable. * gnu/packages/patches/openboardview-use-system-utf8.patch: New file. * gnu/local.mk (dist_patch_DATA): Register it. --- gnu/local.mk | 1 + gnu/packages/electronics.scm | 113 +++++++++++++++++- .../openboardview-use-system-utf8.patch | 48 ++++++++ 3 files changed, 159 insertions(+), 3 deletions(-) create mode 100644 gnu/packages/patches/openboardview-use-system-utf8.patch diff --git a/gnu/local.mk b/gnu/local.mk index 96e6cb08f4..692cd7d6bc 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1567,6 +1567,7 @@ dist_patch_DATA = \ %D%/packages/patches/onnx-shared-libraries.patch \ %D%/packages/patches/onnx-skip-model-downloads.patch \ %D%/packages/patches/openbabel-fix-crash-on-nwchem-output.patch \ + %D%/packages/patches/openboardview-use-system-utf8.patch \ %D%/packages/patches/opencascade-oce-glibc-2.26.patch \ %D%/packages/patches/openfoam-4.1-cleanup.patch \ %D%/packages/patches/openjdk-10-idlj-reproducibility.patch \ diff --git a/gnu/packages/electronics.scm b/gnu/packages/electronics.scm index 54f246faa6..918bd8f9a8 100644 --- a/gnu/packages/electronics.scm +++ b/gnu/packages/electronics.scm @@ -4,6 +4,7 @@ ;;; Copyright © 2019 Clément Lassieur <clement <at> lassieur.org> ;;; Copyright © 2021 Efraim Flashner <efraim <at> flashner.co.il> ;;; Copyright © 2021 Leo Famulari <leo <at> famulari.name> +;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer <at> gmail.com> ;;; ;;; This file is part of GNU Guix. ;;; @@ -21,11 +22,12 @@ ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. (define-module (gnu packages electronics) - #:use-module (guix utils) - #:use-module (guix packages) #:use-module (guix download) + #:use-module (guix gexp) #:use-module (guix git-download) #:use-module ((guix licenses) #:prefix license:) + #:use-module (guix packages) + #:use-module (guix utils) #:use-module (guix build-system gnu) #:use-module (guix build-system cmake) #:use-module (gnu packages) @@ -34,11 +36,14 @@ (define-module (gnu packages electronics) #:use-module (gnu packages base) #:use-module (gnu packages bash) #:use-module (gnu packages boost) + #:use-module (gnu packages c) #:use-module (gnu packages check) #:use-module (gnu packages compression) #:use-module (gnu packages documentation) #:use-module (gnu packages embedded) + #:use-module (gnu packages fontutils) #:use-module (gnu packages gawk) + #:use-module (gnu packages gl) #:use-module (gnu packages glib) #:use-module (gnu packages graphviz) #:use-module (gnu packages gtk) @@ -48,7 +53,10 @@ (define-module (gnu packages electronics) #:use-module (gnu packages m4) #:use-module (gnu packages pkg-config) #:use-module (gnu packages python) - #:use-module (gnu packages qt)) + #:use-module (gnu packages qt) + #:use-module (gnu packages sdl) + #:use-module (gnu packages sqlite) + #:use-module (gnu packages stb)) (define-public libserialport (package @@ -240,6 +248,105 @@ (define-public sigrok-cli (description "Sigrok-cli is a command-line frontend for sigrok.") (license license:gpl3+))) +(define-public openboardview + (package + (name "openboardview") + (version "8.95.1") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/OpenBoardView/OpenBoardView") + (commit version) + (recursive? #t))) ;for the "src/imgui" submodule + (file-name (git-file-name name version)) + (modules '((ice-9 ftw) + (srfi srfi-26) + (guix build utils))) + (snippet + '(with-directory-excursion "src" + ;; Keep the bundled ImGui for now, as in the current version + ;; (~1.79), it requires the glad loader generated at build + ;; time as an input. + (define keep (list "." ".." "imgui" "openboardview")) + (for-each (lambda (f) + (when (eq? 'directory (stat:type (lstat f))) + (delete-file-recursively f))) + (scandir "." (negate (cut member <> keep)))))) + (patches + (search-patches "openboardview-use-system-utf8.patch")) + (sha256 + (base32 + "16mrs7bimwp8a8lb2wqhfisy6j0hl9574l4h9yb66v46aglvmd3h")))) + (build-system cmake-build-system) + (arguments + (list + #:tests? #f ;no test suite + #:imported-modules `((guix build glib-or-gtk-build-system) + ,@%cmake-build-system-modules) + #:modules '((guix build cmake-build-system) + (guix build utils) + ((guix build glib-or-gtk-build-system) #:prefix gtk:)) + #:phases + #~(modify-phases %standard-phases + (add-before 'configure 'configure-glad + (lambda* (#:key inputs #:allow-other-keys) + (substitute* "src/CMakeLists.txt" + (("add_subdirectory\\(glad\\)") + (string-append + ;; Configure Glad to use static Khronos XML specifications + ;; instead of attempting to fetch them from the Internet. + "option(GLAD_REPRODUCIBLE \"Reproducible build\" ON)\n" + ;; Use the CMake files from our glad package. + "add_subdirectory(" + (search-input-directory inputs "share/glad") ;source_dir + " src/glad)\n"))))) ;binary dir + (add-before 'configure 'fix-utf8-include-directive + ;; Our utf8-h package makes the header available as "utf8.h" + ;; directly rather than "utf8/utf8.h". + (lambda _ + (substitute* '("src/openboardview/FileFormats/BRDFile.cpp" + "src/openboardview/BoardView.cpp") + (("utf8/utf8.h") "utf8.h")))) + (add-before 'configure 'dynamically-load-gtk-via-absolute-path + ;; The GTK library is not linked thus not present in the RUNPATH of + ;; the produced binary; the absolute path of the libraries must to + ;; the dynamic loader otherwise they aren't found. + (lambda* (#:key inputs #:allow-other-keys) + (substitute* "src/openboardview/unix.cpp" + (("libgtk-3.so") + (search-input-file inputs "lib/libgtk-3.so"))))) + ;; Add the two extra phases from `glib-or-gtk-build-system'. + (add-after 'install 'glib-or-gtk-compile-schemas + (assoc-ref gtk:%standard-phases 'glib-or-gtk-compile-schemas)) + (add-after 'install 'glib-or-gtk-wrap + (assoc-ref gtk:%standard-phases 'glib-or-gtk-wrap))))) + (native-inputs + (list pkg-config + python + glad + stb-image + utf8-h)) + (inputs + (list fontconfig + gtk+ + sdl2 + sqlite + zlib)) + (home-page "https://openboardview.org/") + (synopsis "Viewer for BoardView files") + (description "OpenBoardView is a viewer for BoardView files, which present +the details of a printed circuit board (PCB). It comes with features +such as: +@itemize +@item Dynamic part outline rendering, including complex connectors +@item Annotations, for leaving notes about parts, nets, pins or location +@item Configurable colour themes +@item Configurable DPI to facilitate usage on 4K monitors +@item Configurable for running on slower systems +@item Reads FZ (with key), BRD, BRD2, BDV and BV* formats. +@end itemize") + (license license:expat))) + (define-public pulseview (package (name "pulseview") diff --git a/gnu/packages/patches/openboardview-use-system-utf8.patch b/gnu/packages/patches/openboardview-use-system-utf8.patch new file mode 100644 index 0000000000..25b5952bda --- /dev/null +++ b/gnu/packages/patches/openboardview-use-system-utf8.patch @@ -0,0 +1,48 @@ +From 251e23422f37c93a3f460fb660c5e5bfa8200d91 Mon Sep 17 00:00:00 2001 +From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com> +Date: Sun, 2 Dec 2018 16:40:39 -0500 +Subject: [PATCH] build system: Allow using utf8.h from the system. + +--- + src/CMakeLists.txt | 12 ++++++++---- + src/openboardview/CMakeLists.txt | 1 + + 2 files changed, 9 insertions(+), 4 deletions(-) + +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 90442ed..26d4a69 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -8,10 +8,14 @@ if(NOT WIN32 OR MINGW) + endif() + + ## utf8.h ## +-execute_process( +- COMMAND git submodule update --init src/utf8 +- WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} +-) ++FIND_PATH(UTF8_INCLUDE_DIR utf8.h) ++if(NOT UTF8_INCLUDE_DIR) ++ execute_process( ++ COMMAND git submodule update --init src/utf8 ++ WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} ++ ) ++ set(UTF8_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/utf8) ++endif() + + ## zlib ## + find_package(ZLIB) +diff --git a/src/openboardview/CMakeLists.txt b/src/openboardview/CMakeLists.txt +index b0bdbe3..6c4564c 100644 +--- a/src/openboardview/CMakeLists.txt ++++ b/src/openboardview/CMakeLists.txt +@@ -44,6 +44,7 @@ include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/.. + ${IMGUI_INCLUDE_DIRS} ++ ${UTF8_INCLUDE_DIR} + ${GLAD_INCLUDE_DIRS} + ${GTK_INCLUDE_DIRS} + ${OPENGL_INCLUDE_DIR} +-- +2.34.0 + -- 2.34.0
guix-patches <at> gnu.org
:bug#53634
; Package guix-patches
.
(Mon, 31 Jan 2022 05:46:02 GMT) Full text and rfc822 format available.Message #20 received at 53634 <at> debbugs.gnu.org (full text, mbox):
From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com> To: 53634 <at> debbugs.gnu.org Cc: Maxim Cournoyer <maxim.cournoyer <at> gmail.com> Subject: [PATCH v2 4/4] gnu: Add openboardview. Date: Mon, 31 Jan 2022 00:45:02 -0500
* gnu/packages/electronics.scm (openboardview): New variable. * gnu/packages/patches/openboardview-use-system-utf8.patch: New file. * gnu/local.mk (dist_patch_DATA): Register it. --- gnu/local.mk | 1 + gnu/packages/electronics.scm | 124 +++++++++++++++++- .../openboardview-use-system-utf8.patch | 48 +++++++ 3 files changed, 170 insertions(+), 3 deletions(-) create mode 100644 gnu/packages/patches/openboardview-use-system-utf8.patch diff --git a/gnu/local.mk b/gnu/local.mk index 96e6cb08f4..692cd7d6bc 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1567,6 +1567,7 @@ dist_patch_DATA = \ %D%/packages/patches/onnx-shared-libraries.patch \ %D%/packages/patches/onnx-skip-model-downloads.patch \ %D%/packages/patches/openbabel-fix-crash-on-nwchem-output.patch \ + %D%/packages/patches/openboardview-use-system-utf8.patch \ %D%/packages/patches/opencascade-oce-glibc-2.26.patch \ %D%/packages/patches/openfoam-4.1-cleanup.patch \ %D%/packages/patches/openjdk-10-idlj-reproducibility.patch \ diff --git a/gnu/packages/electronics.scm b/gnu/packages/electronics.scm index 54f246faa6..24bb4b03b1 100644 --- a/gnu/packages/electronics.scm +++ b/gnu/packages/electronics.scm @@ -4,6 +4,7 @@ ;;; Copyright © 2019 Clément Lassieur <clement <at> lassieur.org> ;;; Copyright © 2021 Efraim Flashner <efraim <at> flashner.co.il> ;;; Copyright © 2021 Leo Famulari <leo <at> famulari.name> +;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer <at> gmail.com> ;;; ;;; This file is part of GNU Guix. ;;; @@ -21,11 +22,12 @@ ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. (define-module (gnu packages electronics) - #:use-module (guix utils) - #:use-module (guix packages) #:use-module (guix download) + #:use-module (guix gexp) #:use-module (guix git-download) #:use-module ((guix licenses) #:prefix license:) + #:use-module (guix packages) + #:use-module (guix utils) #:use-module (guix build-system gnu) #:use-module (guix build-system cmake) #:use-module (gnu packages) @@ -34,11 +36,14 @@ (define-module (gnu packages electronics) #:use-module (gnu packages base) #:use-module (gnu packages bash) #:use-module (gnu packages boost) + #:use-module (gnu packages c) #:use-module (gnu packages check) #:use-module (gnu packages compression) #:use-module (gnu packages documentation) #:use-module (gnu packages embedded) + #:use-module (gnu packages fontutils) #:use-module (gnu packages gawk) + #:use-module (gnu packages gl) #:use-module (gnu packages glib) #:use-module (gnu packages graphviz) #:use-module (gnu packages gtk) @@ -48,7 +53,10 @@ (define-module (gnu packages electronics) #:use-module (gnu packages m4) #:use-module (gnu packages pkg-config) #:use-module (gnu packages python) - #:use-module (gnu packages qt)) + #:use-module (gnu packages qt) + #:use-module (gnu packages sdl) + #:use-module (gnu packages sqlite) + #:use-module (gnu packages stb)) (define-public libserialport (package @@ -240,6 +248,116 @@ (define-public sigrok-cli (description "Sigrok-cli is a command-line frontend for sigrok.") (license license:gpl3+))) +(define-public openboardview + (package + (name "openboardview") + (version "8.95.1") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/OpenBoardView/OpenBoardView") + (commit version) + (recursive? #t))) ;for the "src/imgui" submodule + (file-name (git-file-name name version)) + (modules '((ice-9 ftw) + (srfi srfi-26) + (guix build utils))) + (snippet + '(with-directory-excursion "src" + ;; Keep the bundled ImGui for now, as in the current version + ;; (~1.79), it requires the glad loader generated at build + ;; time as an input. + (define keep (list "." ".." "imgui" "openboardview")) + (for-each (lambda (f) + (when (eq? 'directory (stat:type (lstat f))) + (delete-file-recursively f))) + (scandir "." (negate (cut member <> keep)))))) + (patches + (search-patches "openboardview-use-system-utf8.patch")) + (sha256 + (base32 + "16mrs7bimwp8a8lb2wqhfisy6j0hl9574l4h9yb66v46aglvmd3h")))) + (build-system cmake-build-system) + (arguments + (list + #:tests? #f ;no test suite + #:imported-modules `((guix build glib-or-gtk-build-system) + ,@%cmake-build-system-modules) + #:modules '((guix build cmake-build-system) + (guix build utils) + ((guix build glib-or-gtk-build-system) #:prefix gtk:)) + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'remove-timestamps + (lambda _ + ;; The __TIMESTAMP__ CPP macro does apparently not honor + ;; SOURCE_EPOCH_DATE. Patch it to use __DATE__ instead, which + ;; does (see: + ;; https://github.com/OpenBoardView/OpenBoardView/issues/229 and + ;; https://issues.guix.gnu.org/53647). + (substitute* '("src/openboardview/BoardView.cpp" + "src/openboardview/main_opengl.cpp") + (("__TIMESTAMP__") + "__DATE__")))) + (add-before 'configure 'configure-glad + (lambda* (#:key inputs #:allow-other-keys) + (substitute* "src/CMakeLists.txt" + (("add_subdirectory\\(glad\\)") + (string-append + ;; Configure Glad to use static Khronos XML specifications + ;; instead of attempting to fetch them from the Internet. + "option(GLAD_REPRODUCIBLE \"Reproducible build\" ON)\n" + ;; Use the CMake files from our glad package. + "add_subdirectory(" + (search-input-directory inputs "share/glad") ;source_dir + " src/glad)\n"))))) ;binary dir + (add-before 'configure 'fix-utf8-include-directive + ;; Our utf8-h package makes the header available as "utf8.h" + ;; directly rather than "utf8/utf8.h". + (lambda _ + (substitute* '("src/openboardview/FileFormats/BRDFile.cpp" + "src/openboardview/BoardView.cpp") + (("utf8/utf8.h") "utf8.h")))) + (add-before 'configure 'dynamically-load-gtk-via-absolute-path + ;; The GTK library is not linked thus not present in the RUNPATH of + ;; the produced binary; the absolute path of the libraries must to + ;; the dynamic loader otherwise they aren't found. + (lambda* (#:key inputs #:allow-other-keys) + (substitute* "src/openboardview/unix.cpp" + (("libgtk-3.so") + (search-input-file inputs "lib/libgtk-3.so"))))) + ;; Add the two extra phases from `glib-or-gtk-build-system'. + (add-after 'install 'glib-or-gtk-compile-schemas + (assoc-ref gtk:%standard-phases 'glib-or-gtk-compile-schemas)) + (add-after 'install 'glib-or-gtk-wrap + (assoc-ref gtk:%standard-phases 'glib-or-gtk-wrap))))) + (native-inputs + (list pkg-config + python + glad + stb-image + utf8-h)) + (inputs + (list fontconfig + gtk+ + sdl2 + sqlite + zlib)) + (home-page "https://openboardview.org/") + (synopsis "Viewer for BoardView files") + (description "OpenBoardView is a viewer for BoardView files, which present +the details of a printed circuit board (PCB). It comes with features +such as: +@itemize +@item Dynamic part outline rendering, including complex connectors +@item Annotations, for leaving notes about parts, nets, pins or location +@item Configurable colour themes +@item Configurable DPI to facilitate usage on 4K monitors +@item Configurable for running on slower systems +@item Reads FZ (with key), BRD, BRD2, BDV and BV* formats. +@end itemize") + (license license:expat))) + (define-public pulseview (package (name "pulseview") diff --git a/gnu/packages/patches/openboardview-use-system-utf8.patch b/gnu/packages/patches/openboardview-use-system-utf8.patch new file mode 100644 index 0000000000..25b5952bda --- /dev/null +++ b/gnu/packages/patches/openboardview-use-system-utf8.patch @@ -0,0 +1,48 @@ +From 251e23422f37c93a3f460fb660c5e5bfa8200d91 Mon Sep 17 00:00:00 2001 +From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com> +Date: Sun, 2 Dec 2018 16:40:39 -0500 +Subject: [PATCH] build system: Allow using utf8.h from the system. + +--- + src/CMakeLists.txt | 12 ++++++++---- + src/openboardview/CMakeLists.txt | 1 + + 2 files changed, 9 insertions(+), 4 deletions(-) + +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 90442ed..26d4a69 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -8,10 +8,14 @@ if(NOT WIN32 OR MINGW) + endif() + + ## utf8.h ## +-execute_process( +- COMMAND git submodule update --init src/utf8 +- WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} +-) ++FIND_PATH(UTF8_INCLUDE_DIR utf8.h) ++if(NOT UTF8_INCLUDE_DIR) ++ execute_process( ++ COMMAND git submodule update --init src/utf8 ++ WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} ++ ) ++ set(UTF8_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/utf8) ++endif() + + ## zlib ## + find_package(ZLIB) +diff --git a/src/openboardview/CMakeLists.txt b/src/openboardview/CMakeLists.txt +index b0bdbe3..6c4564c 100644 +--- a/src/openboardview/CMakeLists.txt ++++ b/src/openboardview/CMakeLists.txt +@@ -44,6 +44,7 @@ include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/.. + ${IMGUI_INCLUDE_DIRS} ++ ${UTF8_INCLUDE_DIR} + ${GLAD_INCLUDE_DIRS} + ${GTK_INCLUDE_DIRS} + ${OPENGL_INCLUDE_DIR} +-- +2.34.0 + -- 2.34.0
guix-patches <at> gnu.org
:bug#53634
; Package guix-patches
.
(Wed, 09 Feb 2022 10:46:02 GMT) Full text and rfc822 format available.Message #23 received at 53634 <at> debbugs.gnu.org (full text, mbox):
From: Ludovic Courtès <ludo <at> gnu.org> To: Maxim Cournoyer <maxim.cournoyer <at> gmail.com> Cc: 53634 <at> debbugs.gnu.org Subject: Re: bug#53634: [PATCH 0/4] gnu: Add openboardview. Date: Wed, 09 Feb 2022 11:45:40 +0100
Hi! Maxim Cournoyer <maxim.cournoyer <at> gmail.com> skribis: > I've finally got around to getting this to build and run. I got interested in > it when wanting to view board files for an X200 (libreboot-related). > > Enjoy, > > Maxim Cournoyer (4): > gnu: Add imgui. > gnu: Add glad. > gnu: Add utf8-h. > gnu: Add openboardview. I haven’t actually tried it but the patch series LGTM! Thanks, Ludo’.
Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
:Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
:Message #28 received at 53634-done <at> debbugs.gnu.org (full text, mbox):
From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com> To: Ludovic Courtès <ludo <at> gnu.org> Cc: 53634-done <at> debbugs.gnu.org Subject: Re: bug#53634: [PATCH 0/4] gnu: Add openboardview. Date: Wed, 09 Feb 2022 15:30:26 -0500
Hello! Ludovic Courtès <ludo <at> gnu.org> writes: > Hi! > > Maxim Cournoyer <maxim.cournoyer <at> gmail.com> skribis: > >> I've finally got around to getting this to build and run. I got interested in >> it when wanting to view board files for an X200 (libreboot-related). >> >> Enjoy, >> >> Maxim Cournoyer (4): >> gnu: Add imgui. >> gnu: Add glad. >> gnu: Add utf8-h. >> gnu: Add openboardview. > > I haven’t actually tried it but the patch series LGTM! Thanks! I noticed I had forogetten to register the new gnu/packages/toolkits.scm file I added for imgui; I fixed that and pushed as 32ccbc3a1e. Thank you! Maxim
Debbugs Internal Request <help-debbugs <at> gnu.org>
to internal_control <at> debbugs.gnu.org
.
(Thu, 10 Mar 2022 12:24:06 GMT) Full text and rfc822 format available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.