From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: 53634@debbugs.gnu.org
Cc: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Subject: [bug#53634] [PATCH v2 4/4] gnu: Add openboardview.
Date: Mon, 31 Jan 2022 00:45:02 -0500 [thread overview]
Message-ID: <20220131054502.6258-1-maxim.cournoyer@gmail.com> (raw)
In-Reply-To: <20220130074848.3397-4-maxim.cournoyer@gmail.com>
* 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@lassieur.org>
;;; Copyright © 2021 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2021 Leo Famulari <leo@famulari.name>
+;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer@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@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
next prev parent reply other threads:[~2022-01-31 5:48 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-30 7:45 [bug#53634] [PATCH 0/4] gnu: Add openboardview Maxim Cournoyer
2022-01-30 7:48 ` [bug#53634] [PATCH 1/4] gnu: Add imgui Maxim Cournoyer
2022-01-30 7:48 ` [bug#53634] [PATCH 2/4] gnu: Add glad Maxim Cournoyer
2022-01-30 7:48 ` [bug#53634] [PATCH 3/4] gnu: Add utf8-h Maxim Cournoyer
2022-01-30 7:48 ` [bug#53634] [PATCH 4/4] gnu: Add openboardview Maxim Cournoyer
2022-01-31 5:22 ` bug#53647: __TIMESTAMP__ CPP macro not honoring SOURCE_EPOCH_DATE Maxim Cournoyer
2022-01-31 5:45 ` Maxim Cournoyer [this message]
2022-02-09 10:45 ` [bug#53634] [PATCH 0/4] gnu: Add openboardview Ludovic Courtès
2022-02-09 20:30 ` bug#53634: " Maxim Cournoyer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220131054502.6258-1-maxim.cournoyer@gmail.com \
--to=maxim.cournoyer@gmail.com \
--cc=53634@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.